From a1b1699d28a17c9f8b31a8289be2cbfa83c88ac4 Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Thu, 15 Jan 2015 14:35:12 +0200 Subject: [PATCH] Update RPM packaging --- centos/rspamd.spec | 106 +++-- centos/sources/logging.conf | 4 + centos/sources/rspamd.init.suse | 111 ----- centos/sources/rspamd.service | 9 +- centos/sources/rspamd.xml | 753 -------------------------------- centos/sources/tmpfiles.d | 1 + centos/sources/workers.conf | 13 + 7 files changed, 84 insertions(+), 913 deletions(-) create mode 100644 centos/sources/logging.conf delete mode 100644 centos/sources/rspamd.init.suse delete mode 100644 centos/sources/rspamd.xml create mode 100644 centos/sources/tmpfiles.d create mode 100644 centos/sources/workers.conf diff --git a/centos/rspamd.spec b/centos/rspamd.spec index b82624abe..408491151 100644 --- a/centos/rspamd.spec +++ b/centos/rspamd.spec @@ -6,6 +6,8 @@ %define rspamd_pluginsdir %{_datadir}/rspamd %define rspamd_wwwdir %{_datadir}/rspamd/www +%{!?_tmpfilesdir:%global _tmpfilesdir /usr/lib/tmpfiles.d} + %if 0%{?suse_version} %define __cmake cmake %define __install install @@ -29,22 +31,30 @@ License: BSD2c URL: https://rspamd.com BuildRoot: %{_tmppath}/%{name}-%{version}-%{release} %if 0%{?suse_version} -BuildRequires: cmake,glib2-devel,gmime-devel,libevent-devel,openssl-devel,lua-devel,pcre-devel,sqlite3-devel,perl +BuildRequires: cmake,glib2-devel,gmime-devel,libevent-devel,openssl-devel,lua-devel,pcre-devel,sqlite3-devel +%endif +%if 0%{?el6} +BuildRequires: cmake,glib2-devel,gmime-devel,libevent-devel,openssl-devel,lua-devel,pcre-devel,sqlite-devel %else -BuildRequires: cmake,glib2-devel,gmime-devel,libevent-devel,openssl-devel,lua-devel,pcre-devel,sqlite-devel,perl +BuildRequires: cmake,glib2-devel,gmime-devel,libevent-devel,openssl-devel,lua-devel,pcre-devel,sqlite-devel,systemd %endif +%if 0%{?el6} Requires: lua, logrotate +%else +Requires: lua +%endif # for /user/sbin/useradd %if 0%{?suse_version} Requires(pre): shadow -%if 0%{?suse_version} >= 1300 +%else +Requires(pre): shadow-utils +%endif +%if 0%{?suse_version} || 0%{?fedora} || 0%{?el7} Requires(pre): systemd Requires(post): systemd Requires(preun): systemd Requires(postun): systemd -%endif %else -Requires(pre): shadow-utils Requires(post): chkconfig # for /sbin/service Requires(preun): chkconfig, initscripts @@ -52,16 +62,15 @@ Requires(postun): initscripts %endif Source0: https://rspamd.com/downloads/%{name}-%{version}.tar.xz -%if 0%{?suse_version} -%if 0%{?suse_version} >= 1300 +%if 0%{?suse_version} || 0%{?fedora} || 0%{?el7} Source1: %{name}.service %else -Source1: %{name}.init.suse -%endif -%else Source1: %{name}.init %endif Source2: %{name}.logrotate +Source3: workers.conf +Source4: logging.conf +Source5: tmpfiles.d %description Rspamd is a rapid, modular and lightweight spam filter. It is designed to work @@ -77,10 +86,9 @@ lua. -DCONFDIR=%{_sysconfdir}/rspamd \ -DMANDIR=%{_mandir} \ -DDBDIR=%{_localstatedir}/lib/rspamd \ -%if 0%{?suse_version} - -DRUNDIR=%{_localstatedir}/lib/rspamd \ -%else -DRUNDIR=%{_localstatedir}/run/rspamd \ +%if %{undefined suse_version} && %{undefined fedora} && 0%{?rhel} < 7 + -DWANT_SYSTEMD_UNITS=OFF \ %endif -DLOGDIR=%{_localstatedir}/log/rspamd \ -DEXAMPLESDIR=%{_datadir}/examples/rspamd \ @@ -97,20 +105,21 @@ lua. %install %{__make} install DESTDIR=%{buildroot} INSTALLDIRS=vendor -%if 0%{?suse_version} -%if 0%{?suse_version} >= 1300 -%{__install} -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/rspamd.service -%else -%{__install} -p -D -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/%{name} -mkdir -p %{buildroot}%{_sbindir} -ln -sf %{_initrddir}/rspamd %{buildroot}%{_sbindir}/rcrspamd -%endif +%if 0%{?suse_version} || 0%{?fedora} || 0%{?rhel} >= 7 +%{__install} -p -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service +%{__install} -p -D -m 0644 %{SOURCE3} %{buildroot}%{rspamd_confdir}/workers.conf +%{__install} -p -D -m 0644 %{SOURCE4} %{buildroot}%{rspamd_confdir}/logging.conf +%{__install} -d -m 0755 %{buildroot}%{_tmpfilesdir} +%{__install} -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}.conf %else %{__install} -p -D -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/%{name} +%{__install} -d -p -m 0755 %{buildroot}%{_localstatedir}/run/rspamd %endif +%if 0%{?el6} %{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name} %{__install} -d -p -m 0755 %{buildroot}%{rspamd_logdir} +%endif %{__install} -d -p -m 0755 %{buildroot}%{rspamd_home} %clean @@ -120,29 +129,36 @@ rm -rf %{buildroot} %{_sbindir}/groupadd -r %{rspamd_group} 2>/dev/null || : %{_sbindir}/useradd -g %{rspamd_group} -c "Rspamd user" -s /bin/false -r -d %{rspamd_home} %{rspamd_user} 2>/dev/null || : -%if 0%{?suse_version} >= 1300 +%if 0%{?suse_version} %service_add_pre %{name}.service +%service_add_pre %{name}.socket %endif %post %if 0%{?suse_version} -%if 0%{?suse_version} >= 1300 %service_add_post %{name}.service -%else -%fillup_and_insserv rspamd +%service_add_post %{name}.socket %endif -%else +%if 0%{?fedora} || 0%{?rhel} >= 7 +%systemd_post %{name}.service +%systemd_post %{name}.socket +%endif +%if %{undefined suse_version} && %{undefined fedora} && 0%{?rhel} < 7 /sbin/chkconfig --add %{name} +%else +systemd-tmpfiles --create %{_tmpfilesdir}/%{name}.conf %endif %preun %if 0%{?suse_version} -%if 0%{?suse_version} >= 1300 %service_del_preun %{name}.service -%else -%stop_on_removal rspamd +%service_del_preun %{name}.socket %endif -%else +%if 0%{?fedora} || 0%{?rhel} >= 7 +%systemd_preun %{name}.service +%systemd_preun %{name}.socket +%endif +%if %{undefined suse_version} && %{undefined fedora} && 0%{?rhel} < 7 if [ $1 = 0 ]; then /sbin/service %{name} stop >/dev/null 2>&1 /sbin/chkconfig --del %{name} @@ -151,13 +167,14 @@ fi %postun %if 0%{?suse_version} -%if 0%{?suse_version} >= 1300 %service_del_postun %{name}.service -%else -%restart_on_update rspamd -%insserv_cleanup +%service_del_postun %{name}.socket %endif -%else +%if 0%{?fedora} || 0%{?rhel} >= 7 +%systemd_postun %{name}.service +%systemd_postun %{name}.socket +%endif +%if %{undefined suse_version} && %{undefined fedora} && 0%{?rhel} < 7 if [ $1 -ge 1 ]; then /sbin/service %{name} condrestart > /dev/null 2>&1 || : fi @@ -166,15 +183,14 @@ fi %files %defattr(-,root,root,-) -%if 0%{?suse_version} -%if 0%{?suse_version} >= 1300 +%if 0%{?suse_version} || 0%{?fedora} || 0%{?rhel} >= 7 %{_unitdir}/%{name}.service +%{_unitdir}/%{name}.socket +%dir %{_tmpfilesdir} +%{_tmpfilesdir}/%{name}.conf %else %{_initrddir}/%{name} -%{_sbindir}/rcrspamd -%endif -%else -%{_initrddir}/%{name} +%dir %{_localstatedir}/run/rspamd %endif %{_mandir}/man8/%{name}.* %{_mandir}/man1/rspamc.* @@ -188,9 +204,13 @@ fi %config(noreplace) %{rspamd_confdir}/options.conf %config(noreplace) %{rspamd_confdir}/statistic.conf %config(noreplace) %{rspamd_confdir}/workers.conf +%if 0%{?el6} %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} +%endif +%if 0%{?el6} %dir %{rspamd_logdir} -%dir %{rspamd_home} +%endif +%attr(-, rspamd, rspamd) %dir %{rspamd_home} %dir %{rspamd_confdir}/lua/regexp %dir %{rspamd_confdir}/lua %dir %{rspamd_confdir} @@ -229,7 +249,7 @@ fi * Mon Nov 17 2014 Vsevolod Stakhov 0.7.5-1 - Update to 0.7.5 -* Mon Nov 08 2014 Vsevolod Stakhov 0.7.4-1 +* Sat Nov 08 2014 Vsevolod Stakhov 0.7.4-1 - Update to 0.7.4 * Mon Nov 03 2014 Vsevolod Stakhov 0.7.3-1 diff --git a/centos/sources/logging.conf b/centos/sources/logging.conf new file mode 100644 index 000000000..33234fde1 --- /dev/null +++ b/centos/sources/logging.conf @@ -0,0 +1,4 @@ +logging { + type = "console"; + level = "info"; +} diff --git a/centos/sources/rspamd.init.suse b/centos/sources/rspamd.init.suse deleted file mode 100644 index e34cef914..000000000 --- a/centos/sources/rspamd.init.suse +++ /dev/null @@ -1,111 +0,0 @@ -#!/bin/sh -# -# rspamd - this script starts and stops the rspamd daemon -### BEGIN INIT INFO -# Provides: rspamd -# Required-Start: $remote_fs $network -# Required-Stop: $network $remote_fs -# Default-Start: 5 -# Default-Stop: -# Short-Description: Rspamd daemon -# Description: Rspamd spam filtering daemon process -### END INIT INFO -# -# chkconfig: - 85 15 -# description: rspamd is a spam filtering system -# processname: rspamd -# config: /etc/rspamd/rspamd.conf -# config: /etc/sysconfig/rspamd -# pidfile: /var/lib/rspamd/rspamd.pid - -. /etc/rc.status - -rc_reset - -rspamd="/usr/bin/rspamd" -prog=$(basename $rspamd) - -RSPAMD_CONF_FILE="/etc/rspamd/rspamd.conf" -RSPAMD_USER="rspamd" -RSPAMD_GROUP="rspamd" - -[ -f /etc/sysconfig/rspamd ] && . /etc/sysconfig/rspamd - -start() { - [ -x $rspamd ] || exit 5 - [ -f $rspamd_CONF_FILE ] || exit 6 - echo -n $"Starting $prog: " - /sbin/startproc $rspamd -c $RSPAMD_CONF_FILE -u $RSPAMD_USER -g $RSPAMD_GROUP - rh_status -} - -stop() { - echo -n $"Stopping $prog: " - /sbin/killproc -TERM $prog - rc_status -v -} - -restart() { - configtest || return $? - stop - start -} - -reload() { - configtest || return $? - echo -n $"Reloading $prog: " - /sbin/killproc -HUP $prog - rc_status -v -} - -force_reload() { - restart -} - -configtest() { - $rspamd -t -c $RSPAMD_CONF_FILE -} - -rh_status() { - /sbin/checkproc $prog - retval=$? - rc_status -v - return $retval -} - -rh_status_q() { - /sbin/checkproc $prog - retval=$? - rc_status - return $retval -} - -case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart|configtest) - $1 - ;; - reload) - rh_status_q || exit 7 - $1 - ;; - force-reload) - force_reload - ;; - status) - rh_status - ;; - condrestart|try-restart) - rh_status_q || exit 0 - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" - exit 2 -esac diff --git a/centos/sources/rspamd.service b/centos/sources/rspamd.service index eec4cd9ea..64daa7967 100644 --- a/centos/sources/rspamd.service +++ b/centos/sources/rspamd.service @@ -1,14 +1,11 @@ [Unit] -Description=rspamd +Description=rapid spam filtering system After=syslog.target network.target remote-fs.target nss-lookup.target [Service] Type=simple -PIDFile=/var/lib/rspamd/rspamd.pid +PIDFile=/var/run/rspamd/rspamd.pid ExecStartPre=/usr/bin/rspamd -u rspamd -g rspamd -t -ExecStart=/usr/bin/rspamd -u rspamd -g rspamd -f -ExecReload=/bin/kill -s HUP $MAINPID +ExecStart=/usr/bin/rspamd -f -c /etc/rspamd/rspamd.conf -u rspamd -g rspamd ExecStop=/bin/kill -s QUIT $MAINPID - -[Install] WantedBy=multi-user.target diff --git a/centos/sources/rspamd.xml b/centos/sources/rspamd.xml deleted file mode 100644 index c710a30f5..000000000 --- a/centos/sources/rspamd.xml +++ /dev/null @@ -1,753 +0,0 @@ - - - - - - - - - /tmp - - /var/run/rspamd.pid - - regexp,surbl,chartable,fuzzy_check,spf,dkim - - 1G - - no - - no - - yes - - 1s - - 5 - - /var/lib/rspamd/symbols.cache - - 10.0s - - /var/lib/rspamd/rspamd_dynamic - - no - - - - - - info - no - file - - - - - - - - - default - - 15.0 - - reject - greylist:4 - add_header:8 - - - - - MISSING_SUBJECT - - FORGED_OUTLOOK_TAGS - - FORGED_SENDER - - SUSPICIOUS_RECIPS - - FAKE_REPLY_C - - MIME_HTML_ONLY - - FORGED_MSGID_YAHOO - - FORGED_MUA_THEBAT_BOUN - - R_MISSING_CHARSET - - RCVD_DOUBLE_IP_SPAM - - FORGED_OUTLOOK_HTML - - R_UNDISC_RCPT - - R_WHITE_ON_WHITE - - HTML_SHORT_LINK_IMG_2 - - FORGED_MUA_OUTLOOK - - FORGED_MUA_OUTLOOK_MAILLIST - - - SUSPICIOUS_BOUNDARY - - SUSPICIOUS_BOUNDARY2 - - SUSPICIOUS_BOUNDARY3 - - SUSPICIOUS_BOUNDARY4 - - - FORGED_MUA_THEBAT_MSGID - - FORGED_MUA_THEBAT_MSGID_UNKNOWN - - - FORGED_MUA_KMAIL_MSGID - - FORGED_MUA_KMAIL_MSGID_UNKNOWN - - - FORGED_MUA_OPERA_MSGID - - SUSPICIOUS_OPERA_10W_MSGID - - - FORGED_MUA_MOZILLA_MAIL_MSGID - - FORGED_MUA_MOZILLA_MAIL_MSGID_UNKNOWN - - FORGED_MUA_THUNDERBIRD_MSGID - - FORGED_MUA_THUNDERBIRD_MSGID_UNKNOWN - - FORGED_MUA_SEAMONKEY_MSGID - - FORGED_MUA_SEAMONKEY_MSGID_UNKNOWN - - - FM_FAKE_HELO_VERIZON - - REPTO_QUOTE_YAHOO - - MISSING_MIMEOLE - - MISSING_TO - - - FROM_EXCESS_BASE64 - - FROM_EXCESS_QP - - TO_EXCESS_BASE64 - - TO_EXCESS_QP - - REPLYTO_EXCESS_BASE64 - - REPLYTO_EXCESS_QP - - CC_EXCESS_BASE64 - - CC_EXCESS_QP - - - R_MIXED_CHARSET - - SORTED_RECIPS - - R_RCVD_SPAMBOTS - - R_TO_SEEMS_AUTO - - SUBJECT_NEEDS_ENCODING - - TRACKER_ID - - R_NO_SPACE_IN_FROM - - R_SAJDING - - R_BAD_CTE_7BIT - - R_FLASH_REDIR_IMGSHACK - - INVALID_MSGID - - MISSING_MID - - FORGED_RECIPIENTS - - FORGED_RECIPIENTS_MAILLIST - - RATWARE_MS_HASH - - STOX_REPLY_TYPE - - R_IP_PBL - - ONCE_RECEIVED - - ONCE_RECEIVED_STRICT - - RECEIVED_RBL - - R_PARTS_DIFFER - - MIME_HEADER_CTYPE_ONLY - - R_EMPTY_IMAGE - - - DRUGS_MANYKINDS - - DRUGS_ANXIETY - DRUGS_MUSCLE - DRUGS_ANXIETY_EREC - DRUGS_DIET - DRUGS_ERECTILE - - - ADVANCE_FEE_2 - ADVANCE_FEE_3 - - - R_LOTTO - - - BAYES_SPAM - BAYES_HAM - - - R_FUZZY - R_FUZZY_DENIED - R_FUZZY_PROB - R_FUZZY_WHITE - - - R_DKIM_REJECT - R_DKIM_TEMPFAIL - R_DKIM_ALLOW - - - R_SPF_FAIL - R_SPF_SOFTFAIL - R_SPF_ALLOW - - - MAILLIST - - - - PH_SURBL_MULTI - - OB_SURBL_MULTI - - AB_SURBL_MULTI - - SC_SURBL_MULTI - - JP_SURBL_MULTI - - WS_SURBL_MULTI - - - RAMBLER_URIBL - - - DBL - - - RAMBLER_EMAILBL - - - PHISHING - - - HEADER_FROM_DELIMITER_TAB - HEADER_TO_DELIMITER_TAB - HEADER_CC_DELIMITER_TAB - HEADER_REPLYTO_DELIMITER_TAB - HEADER_DATE_DELIMITER_TAB - - - HEADER_FROM_EMPTY_DELIMITER - HEADER_TO_EMPTY_DELIMITER - HEADER_CC_EMPTY_DELIMITER - HEADER_REPLYTO_EMPTY_DELIMITER - HEADER_DATE_EMPTY_DELIMITER - - - RCVD_ILLEGAL_CHARS - FAKE_RECEIVED_mail_ru - FAKE_RECEIVED_smtp_yandex_ru - FORGED_GENERIC_RECEIVED - FORGED_GENERIC_RECEIVED2 - FORGED_GENERIC_RECEIVED3 - FORGED_GENERIC_RECEIVED4 - FORGED_GENERIC_RECEIVED5 - INVALID_POSTFIX_RECEIVED - INVALID_EXIM_RECEIVED - INVALID_EXIM_RECEIVED2 - - - DATE_IN_FUTURE - DATE_IN_PAST - - - - -FORGED_RECIPIENTS & -MAILLIST -FORGED_MUA_OUTLOOK & -MAILLIST - - - - - - controller - localhost:11334 - 1 - 2048 - - q1 - - - normal - *:11333 - 2048 - - - - - webui - 1 - localhost:11336 - - q1 - - - - - - - - highsecure.ru:11335 - R_FUZZY - 300 - 10 - application/pdf - 1:R_FUZZY_DENIED:10,2:R_FUZZY_PROB:5,3:R_FUZZY_WHITE:-2.1 - - - - - - FORGED_SENDER - FORGED_RECIPIENTS - - - - - MAILLIST - - - - - file:///etc/rspamd/surbl-whitelist.inc - file:///etc/rspamd/2tld.inc - JP - AB - OB - PH - WS - SC - uribl.rambler.ru - - dbl.spamhaus.org - - noip - - - - - - - RECEIVED_RBL - pbl.spamhaus.org - xbl.spamhaus.org - insecure-bl.rambler.ru - - - - - - - - - 0.3 - R_MIXED_CHARSET - - - - - mail - static - dynamic - ONCE_RECEIVED_STRICT - ONCE_RECEIVED - - - - - - type = dnsbl, map = pbl.spamhaus.org, symbol = R_IP_PBL, description = PBL dns block list - - - - - PHISHING - - - - - - - - - - symbol = RAMBLER_EMAILBL, dnsbl = email-bl.rambler.ru, domain_only = false - - - - - - 2048 - 1d - - - - - - 2048 - 1d - - - - - - - - 1m - - - no - - - no - - - - - - - - - - - to:100:0.033333333 - - to_ip:30:0.025 - - to_ip_from:20:0.01666666667 - - - bounce_to:10:0.000555556 - - bounce_to_ip:5:0.000277778 - - - - - - postmaster,mailer-daemon - - - 5 - - - - - - 1M - - - - - - - - - - - - - - osb-text - default - 10 - 1000 - - BAYES_HAM - 20M - /var/lib/rspamd/bayes.ham - - - BAYES_SPAM - 20M - /var/lib/rspamd/bayes.spam - - - - - - - - - - - /etc/rspamd/plugins/lua/ - - - - diff --git a/centos/sources/tmpfiles.d b/centos/sources/tmpfiles.d new file mode 100644 index 000000000..42bc936f9 --- /dev/null +++ b/centos/sources/tmpfiles.d @@ -0,0 +1 @@ +d /var/run/rspamd 0770 rspamd rspamd diff --git a/centos/sources/workers.conf b/centos/sources/workers.conf new file mode 100644 index 000000000..aa3c43829 --- /dev/null +++ b/centos/sources/workers.conf @@ -0,0 +1,13 @@ +worker { + type = "normal"; + bind_socket = "systemd:0"; + mime = true; +} +worker { + type = "controller"; + bind_socket = "systemd:1"; + count = 1; + password = "q1"; + secure_ip = "127.0.0.1"; + static_dir = "${WWWDIR}"; +} \ No newline at end of file -- 2.39.5