2

I have configured Pyzor for rspamd following these instructions: https://www.rspamd.com/doc/modules/external_services.html#pyzor-specific-details

The instructions also have some systemd configs for the socket and the service.

Pyzor is now a socket activated service which is started at every connection. The problem is that systemd then creates a new directory for every run:

drw-------     (…) 08:30 [email protected]:5953-127.0.0.1:60656.service
drw-------     (…) 08:30 [email protected]:5953-127.0.0.1:60662.service
drw-------     (…) 08:30 [email protected]:5953-127.0.0.1:60676.service
drw-------     (…) 08:30 [email protected]:5953-127.0.0.1:60684.service
drw-------     (…) 08:30 [email protected]:5953-127.0.0.1:60694.service
drw-------     (…) 08:30 [email protected]:5953-127.0.0.1:60706.service

These directories are never deleted, and after a few days, /run runs out of inodes, preventing the creation of new Pyzor processes or any other process with an isolated namespace.

How can I prevent this situation or reconfigure the unit to delete these directories after a certain period of time?

The socket unit:

# /usr/lib/systemd/system/pyzor.socket

[Unit]
Description=Pyzor socket

[Socket]
ListenStream=127.0.0.1:5953
Accept=yes

[Install]
WantedBy=sockets.target

The service unit:

# /usr/lib/systemd/system/[email protected]

[Unit]
Description=Pyzor Socket Service
Requires=pyzor.socket

[Service]
Type=simple
ExecStart=-/usr/bin/pyzor check
StandardInput=socket
StandardError=journal
TimeoutStopSec=10

User=_rspamd
NoNewPrivileges=true
PrivateDevices=true
PrivateTmp=true
PrivateUsers=true
ProtectControlGroups=true
ProtectHome=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectSystem=strict

[Install]
WantedBy=multi-user.target
Z0OM
  • 1
  • 4
  • 24
  • 56
Kai Bojens
  • 21
  • 3
  • 1
    Did you see https://unix.stackexchange.com/questions/498892/how-do-i-make-systemd-sockets-close-when-service-is-stopped? One answer gives the advice to add a `PartOf=` directive under `[Unit]` to clean up the Unit's associated sockets. – Edward Jul 05 '23 at 13:10
  • Thanks for the hint. Sadly, adding `PartOf=` doesn't change the behaviour. The pyzor-service directories are still created and never deleted for every run. – Kai Bojens Jul 06 '23 at 05:38

0 Answers0