diff options
-rw-r--r-- | CMakeLists.txt | 9 | ||||
-rw-r--r-- | debian/control | 2 | ||||
-rw-r--r-- | debian/logging.conf | 4 | ||||
-rw-r--r-- | debian/rspamd.install | 2 | ||||
-rwxr-xr-x | debian/rules | 5 | ||||
-rw-r--r-- | debian/workers.conf | 19 | ||||
-rw-r--r-- | rspamd.service | 14 | ||||
-rw-r--r-- | rspamd.socket | 11 |
8 files changed, 64 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 211bf9579..b100f1525 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,6 +91,10 @@ IF(NOT INCLUDEDIR) SET(INCLUDEDIR include/rspamd) ENDIF(NOT INCLUDEDIR) +IF(NOT SYSTEMDDIR) + SET(SYSTEMDDIR ${CMAKE_INSTALL_PREFIX}/lib/systemd/system) +ENDIF(NOT SYSTEMDDIR) + ############################# INCLUDE SECTION ############################################# INCLUDE(CheckIncludeFiles) @@ -1015,6 +1019,11 @@ FOREACH(LUA_CONF ${LUA_CONFIGS}) INSTALL(FILES "conf/lua/${LUA_CONF}" DESTINATION ${CONFDIR}/lua/${_rp}) ENDFOREACH(LUA_CONF) +# systemd unit + +INSTALL(FILES "rspamd.service" DESTINATION ${SYSTEMDDIR}) +INSTALL(FILES "rspamd.socket" DESTINATION ${SYSTEMDDIR}) + # Manual pages INSTALL(FILES "doc/rspamd.8" DESTINATION ${MANDIR}/man8) INSTALL(FILES "doc/rspamc.1" DESTINATION ${MANDIR}/man1) diff --git a/debian/control b/debian/control index e89f26946..f83005671 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: rspamd Section: mail Priority: optional Maintainer: Mikhail Gusarov <dottedmag@debian.org> -Build-Depends: debhelper (>= 9), dpkg-dev (>= 1.16.1~), cmake, libevent-dev (>= 1.3), libglib2.0-dev (>= 2.16.0), libgmime-2.6-dev, liblua5.2-dev | liblua5.1-dev | liblua5.1-0-dev, libpcre3-dev, libssl-dev (>= 1.0), libcurl4-openssl-dev, libhiredis-dev +Build-Depends: debhelper (>= 9), dpkg-dev (>= 1.16.1~), cmake, libevent-dev (>= 1.3), libglib2.0-dev (>= 2.16.0), libgmime-2.6-dev, liblua5.2-dev | liblua5.1-dev | liblua5.1-0-dev, libpcre3-dev, libssl-dev (>= 1.0), libcurl4-openssl-dev, libhiredis-dev, dh-systemd Standards-Version: 3.9.5 Homepage: https://rspamd.com Vcs-Git: git://github.com/vstakhov/rspamd.git diff --git a/debian/logging.conf b/debian/logging.conf new file mode 100644 index 000000000..33234fde1 --- /dev/null +++ b/debian/logging.conf @@ -0,0 +1,4 @@ +logging { + type = "console"; + level = "info"; +} diff --git a/debian/rspamd.install b/debian/rspamd.install new file mode 100644 index 000000000..f02b35d19 --- /dev/null +++ b/debian/rspamd.install @@ -0,0 +1,2 @@ +debian/workers.conf etc/rspamd +debian/logging.conf etc/rspamd diff --git a/debian/rules b/debian/rules index be4ab6e11..fbb555cb3 100755 --- a/debian/rules +++ b/debian/rules @@ -1,6 +1,6 @@ #!/usr/bin/make -f %: - dh $@ + dh $@ --with systemd export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed # Until https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=739834 is fixed @@ -29,3 +29,6 @@ override_dh_auto_clean: override_dh_fixperms: dh_fixperms chmod 750 $(CURDIR)/debian/rspamd/var/lib/rspamd + +override_dh_systemd_start: + dh_systemd_start --restart-after-upgrade diff --git a/debian/workers.conf b/debian/workers.conf new file mode 100644 index 000000000..1d59010da --- /dev/null +++ b/debian/workers.conf @@ -0,0 +1,19 @@ +worker { + type = "normal"; + bind_socket = "systemd:0"; + http = false; + allow_learn = true; + mime = true; +} +worker { + type = "controller"; + bind_socket = "systemd:1"; + count = 1; +} +worker { + type = "webui"; + count = 1; + bind_socket = "systemd:2"; + password = "q1"; + secure_ip = "127.0.0.1"; +} diff --git a/rspamd.service b/rspamd.service new file mode 100644 index 000000000..ff9655b93 --- /dev/null +++ b/rspamd.service @@ -0,0 +1,14 @@ +[Unit] +Description=rapid spam filtering system + +[Service] +Type=simple +# Replace Pre/Post with RuntimeDirectory once it is available +PermissionsStartOnly=true +ExecStartPre=/bin/mkdir -m700 -p /run/rspamd +ExecStartPre=/bin/chown _rspamd:_rspamd /run/rspamd +ExecStart=/usr/bin/rspamd -f -c /etc/rspamd/rspamd.conf +ExecReload=/bin/kill -HUP $MAINPID +ExecStopPost=/bin/rm -r /run/rspamd +WorkingDirectory=/var/lib/rspamd +User=_rspamd diff --git a/rspamd.socket b/rspamd.socket new file mode 100644 index 000000000..e326dddcc --- /dev/null +++ b/rspamd.socket @@ -0,0 +1,11 @@ +[Unit] +Description=rapid spam filtering system + +[Socket] +ListenStream=11333 +ListenStream=127.0.0.1:11334 +ListenStream=127.0.0.1:11336 +FreeBind=true + +[Install] +WantedBy=sockets.target |