Package: n2n
Version: 1.3.1~svn3789-7
Severity: normal

Dear Maintainer,

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

I've attached my own attempt at writing a service file, based off
looking at what the init script does. Note that it is completely
untested (as I don't use n2n myself).
You should be able to use it just by dropping the n2n.service file
in the debian/ directory and then bump debhelper compat to >= 10
which will get the service file automatically handled (also compat 9 in
now deprecated).

Please note that the service could be a Type=simple if you drop the
-f flag in ExecStart. (Even better would be if the service implemented
support for sd_notify READY=1 so you could use Type=notify.)
Given the comment in the long description of the init script I however
imagine you really want to create a template service instance instead
(and just mask n2n.service -> /dev/null) using n2n@.service.

Additional improvements eg. using security hardening[2] could also be
added.

While at it please also get rid of the home-brew enable/disable[3]
and instead ship the service disabled by default and let the user
do 'service n2n enable' once they've configured it.

Regards,
Andreas Henriksson

PS. the init script uses $DAEMON_ARGS but the default file contains
an (empty) example variable N2N_DAEMON_OPTS (which is ignored).


[1]: 
https://lintian.debian.org/tags/missing-systemd-service-for-init.d-script.html
[2]: 
https://lintian.debian.org/tags/systemd-service-file-missing-hardening-features.html
[3]: 
https://lintian.debian.org/tags/init.d-script-should-always-start-service.html
[Unit]
Description=n2n P2P VPN
After=network.target

[Service]
Type=forking
#PIDFile=/run/$NAME-edge.pid
#Environment=DAEMON_ARGS=
EnvironmentFile=-/etc/default/n2n
# Note: 
https://lintian.debian.org/tags/init.d-script-should-always-start-service.html
# ExecStartPre=/bin/bash -c '[ ! -z "$N2N_EDGE_CONFIG_DONE" ] || echo "Warning: 
n2n VPN client is not configured, edit config file in /etc/default/$NAME."; 
exit 1'
ExecStart=/usr/sbin/edge -f -a $N2N_IP -c $N2N_COMMUNITY -l $N2N_SUPERNODE 
$DAEMON_ARGS
User=nobody
Group=nobody


[Install]
WantedBy=multi-user.target

Reply via email to