Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 528034 - mail-filter/postfwd - add systemd service files
Summary: mail-filter/postfwd - add systemd service files
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Christian Roessner
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: install-systemd-unit
  Show dependency tree
 
Reported: 2014-11-02 18:52 UTC by Stefan G. Weichinger
Modified: 2015-10-03 12:26 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan G. Weichinger 2014-11-02 18:52:48 UTC
Gentoo doesn't provide systemd unit files for postfwd.

Suggested file postfwd.service:

[Unit]
Description=Postfix firewall daemon

[Service]
Type=forking
ExecStart=/usr/sbin/postfwd2 --shortlog --summary=600 --cache=600 --cache-rbl-timeout=3600 --cleanup-requests=1200 --cleanup-rbls=1800 --cleanup-rates=1200 --daemon --file=/etc/postfix/postfwd.cf --interface=127.0.0.1 --port=10040 --pidfile=/var/run/postfwd.pid --user=postfwd --group=postfwd
ExecStop=/usr/sbin/postfwd2 --file=/etc/postfix/postfwd.cf --pidfile=/var/run/postfwd.pid --kill
ExecReload=/usr/sbin/postfwd2 --file=/etc/postfix/postfwd.cf --pidfile=/var/run/postfwd.pid --reload

[Install]
WantedBy=multi-user.target


Reproducible: Always
Comment 1 Stefan G. Weichinger 2015-02-23 21:51:07 UTC
months are gone. What about this bug?
Comment 2 Christian Roessner 2015-03-30 09:45:20 UTC
First of all sorry, for the really long delay. It's hard to believe, but I really did not have the time earlier.

Concerning the bug, I have added the systemd support and the ebuild currently needs a review.
Comment 3 Stefan G. Weichinger 2015-09-23 19:13:11 UTC
BUMP - another ~6 months gone now.
Comment 4 Pacho Ramos gentoo-dev 2015-09-24 18:52:16 UTC
(In reply to Stefan G. Weichinger from comment #3)
> BUMP - another ~6 months gone now.

Well... are you willing to become a developer? :/ I understand your frustration... but this is all a collaborative project and we lack manpower... please don't get me wrong... but if you are willing to help, maybe you could try to jump the gap:
https://www.gentoo.org/get-involved/become-developer/

I can help you with the quizzes and the training of course :), if you are willing to do that, please send an email 

Thanks
Comment 5 Pacho Ramos gentoo-dev 2015-09-24 18:54:39 UTC
This looks similar to:
https://projects.archlinux.org/svntogit/community.git/tree/trunk/service?h=packages/postfwd

and, then, I guess all that values in the executable options are ok.

The only question is the same as on the other bug report: do we need to run it in daemonized mode or can it be run in foreground? 

