Bug 25628 - rspamd: incorrect service and logrotate configurations
Summary: rspamd: incorrect service and logrotate configurations
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 7
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: QA Team
QA Contact:
URL:
Whiteboard: MGA7-64-OK
Keywords: advisory, validated_update
Depends on:
Blocks:
 
Reported: 2019-10-28 13:40 CET by Dieter Schütze
Modified: 2020-09-02 17:42 CEST (History)
4 users (show)

See Also:
Source RPM: rspamd-1.8.3-1.mga7.src.rpm
CVE:
Status comment:


Attachments

Description Dieter Schütze 2019-10-28 13:40:26 CET
Description of problem:
no rotation of logfile and wrong reload of rspamd
reason: pid file doesnt exists.

in rspamd.service
ExecStart=/usr/bin/rspamd -c /etc/rspamd/rspamd.conf -f
ExecReload=/bin/kill -HUP $MAINPID

on reload of rspamd, rspamd produce additional rspamd processes.
With $MAINPID you get only the first pid not the pids of the rest (-f)
If you reload only the first pid you let the other pids stay and produce additional proccesses. There is no forking.

in /etc/logrotate.d/rspamd
you look for a pid file that doesnt exists, because of $MAINPID
postrotate
      [ ! -f /var/run/rspamd/rspamd.pid ] || kill -USR1 `cat /var/run/rspamd/rspamd.pid`

Version-Release number of selected component (if applicable):
rspamd-1.8.3-1.mga7

Steps to Reproduce:
always after install and running rspamd
Comment 1 David GEIGER 2019-10-28 16:17:15 CET
What can we do to fix properly this issue, have you an idea?

CC: (none) => geiger.david68210

Comment 2 David GEIGER 2019-10-28 16:17:49 CET
Assigning to the registered maintainer!

Assignee: bugsquad => shlomif

Comment 3 Dieter Schütze 2019-10-28 22:23:01 CET
at this time i restart rspamd on logrotate but this is not a real solution.

    postrotate
      /usr/bin/systemctl retart rspamd > /dev/null 2>/dev/null || true

I don't know how this works on other distributions with systemd
David Walser 2019-11-01 20:35:06 CET

Summary: no logrotate and reload wrong => rspamd: incorrect service and logrotate configurations

David Walser 2019-11-01 20:35:21 CET

CC: (none) => shlomif
Assignee: shlomif => pkg-bugs

Comment 4 Dieter Schütze 2019-11-02 11:22:55 CET
could anyone examine (recheck) if this is the solution ?

/lib/systemd/system/rspamd.service:

[Unit]
Description=rapid spam filtering system
After=nss-lookup.target network-online.target redis.service
Documentation=https://rspamd.com/doc/

[Service]
LimitNOFILE=1048576
NonBlocking=true
ExecStart=/usr/bin/rspamd -c /etc/rspamd/rspamd.conf -f
ExecReload=/bin/kill -USR1 $MAINPID
User=_rspamd
RuntimeDirectory=rspamd
RuntimeDirectoryMode=0755
Restart=always

[Install]
WantedBy=multi-user.target

/etc/logrotate.d/rspamd:

