Package: minidlna
Version: 1.2.1+dfsg-1
Severity: normal

Dear Maintainer,

Please consider adding a native systemd service masking the shipped init
script (fixes lintian tag[1] in subject).

The init script looks pretty straight forward so I made an attempt
at writing a service for it. I'm attaching the completely untested
result!
Please note that the equivalent of the init script would have been to
use `Type=forking` (together with PIDFile=....), but apparently minidlna
has a special mode of operation called SYSTEMD_MASK specified via the -S
flag so I guess that is preferred and I thus specified that flag in the
service unit and set `Type=simple` instead. (If I read the code
correctly this also means no log file will be written. I assume it will
output to stdout and let the journal handle the logging, but didn't read
that far...)

Please feel free to get in contact about any questions that may remain.
I'm happy to help if you test and review (as I don't personally use
minidlna myself).

While looking at this I also noticed that minidlna init script is using
the "ENABLED" anti-pattern[2]. Please consider getting rid of it.

The service file could also use some additional security hardening[3],
which has been left as a TODO for future improvement.

Regards,
Andreas Henriksson


[1]: 
https://lintian.debian.org/tags/missing-systemd-service-for-init.d-script.html
[2]: 
https://lintian.debian.org/tags/init.d-script-should-always-start-service.html
[3]: 
https://lintian.debian.org/tags/systemd-service-file-missing-hardening-features.html
[Unit]
Documentation=man:minidlnad(1) man:minidlna.conf(5)
After=network.target

[Service]
Type=simple
Environment=CONFIGFILE=/etc/minidlna.conf
EnvironmentFile=-/etc/default/minidlna
ExecStart=/usr/sbin/minidlna -S -f $CONFIGFILE $DAEMON_OPTS
User=minidlna
Group=minidlna
#TODO: security hardening flags

[Install]
WantedBy=multi-user.target

Reply via email to