mail-filter/rspamd: bump to v1.8.3
authorThomas Deutschmann <whissi@gentoo.org>
Wed, 16 Jan 2019 03:15:11 +0000 (04:15 +0100)
committerThomas Deutschmann <whissi@gentoo.org>
Wed, 16 Jan 2019 03:15:44 +0000 (04:15 +0100)
- runscript rewritten

- username used in systemd unit adjusted for Gentoo

- priv escalation via PID file fixed

- dev-util/ragel version constraint removed (package
  is now compatible with ragel-7)

Closes: https://github.com/gentoo/gentoo/pull/10598
Closes: https://github.com/gentoo/gentoo/pull/10561
Closes: https://github.com/gentoo/gentoo/pull/10057
Package-Manager: Portage-2.3.56, Repoman-2.3.12
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
mail-filter/rspamd/Manifest
mail-filter/rspamd/files/rspamd-r1.logrotate [new file with mode: 0644]
mail-filter/rspamd/files/rspamd-r6.init [new file with mode: 0644]
mail-filter/rspamd/files/rspamd.conf [new file with mode: 0644]
mail-filter/rspamd/files/rspamd.tmpfile [new file with mode: 0644]
mail-filter/rspamd/rspamd-1.8.3.ebuild [new file with mode: 0644]
mail-filter/rspamd/rspamd-9999.ebuild

index 2223d7172bbb3d14de147818f8bb666d405af767..d45c6ec491acc20522f17b884c9883f595e38808 100644 (file)
@@ -7,3 +7,4 @@ DIST rspamd-1.7.7.tar.gz 4534430 BLAKE2B 83ba39b80293bf87f397e6b1b1cbec27e7c44f0
 DIST rspamd-1.7.8.tar.gz 4542955 BLAKE2B 78fbb01c51d290f8d88f4c512df248fcbc8e28e00a820ba0d3dc22adf4bb1b54b1923aa5306fde5d4d75c81a9304f220608a6cec3f1077bbb9adfa1ea8bdc2a4 SHA512 43f2350dfa4e0369cd53480bd4c8d0aa3898d7c471540281e7460a264207032aea226c4fd519a26397b9e9e8c8de3951e5a9752e010eabf1b3733a0c3e3086c2
 DIST rspamd-1.7.9.tar.gz 4557492 BLAKE2B f42775ba8157ef4815331c304e3030c522e9ae5e10ef0194da0c7dde105b40fed2ae84b063d78aed37992146311aecc1ac77f64dacdaf3ff11bb85076e8aef7c SHA512 d11d8c03668b85feae665ed491cd156c7430fbad30f42fe44103ea3c3a8bc988e5f8981e784e8f31aa35ba1ff9f7abd23605638e4ee3086a056b22fb3109563e
 DIST rspamd-1.8.1.tar.gz 4286637 BLAKE2B dd202a2f3dab4ef459d978e06231f8fcef3724ea5912c7455d553dc04e2744322b9144ba05a2f6f22a7eb58cd0a967f213bfc76fb273b5425036a5042975ed89 SHA512 98c2d909b7dc19f1c431d4e64444968092a10630ef238d3c8cc2825e7b2d92bee893bc7f9c431f3a6337ef2af4d2a157f0584e7b13fba0540660d7c853bc25cc
