diff options
Diffstat (limited to 'user/rspamd')
-rw-r--r-- | user/rspamd/10-conf-split-workers.patch | 88 | ||||
-rw-r--r-- | user/rspamd/APKBUILD | 142 | ||||
-rw-r--r-- | user/rspamd/rspamd.confd | 13 | ||||
-rw-r--r-- | user/rspamd/rspamd.initd | 51 | ||||
-rw-r--r-- | user/rspamd/rspamd.logrotated | 11 | ||||
-rw-r--r-- | user/rspamd/rspamd.pre-install | 6 |
6 files changed, 311 insertions, 0 deletions
diff --git a/user/rspamd/10-conf-split-workers.patch b/user/rspamd/10-conf-split-workers.patch new file mode 100644 index 000000000..be8f073e4 --- /dev/null +++ b/user/rspamd/10-conf-split-workers.patch @@ -0,0 +1,88 @@ +Since we split workers into subpackages, we have to split the main config +that defines workers to be loaded. + +NOTE: This is intentionally done in patch file instead of modifying the config +with sed and generating the worker configs to avoid silent breakages when +upgrading the aport! + +--- a/conf/rspamd.conf ++++ b/conf/rspamd.conf +@@ -35,33 +35,4 @@ + .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/logging.inc" + } + +-worker "normal" { +- bind_socket = "localhost:11333"; +- .include "$CONFDIR/worker-normal.inc" +- .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/worker-normal.inc" +- .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-normal.inc" +-} +- +-worker "controller" { +- bind_socket = "localhost:11334"; +- .include "$CONFDIR/worker-controller.inc" +- .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/worker-controller.inc" +- .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-controller.inc" +-} +- +-worker "rspamd_proxy" { +- bind_socket = "localhost:11332"; +- .include "$CONFDIR/worker-proxy.inc" +- .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/worker-proxy.inc" +- .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-proxy.inc" +-} +- +-# Local fuzzy storage is disabled by default +- +-worker "fuzzy" { +- bind_socket = "localhost:11335"; +- count = -1; # Disable by default, see #4677 for details +- .include "$CONFDIR/worker-fuzzy.inc" +- .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/worker-fuzzy.inc" +- .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-fuzzy.inc" +-} ++.include(glob=true) "$CONFDIR/worker-*.conf" +--- /dev/null ++++ b/conf/worker-normal.conf +@@ -0,0 +1,8 @@ ++# Included from top-level .conf file ++ ++worker "normal" { ++ bind_socket = "localhost:11333"; ++ .include "$CONFDIR/worker-normal.inc" ++ .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/worker-normal.inc" ++ .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-normal.inc" ++} +--- /dev/null ++++ b/conf/worker-controller.conf +@@ -0,0 +1,8 @@ ++# Included from top-level .conf file ++ ++worker "controller" { ++ bind_socket = "localhost:11334"; ++ .include "$CONFDIR/worker-controller.inc" ++ .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/worker-controller.inc" ++ .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-controller.inc" ++} +--- /dev/null ++++ b/conf/worker-proxy.conf +@@ -0,0 +1,8 @@ ++# Included from top-level .conf file ++ ++worker "rspamd_proxy" { ++ bind_socket = "localhost:11332"; ++ .include "$CONFDIR/worker-proxy.inc" ++ .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/worker-proxy.inc" ++ .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-proxy.inc" ++} +--- /dev/null ++++ b/conf/worker-fuzzy.conf +@@ -0,0 +1,8 @@ ++# Included from top-level .conf file ++ ++worker "fuzzy" { ++ bind_socket = "localhost:11335"; ++ .include "$CONFDIR/worker-fuzzy.inc" ++ .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/worker-fuzzy.inc" ++ .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-fuzzy.inc" ++} diff --git a/user/rspamd/APKBUILD b/user/rspamd/APKBUILD new file mode 100644 index 000000000..e4d36f982 --- /dev/null +++ b/user/rspamd/APKBUILD @@ -0,0 +1,142 @@ +# Contributor: Valery Kartel <valery.kartel@gmail.com> +# Contributor: Nathan Angelacos <nangel@alpinelinux.org> +# Contributor: TBK <alpine@jjtc.eu> +# Contributor: Jakub Jirutka <jakub@jirutka.cz> +# Contributor: Duncan Bellamy <dunk@denkimushi.com> +# Maintainer: Lee Starnes <lee@canned-death.us> +pkgname=rspamd +pkgver=3.11.1 +pkgrel=0 +pkgdesc="Fast, free and open-source spam filtering system" +url="https://rspamd.com/" +arch="all" +options="!check" # Tests require LuaJIT's ffi module +license="Apache-2.0 AND BSD-1-Clause AND BSD-2-Clause AND BSD-3-Clause AND CC0-1.0 AND LGPL-2.1+ AND LGPL-3.0-only AND MIT AND Zlib" +pkgusers="rspamd" +pkggroups="rspamd" +depends="" +checkdepends="luarocks" +makedepends=" + cmake + curl-dev + file-dev + glib-dev + icu-dev + libarchive-dev + libevent-dev + libexecinfo-dev + libgd-dev + libsodium-dev + lua5.3 + lua5.3-dev + openssl-dev + pcre2-dev + perl + ragel + sqlite-dev + zstd-dev + " +install="$pkgname.pre-install" +subpackages=" + $pkgname-doc + $pkgname-client + $pkgname-libs + $pkgname-utils::noarch + $pkgname-openrc + $pkgname-dbg + " +ldpath="/usr/lib/rspamd" +source="$pkgname-$pkgver.tar.gz::https://github.com/rspamd/rspamd/archive/$pkgver.tar.gz + $pkgname.logrotated + $pkgname.initd + $pkgname.confd + " + +provides=" + rspamd-controller=$pkgver-r$pkgrel + rspamd-fuzzy=$pkgver-r$pkgrel + rspamd-proxy=$pkgver-r$pkgrel + " + +replaces="rspamd-controller rspamd-fuzzy rspamd-proxy" + +build() { + if [ "$CBUILD" != "$CHOST" ]; then + CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux" + fi + LDFLAGS="$LDFLAGS -lexecinfo" cmake -B build \ + -DCMAKE_BUILD_TYPE=None \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCONFDIR=/etc/$pkgname \ + -DRUNDIR=/run/$pkgname \ + -DRSPAMD_USER=$pkgusers \ + -DRSPAMD_GROUP=$pkggroups \ + -DENABLE_LUAJIT=OFF \ + -DLUA_INCLUDE_DIR=/usr/include/lua5.3 \ + -DLUA_LIBRARY=/usr/lib/lua5.3/liblua.so \ + -DENABLE_URL_INCLUDE=ON \ + -DENABLE_BACKWARD=OFF \ + -DENABLE_PCRE2=ON \ + -DENABLE_URL_INCLUDE=ON \ + -DSYSTEM_ZSTD=ON \ + -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ + -DCMAKE_C_FLAGS="$CFLAGS" \ + "$CMAKE_CROSSOPTS" . + cmake --build build --target all +} + +check() { + cmake --build build --target run-test +} + +package() { + DESTDIR="$pkgdir" cmake --install build + + cd "$pkgdir" + + install -D usr/share/"$pkgname"/www/README.md \ + usr/share/doc/"$pkgname"/README.md + rm usr/share/"$pkgname"/www/README.md + + install -Dm 644 "$srcdir"/$pkgname.logrotated etc/logrotate.d/$pkgname + install -Dm 755 "$srcdir"/$pkgname.initd etc/init.d/$pkgname + install -Dm 644 "$srcdir"/$pkgname.confd etc/conf.d/$pkgname + install -d etc/"$pkgname"/local.d etc/"$pkgname"/override.d + + mkdir -p etc/$pkgname/local.d \ + etc/$pkgname/override.d + + install -dm 750 -o rspamd -g rspamd \ + var/lib/$pkgname + install -dm 750 -o rspamd -g rspamd \ + var/log/$pkgname + install -dm 755 -o rspamd -g rspamd \ + etc/$pkgname/local.d/maps.d +} + +client() { + pkgdesc="$pkgdesc (console client)" + + mkdir -p "$subpkgdir/usr/bin" + mv "$pkgdir"/usr/bin/rspamc* "$subpkgdir/usr/bin/" +} + +libs() { + pkgdesc="$pkgdesc (libraries)" + + mkdir -p "$subpkgdir/usr/lib/$pkgname" + mv "$pkgdir/usr/lib/$pkgname/"*.so "$subpkgdir/usr/lib/$pkgname/" +} + +utils() { + pkgdesc="$pkgdesc (utilities)" + depends="perl" + + mkdir -p "$subpkgdir/usr/bin" + mv "$pkgdir/usr/bin/${pkgname}"_stats "$subpkgdir/usr/bin/" +} + +sha512sums="979aad9d2cc720c12922d55f4ad742b65e18d0ca52ebb764a2432bd3d64e559461c8e1fa87f7ac52e614df71d0a776aa0362a876eaa745cd3f8c21afee52b8ab rspamd-3.11.1.tar.gz +2efe28575c40d1fba84b189bb872860e744400db80dce2f6330be6c6287fb3f46e6511284729b957488bf40bcb9b0952e26df9934f5f138334bd2766075c45cb rspamd.logrotated +c136126e3d3953079939b2b0b9b49f5f921af4c3aa0ad59a206632436ff963a69b5980a3b8e4eb14882d8db31d6fd96045a9e1cd6302ad111d76b8e92fab890e rspamd.initd +a2003ef0c9d64a44480f59302864a2dfedcbe3a0047fcbb655408bc8aae9014b6ad0ddc6b64d4abeeb21bea0f86678afd30589ac8eed83e07ad7f87710e93702 rspamd.confd" diff --git a/user/rspamd/rspamd.confd b/user/rspamd/rspamd.confd new file mode 100644 index 000000000..620eecb94 --- /dev/null +++ b/user/rspamd/rspamd.confd @@ -0,0 +1,13 @@ +# Configuration for /etc/init.d/rspamd + +# User and group to run rspamd workers. +#command_user="rspamd:rspamd" + +# Path of the main configuration file. +#cfgfile="/etc/rspamd/rspamd.conf" + +# Where to log startup configuration checking: +# - /dev/null - silent if check pass (default) +# - /dev/stdout - always print output on the curent terminal +# - /path/filename - append output to the specified logfile +#startuplog="/var/log/rspamd/startup.log" diff --git a/user/rspamd/rspamd.initd b/user/rspamd/rspamd.initd new file mode 100644 index 000000000..cf0ea79ab --- /dev/null +++ b/user/rspamd/rspamd.initd @@ -0,0 +1,51 @@ +#!/sbin/openrc-run + +extra_commands="checkconfig" +extra_started_commands="reload reopen" + +description="Rapid spam filtering system" +description_checkconfig="Check configuration" +description_reload="Reload configuration" +description_reopen="Reopen log files" + +# Uppercase variables are here for backward compatibility only. +: ${command_user:="${RSPAMD_USER:-rspamd}:${RSPAMD_GROUP:-rspamd}"} +: ${cfgfile:=${RSPAMD_CONFIG:-/etc/rspamd/rspamd.conf}} +: ${startuplog:=${RSPAMD_STARTUPLOG:-/dev/null}} + +command="/usr/bin/rspamd" +command_args="--config $cfgfile --no-fork ${command_args:-}" +command_background="yes" +pidfile="/run/rspamd/$RC_SVCNAME.pid" + +required_files="$cfgfile" + +depend() { + need localmount net + before mta + after redis +} + +start_pre() { + checkpath -d -m 755 -o "$command_user" ${pidfile%/*} + checkconfig >/dev/null 2>>"$startuplog" || checkconfig +} + +checkconfig() { + ebegin "Checking $name configuration" + + rspamadm configtest + eend $? +} + +reload() { + ebegin "Reloading $name configuration" + start_pre && start-stop-daemon --signal HUP --pidfile $pidfile + eend $? +} + +reopen() { + ebegin "Reopening $name log files" + start-stop-daemon --signal USR1 --pidfile $pidfile + eend $? +} diff --git a/user/rspamd/rspamd.logrotated b/user/rspamd/rspamd.logrotated new file mode 100644 index 000000000..2a443f2de --- /dev/null +++ b/user/rspamd/rspamd.logrotated @@ -0,0 +1,11 @@ +/var/log/rspamd/*log { + daily + rotate 10 + missingok + notifempty + compress + sharedscripts + postrotate + /etc/init.d/rspamd --ifstarted --quiet reopen + endscript +} diff --git a/user/rspamd/rspamd.pre-install b/user/rspamd/rspamd.pre-install new file mode 100644 index 000000000..b2f35bdd8 --- /dev/null +++ b/user/rspamd/rspamd.pre-install @@ -0,0 +1,6 @@ +#!/bin/sh + +groupadd -r rspamd 2>/dev/null +useradd -r -d /var/lib/rspamd -s /sbin/nologin -G rspamd -g rspamd rspamd 2>/dev/null + +exit 0 |