Use RuntimeDirectory to create /run/fail2ban

Instead of the duplicated tmpfiles + ExecStartPre. This way the lifetime of
that directory becomes fixed, and also User is automatically respected for
the ownership of the directory (making it easy to run fail2ban as a
non-root user, like it was with at least the Debian init script).
pull/2537/head
Arto Jantunen 2019-10-02 18:21:09 +03:00
parent 3359845242
commit 60b136333e
2 changed files with 1 additions and 2 deletions

View File

@ -1 +0,0 @@
D /run/fail2ban 0755 root root -

View File

@ -7,7 +7,7 @@ PartOf=iptables.service firewalld.service ip6tables.service ipset.service nftabl
[Service]
Type=simple
Environment="PYTHONNOUSERSITE=1"
ExecStartPre=/bin/mkdir -p /run/fail2ban
RuntimeDirectory=fail2ban
ExecStart=@BINDIR@/fail2ban-server -xf start
# if should be logged in systemd journal, use following line or set logtarget to sysout in fail2ban.local
# ExecStart=@BINDIR@/fail2ban-server -xf --logtarget=sysout start