+DIST rspamd-1.8.3.tar.gz 4319623 BLAKE2B b7fdd6791df5899710bb1d696a9b94d1840335b6a34d6cdeebc2b5eebe9f4e5b6da3e90ed9ab5e3945aab7ef33f54f048024b51c3de37db1a083ad89c656b456 SHA512 5e20255466fe2cd4842196fb2138732b59911de655e73d9cc13009b5179b84e5a2060083961b35fe40b9f550f8e18067056415a1d803fac54fac000070024c01
diff --git a/mail-filter/rspamd/files/rspamd-r1.logrotate b/mail-filter/rspamd/files/rspamd-r1.logrotate
new file mode 100644 (file)
index 0000000..5cb2fdd
--- /dev/null
@@ -0,0 +1,16 @@
+/var/log/rspamd/rspamd.log {
+       daily
+       rotate 4
+       delaycompress
+       compress
+       notifempty
+       missingok
+       postrotate
+               if test -d /run/systemd/system ; then
+                       systemctl kill -s USR1 --kill-who=main rspamd.service
+               else
+                       test -r /run/rspamd.pid && kill -USR1 $(cat /run/rspamd.pid) &>/dev/null
+               fi
+       endscript
+}
+
diff --git a/mail-filter/rspamd/files/rspamd-r6.init b/mail-filter/rspamd/files/rspamd-r6.init
new file mode 100644 (file)
index 0000000..8c31fd7
--- /dev/null
@@ -0,0 +1,55 @@
+#!/sbin/openrc-run
+# Copyright 2015-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+RSPAMD_CONFIGFILE=${RSPAMD_CONFIGFILE:-"/etc/rspamd/rspamd.conf"}
+RSPAMD_GROUP=${RSPAMD_GROUP:-rspamd}
+RSPAMD_OPTS=${RSPAMD_OPTS:-""}
+RSPAMD_PIDFILE=${RSPAMD_PIDFILE:-"/run/rspamd.pid"}
+RSPAMD_USER=${RSPAMD_USER:-rspamd}
+
+command="/usr/bin/rspamd"
+command_args="${RSPAMD_OPTS} -c \"${RSPAMD_CONFIGFILE}\" -u ${RSPAMD_USER} -g ${RSPAMD_GROUP} --pid \"${RSPAMD_PIDFILE}\""
+start_stop_daemon_args=${RSPAMD_SSDARGS:-"--wait 1000"}
+pidfile="${RSPAMD_PIDFILE}"
+retry=${RSPAMD_TERMTIMEOUT:-"TERM/60/KILL/5"}
+
+required_files="${RSPAMD_CONFIGFILE}"
+
+description="Rapid spam filtering system"
+
+extra_commands="checkconfig"
+extra_started_commands="reload"
+
+description_checkconfig="Validate rspamd's configuration"
+description_reload="Sends rspamd a signal to reload its configuration"
+
+depend() {
+       before mta
+       use dns redis
+}
+
+checkconfig() {
+       ${command} -c "${RSPAMD_CONFIGFILE}" -u ${RSPAMD_USER} -g ${RSPAMD_GROUP} -t 1>/dev/null \
+               || return 1
+}
+
+reload() {
+       checkconfig || return 1
+
+       ebegin "Reloading ${SVCNAME}"
+       start-stop-daemon --signal HUP --pidfile "${pidfile}"
+       eend $?
+}
+
+start_pre() {
+       if [ "${RC_CMD}" != "restart" ]; then
+               checkconfig || return 1
+       fi
+}
+
+stop_pre() {
+       if [ "${RC_CMD}" = "restart" ]; then
+               checkconfig || return 1
+       fi
+}
diff --git a/mail-filter/rspamd/files/rspamd.conf b/mail-filter/rspamd/files/rspamd.conf
new file mode 100644 (file)
index 0000000..f3a65cb
--- /dev/null
@@ -0,0 +1,26 @@
+# /etc/conf.d/rspamd
+
+# Configuration file
+#RSPAMD_CONFIGFILE="/etc/rsyslog.conf"
+
+# PID file
+# If you should ever change this, remember to update
+# "/etc/logrotate.d/rspamd", too.
+#RSPAMD_PIDFILE="/run/rspamd.pid"
+
+# You can use this configuration option to pass additional options to the
+# start-stop-daemon, see start-stop-daemon(8) for more details.
+# Per default we wait 1000ms after we have started the service to ensure
+# that the daemon is really up and running.
+#RSPAMD_SSDARGS="--wait 1000"
+
+# The termination timeout (start-stop-daemon parameter "retry") ensures
+# that the service will be terminated within a given time (60 + 5 seconds
+# per default) when you are stopping the service.
+#RSPAMD_TERMTIMEOUT="TERM/60/KILL/5"
+
+# Options to rspamd
+# See rspamd(8) for more details
+# Notes:
+# * Do not specify another CONFIGFILE but use the variable above to change the location
+#RSPAMD_OPTS=""
diff --git a/mail-filter/rspamd/files/rspamd.tmpfile b/mail-filter/rspamd/files/rspamd.tmpfile
new file mode 100644 (file)
index 0000000..9f7a2c4
--- /dev/null
@@ -0,0 +1 @@
+d /run/rspamd 0755 rspamd rspamd
diff --git a/mail-filter/rspamd/rspamd-1.8.3.ebuild b/mail-filter/rspamd/rspamd-1.8.3.ebuild
new file mode 100644 (file)
index 0000000..64cb537
--- /dev/null
@@ -0,0 +1,98 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit cmake-utils pax-utils systemd tmpfiles user
+
+if [[ ${PV} == *9999 ]] ; then
+       EGIT_REPO_URI="https://github.com/vstakhov/rspamd.git"
+       inherit git-r3
+else
+       SRC_URI="https://github.com/vstakhov/rspamd/archive/${PV}.tar.gz -> ${P}.tar.gz"
+       KEYWORDS="~amd64 ~x86"
+fi
+
+DESCRIPTION="Rapid spam filtering system"
+HOMEPAGE="https://github.com/vstakhov/rspamd"
+LICENSE="Apache-2.0"
+SLOT="0"
+IUSE="cpu_flags_x86_ssse3 fann gd jemalloc +jit libressl pcre2 +torch"
+REQUIRED_USE="torch? ( jit )"
+
+RDEPEND="dev-db/sqlite:3
+       dev-libs/glib:2
+       dev-libs/icu:=
+       dev-libs/libevent:=
+       net-libs/libnsl
+       sys-apps/file
+       dev-util/ragel
+       cpu_flags_x86_ssse3? ( dev-libs/hyperscan )
+       fann? ( sci-mathematics/fann )
+       gd? ( media-libs/gd[jpeg] )
+       jemalloc? ( dev-libs/jemalloc )
+       jit? ( dev-lang/luajit:2 )
+       !libressl? ( dev-libs/openssl:0=[-bindist] )
+       libressl? ( dev-libs/libressl:0= )
+       pcre2? ( dev-libs/libpcre2[jit=] )
+       !pcre2? ( dev-libs/libpcre[jit=] )"
+DEPEND="${RDEPEND}"
+
+pkg_setup() {
+       enewgroup rspamd
+       enewuser rspamd -1 -1 /var/lib/rspamd rspamd
+}
+
+src_prepare() {
+       cmake-utils_src_prepare
+
+       sed -i -e 's/User=_rspamd/User=rspamd/g' \
+               rspamd.service \
+               || die
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DCONFDIR=/etc/rspamd
+               -DRUNDIR=/var/run/rspamd
+               -DDBDIR=/var/lib/rspamd
+               -DLOGDIR=/var/log/rspamd
+               -DENABLE_LUAJIT=$(usex jit ON OFF)
+               -DENABLE_FANN=$(usex fann ON OFF)
+               -DENABLE_GD=$(usex gd ON OFF)
+               -DENABLE_PCRE2=$(usex pcre2 ON OFF)
+               -DENABLE_JEMALLOC=$(usex jemalloc ON OFF)
+               -DENABLE_HYPERSCAN=$(usex cpu_flags_x86_ssse3 ON OFF)
+               -DENABLE_TORCH=$(usex torch ON OFF)
+       )
+       cmake-utils_src_configure
+}
+
+src_test() {
+       cmake-utils_src_test
+}
+
+src_install() {
+       cmake-utils_src_install
+
+       newconfd "${FILESDIR}"/rspamd.conf rspamd
+       newinitd "${FILESDIR}/rspamd-r6.init" rspamd
+       systemd_newunit rspamd.service rspamd.service
+
+       newtmpfiles "${FILESDIR}"/${PN}.tmpfile ${PN}.conf
+
+       # Remove mprotect for JIT support
+       if use jit; then
+               pax-mark m "${ED%/}"/usr/bin/rspamd-* "${ED%/}"/usr/bin/rspamadm-*
+       fi
+
+       insinto /etc/logrotate.d
+       newins "${FILESDIR}"/rspamd-r1.logrotate rspamd
+
+       diropts -o rspamd -g rspamd
+       keepdir /var/{lib,log}/rspamd
+}
+
+pkg_postinst() {
+       tmpfiles_process "${PN}.conf"
+}
index 40d3b529082559ce5ff56ec48660588db33f2c53..64cb537424f351902c42190cb4e3ac6016559375 100644 (file)
@@ -1,26 +1,20 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
 