/var/log/rspamd/*log {
    daily
    rotate 7
    missingok
    notifempty
    compress
    sharedscripts
    postrotate
      systemctl --signal=USR1 --kill-who=main kill rspamd.service 2>/dev/null || :
    endscript
}

It seems it is running on my side but i'm not secure if this is the solution.
Comment 5 David GEIGER 2019-11-03 15:22:10 CET
Please try with rspamd-1.8.3-1.1.mga7 in Core/Updates_testing repo!
Comment 6 Dieter Schütze 2020-02-21 09:19:42 CET
Sorry rspamd-1.8.3-1.1.mga7 is to old.
rspamd 1.8.3 is from 03.Dec 2018 now we have 2020
for me, i have rebuild a package with rspamd 2.3
There are important bugfixes and new features in the Versions 2.1 and newer.
rspamd is so much better and faster than amavis with spamassassin.
Comment 7 David Walser 2020-08-31 01:16:34 CEST
That's not a valid response Dieter.  We update things only within the same stable branches usually and otherwise only if we have to, not just because of new features.  Does this update fix the reported packaging issues or not?

Assignee: pkg-bugs => qa-bugs

Comment 8 Herman Viaene 2020-09-01 11:07:18 CEST
MGA7-64 Plasma on Lenovo B50
No installation issues
No previous updates, so just trying to get the service running.
At CLI:
# systemctl -l status rspamd
● rspamd.service - rapid spam filtering system
   Loaded: loaded (/usr/lib/systemd/system/rspamd.service; enabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: https://rspamd.com/doc/

# systemctl -l start rspamd

# systemctl -l status rspamd
● rspamd.service - rapid spam filtering system
   Loaded: loaded (/usr/lib/systemd/system/rspamd.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-09-01 10:57:18 CEST; 4s ago
     Docs: https://rspamd.com/doc/
 Main PID: 18364 (rspamd)
    Tasks: 5 (limit: 4915)
   Memory: 39.4M
   CGroup: /system.slice/rspamd.service
           ├─18364 rspamd: main process
           ├─18367 rspamd: rspamd_proxy process (localhost:11332)
           ├─18368 rspamd: controller process (localhost:11334)
           ├─18369 rspamd: normal process (localhost:11333)
           └─18370 rspamd: normal process (localhost:11333)

Sep 01 10:57:18 mach5.hviaene.thuis systemd[1]: Started rapid spam filtering system.

# systemctl -l stop rspamd

# systemctl -l status rspamd
● rspamd.service - rapid spam filtering system
   Loaded: loaded (/usr/lib/systemd/system/rspamd.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Tue 2020-09-01 10:57:41 CEST; 2s ago
     Docs: https://rspamd.com/doc/
  Process: 18364 ExecStart=/usr/bin/rspamd -c /etc/rspamd/rspamd.conf -f (code=exited, status=0/SUCCESS)
 Main PID: 18364 (code=exited, status=0/SUCCESS)

Sep 01 10:57:18 mach5.hviaene.thuis systemd[1]: Started rapid spam filtering system.
Sep 01 10:57:40 mach5.hviaene.thuis systemd[1]: Stopping rapid spam filtering system...
Sep 01 10:57:41 mach5.hviaene.thuis systemd[1]: rspamd.service: Succeeded.
Sep 01 10:57:41 mach5.hviaene.thuis systemd[1]: Stopped rapid spam filtering system.

# ps -aux | grep rspamd
root      8241  0.0  0.0   9044   816 pts/1    S+   11:03   0:00 grep --color rspamd
So, it seems to behave.

When running
# systemctl -l start rspamd
# ps -aux | grep rspamd
_rspamd  13273  8.2  0.5  74124 42832 ?        Ss   11:04   0:00 rspamd: main process
_rspamd  13275  0.0  0.4  74124 34020 ?        S    11:04   0:00 rspamd: rspamd_proxy process (localhost:11332)
_rspamd  13276  0.2  0.4  75808 38748 ?        S    11:04   0:00 rspamd: controller process (localhost:11334)
_rspamd  13277  0.0  0.4  74884 36596 ?        S    11:04   0:00 rspamd: normal process (localhost:11333)
_rspamd  13278  0.0  0.4  74884 36612 ?        S    11:04   0:00 rspamd: normal process (localhost:11333)
root     13282  0.0  0.0   9044   808 pts/1    S+   11:04   0:00 grep --color rspamd

Leaving to people with more knowledge to decide whether this is OK.

CC: (none) => herman.viaene

Comment 9 David Walser 2020-09-01 15:17:26 CEST
Looking at the packaging changes, it's probably OK.  Make sure that "systemctl reload rspamd" works correctly.  If it does, then you can OK/validate it.
Comment 10 Herman Viaene 2020-09-02 14:29:18 CEST
# systemctl -l status rspamd           
● rspamd.service - rapid spam filtering system
   Loaded: loaded (/usr/lib/systemd/system/rspamd.service; enabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: https://rspamd.com/doc/

# systemctl -l start rspamd

# systemctl -l status rspamd
● rspamd.service - rapid spam filtering system
   Loaded: loaded (/usr/lib/systemd/system/rspamd.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2020-09-02 14:25:48 CEST; 4s ago
     Docs: https://rspamd.com/doc/
 Main PID: 6415 (rspamd)
    Tasks: 5 (limit: 4915)
   Memory: 37.4M
   CGroup: /system.slice/rspamd.service
           ├─6415 rspamd: main process
           ├─6988 rspamd: rspamd_proxy process (localhost:11332)
           ├─6989 rspamd: controller process (localhost:11334)
           ├─6990 rspamd: normal process (localhost:11333)
           └─6991 rspamd: normal process (localhost:11333)

Sep 02 14:25:48 mach5.hviaene.thuis systemd[1]: Started rapid spam filtering system.

# systemctl reload rspamd

# systemctl -l status rspamd
● rspamd.service - rapid spam filtering system
   Loaded: loaded (/usr/lib/systemd/system/rspamd.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2020-09-02 14:25:48 CEST; 14s ago
     Docs: https://rspamd.com/doc/
  Process: 7001 ExecReload=/bin/kill -USR1 $MAINPID (code=exited, status=0/SUCCESS)
 Main PID: 6415 (rspamd)
    Tasks: 5 (limit: 4915)
   Memory: 37.5M
   CGroup: /system.slice/rspamd.service
           ├─6415 rspamd: main process
           ├─6988 rspamd: rspamd_proxy process (localhost:11332)
           ├─6989 rspamd: controller process (localhost:11334)
           ├─6990 rspamd: normal process (localhost:11333)
           └─6991 rspamd: normal process (localhost:11333)

Sep 02 14:25:48 mach5.hviaene.thuis systemd[1]: Started rapid spam filtering system.
Sep 02 14:25:57 mach5.hviaene.thuis systemd[1]: Reloading rapid spam filtering system.
Sep 02 14:25:57 mach5.hviaene.thuis systemd[1]: Reloaded rapid spam filtering system.

So OK for me.

Whiteboard: (none) => MGA7-64-OK

Comment 11 David Walser 2020-09-02 14:57:59 CEST
Advisory:

The rspamd package has been changed to fix the service definition and
logrotate configuration so that the service is reloaded properly and log
rotation works properly.

SRPM: rspamd-1.8.3-1.1.mga7.src.rpm

Keywords: (none) => validated_update
CC: (none) => sysadmin-bugs

Aurelien Oudelet 2020-09-02 16:46:18 CEST

Keywords: (none) => advisory

Comment 12 Mageia Robot 2020-09-02 17:42:27 CEST
An update for this issue has been pushed to the Mageia Updates repository.

https://advisories.mageia.org/MGAA-2020-0200.html

Status: NEW => RESOLVED
Resolution: (none) => FIXED


Note You need to log in before you can comment on or make changes to this bug.