Thanks :)
Comment 6 Stefan G. Weichinger 2015-09-24 19:52:12 UTC
(In reply to Pacho Ramos from comment #4)
> (In reply to Stefan G. Weichinger from comment #3)
> > BUMP - another ~6 months gone now.
> 
> Well... are you willing to become a developer? :/ I understand your
> frustration... but this is all a collaborative project and we lack
> manpower... please don't get me wrong... but if you are willing to help,
> maybe you could try to jump the gap:
> https://www.gentoo.org/get-involved/become-developer/
> 
> I can help you with the quizzes and the training of course :), if you are
> willing to do that, please send an email 


Don't get me wrong, I am not frustrated but I simply looked at the bugs I reported back then and want to help to close them.

I send you a pm.
Comment 7 Stefan G. Weichinger 2015-09-24 20:06:03 UTC
With Type=Simple I wasn't successful, postfwd spawns children ...

What works for me right now:


# cat /etc/systemd/system/postfwd.service

[Unit]
Description=Postfix firewall daemon

[Service]
Type=forking
User=postfwd
Group=postfwd

ExecStart=/usr/sbin/postfwd2 --shortlog --summary=600 --cache=600 --cache-rbl-timeout=3600 --cleanup-requests=1200 --cleanup-rbls=1800 --cleanup-rates=1200 --file=/etc/postfix/postfwd.cf --interface=127.0.0.1 --port=10040 -g postfwd -u postfwd

ExecStop=/usr/sbin/postfwd2 --file=/etc/postfix/postfwd.cf --kill
ExecReload=/usr/sbin/postfwd2 --file=/etc/postfix/postfwd.cf --reload

[Install]
WantedBy=multi-user.target


--> no environmentfile, no "--daemon", no PIDfile

user/group ... I am unsure if it is correct or redundant to have it both as option in the ExecStart= and as User=,Group=

will test changes now, just a first status
Comment 8 Stefan G. Weichinger 2015-09-24 20:22:52 UTC
User=, Group= removed, works as well:

# cat postfwd.service 

[Unit]
Description=Postfix firewall daemon

[Service]
Type=forking
ExecStart=/usr/sbin/postfwd2 --shortlog --summary=600 --cache=600 --cache-rbl-timeout=3600 --cleanup-requests=1200 --cleanup-rbls=1800 --cleanup-rates=1200 --file=/etc/postfix/postfwd.cf --interface=127.0.0.1 --port=10040 -g postfwd -u postfwd
ExecStop=/usr/sbin/postfwd2 --file=/etc/postfix/postfwd.cf --kill
ExecReload=/usr/sbin/postfwd2 --file=/etc/postfix/postfwd.cf --reload

[Install]
WantedBy=multi-user.target
Comment 9 Stefan G. Weichinger 2015-09-24 20:45:41 UTC
And while I am at it, another suggestion that starts/stops/restarts fine here:

# cat postfwd.service

[Unit]
Description=Postfix firewall daemon

[Service]
Type=forking
ExecStart=/usr/sbin/postfwd2 $POSTFWD_OPTS
ExecStop=/usr/sbin/postfwd2 $POSTFWD_OPTS --kill
ExecReload=/usr/sbin/postfwd2 $POSTFWD_OPTS --reload

[Install]
WantedBy=multi-user.target

# cat /etc/systemd/system/postfwd.service.d/00gentoo.conf 
[Service]
Environment="POSTFWD_OPTS= --shortlog --summary=600 --cache=600 --cache-rbl-timeout=3600 --cleanup-requests=1200 --cleanup-rbls=1800 --cleanup-rates=1200 --file=/etc/postfix/postfwd.cf --interface=127.0.0.1 --port=10040 -g postfwd -u postfwd"

-> all options in that one file, the service file reads the variable from there.

So that file somehow works as config-file for the service.

paths are now /etc ... for the final ebuild this will be /usr/lib/systemd/...
you know.
Comment 10 Pacho Ramos gentoo-dev 2015-09-25 16:22:20 UTC
Umm, it looks strange to me that Type=forking without appending "--daemon" will work as desired for all (I mean, stopping/restarting the service properly without leaving remaining processes, logging of errors that could be viewed with systemctl status...)... Rethinking on this I would stick with the unit file from Arch Linux:
https://projects.archlinux.org/svntogit/community.git/plain/trunk/service?h=packages/postfwd

Does it work ok for you?

Thanks
Comment 11 Stefan G. Weichinger 2015-09-25 16:33:09 UTC
The arch-unit you point is basically what I suggested in the beginning, right?
I maybe even copied it from them.
Comment 12 Pacho Ramos gentoo-dev 2015-09-26 13:19:28 UTC
Yes, I wanted to confirm it worked for you before committing ;)
Comment 13 Stefan G. Weichinger 2015-09-26 14:27:38 UTC
Works for me on 2 servers for nearly a year (since I filed this bug).
The version from comment 9 also works so far (applied it to one of my mailservers).
Comment 14 Pacho Ramos gentoo-dev 2015-10-03 12:26:00 UTC
[master a11083a] mail-filter/postfwd: Install systemd unit file (#528034 by Stefan G. Weichinger)
 2 files changed, 99 insertions(+)
 create mode 100644 mail-filter/postfwd/files/postfwd.service
 create mode 100644 mail-filter/postfwd/postfwd-1.35-r3.ebuild