-if [[ ${PV} == *9999 ]] ; then
-       SCM="git-r3"
-       EGIT_REPO_URI="https://github.com/vstakhov/rspamd.git"
-fi
-
-inherit cmake-utils pax-utils systemd user ${SCM}
-
-DESCRIPTION="Rapid spam filtering system"
-HOMEPAGE="https://github.com/vstakhov/rspamd"
+inherit cmake-utils pax-utils systemd tmpfiles user
 
 if [[ ${PV} == *9999 ]] ; then
-       SRC_URI=""
-       KEYWORDS=""
+       EGIT_REPO_URI="https://github.com/vstakhov/rspamd.git"
+       inherit git-r3
 else
        SRC_URI="https://github.com/vstakhov/rspamd/archive/${PV}.tar.gz -> ${P}.tar.gz"
        KEYWORDS="~amd64 ~x86"
 fi
 
+DESCRIPTION="Rapid spam filtering system"
+HOMEPAGE="https://github.com/vstakhov/rspamd"
 LICENSE="Apache-2.0"
 SLOT="0"
 IUSE="cpu_flags_x86_ssse3 fann gd jemalloc +jit libressl pcre2 +torch"
@@ -32,7 +26,7 @@ RDEPEND="dev-db/sqlite:3
        dev-libs/libevent:=
        net-libs/libnsl
        sys-apps/file
-       <dev-util/ragel-7.0
+       dev-util/ragel
        cpu_flags_x86_ssse3? ( dev-libs/hyperscan )
        fann? ( sci-mathematics/fann )
        gd? ( media-libs/gd[jpeg] )
@@ -49,6 +43,14 @@ pkg_setup() {
        enewuser rspamd -1 -1 /var/lib/rspamd rspamd
 }
 
+src_prepare() {
+       cmake-utils_src_prepare
+
+       sed -i -e 's/User=_rspamd/User=rspamd/g' \
+               rspamd.service \
+               || die
+}
+
 src_configure() {
        local mycmakeargs=(
                -DCONFDIR=/etc/rspamd
@@ -66,22 +68,31 @@ src_configure() {
        cmake-utils_src_configure
 }
 
+src_test() {
+       cmake-utils_src_test
+}
+
 src_install() {
        cmake-utils_src_install
-       newinitd "${FILESDIR}/rspamd.init-r5" rspamd
+
+       newconfd "${FILESDIR}"/rspamd.conf rspamd
+       newinitd "${FILESDIR}/rspamd-r6.init" rspamd
+       systemd_newunit rspamd.service rspamd.service
+
+       newtmpfiles "${FILESDIR}"/${PN}.tmpfile ${PN}.conf
 
        # Remove mprotect for JIT support
        if use jit; then
-               pax-mark m "${ED}"/usr/bin/rspamd-* "${ED}"/usr/bin/rspamadm-*
+               pax-mark m "${ED%/}"/usr/bin/rspamd-* "${ED%/}"/usr/bin/rspamadm-*
        fi
 
-       keepdir /var/lib/rspamd
-       keepdir /var/log/rspamd
-
-       fowners rspamd:rspamd /var/lib/rspamd /var/log/rspamd
-
        insinto /etc/logrotate.d
-       newins "${FILESDIR}/rspamd.logrotate" rspamd
+       newins "${FILESDIR}"/rspamd-r1.logrotate rspamd
 
-       systemd_newunit rspamd.service rspamd.service
+       diropts -o rspamd -g rspamd
+       keepdir /var/{lib,log}/rspamd
+}
+
+pkg_postinst() {
+       tmpfiles_process "${PN}.conf"
 }