Documentation and Wants=network-online.target (#395)

Documentation and Wants=network-online.target
This commit is contained in:
brainscar 2018-04-19 22:00:24 -07:00 committed by Frank Denis
parent ba381ef0a7
commit dfdd469a81
1 changed files with 30 additions and 3 deletions

View File

@ -1,26 +1,53 @@
[Unit] [Unit]
Description=DNSCrypt-proxy client Description=DNSCrypt-proxy client
Documentation=https://github.com/jedisct1/dnscrypt-proxy/wiki Documentation=https://github.com/jedisct1/dnscrypt-proxy/wiki
## Use systemd sockets. Disable on TCP_NODELAY fail. Then define ip address in dnscrypt-proxy.toml.
Requires=dnscrypt-proxy.socket Requires=dnscrypt-proxy.socket
## Start service after the network is online.
## Requires a wait service such as NetworkManager or systemd-networkd.
## Verify using:
## systemctl is-enabled NetworkManager-wait-online.service systemd-networkd-wait-online.service
## Then enable:
## systemctl enable NetworkManager-wait-online.service
## Or alternatively:
## systemctl enable systemd-networkd-wait-online.service
After=network-online.target After=network-online.target
Wants=network-online.target
## DNSCrypt-proxy provides and requires name resolution.
Before=nss-lookup.target Before=nss-lookup.target
Wants=nss-lookup.target Wants=nss-lookup.target
[Service] [Service]
## Set O_NONBLOCK flag for socket unit.
NonBlocking=true NonBlocking=true
## Execute dnscrypt-proxy with configuration file.
ExecStart=/usr/bin/dnscrypt-proxy --config /etc/dnscrypt-proxy/dnscrypt-proxy.toml ExecStart=/usr/bin/dnscrypt-proxy --config /etc/dnscrypt-proxy/dnscrypt-proxy.toml
## Make /home, /root and /run/user read only.
ProtectHome=yes ProtectHome=yes
## Make Linux control groups read only.
ProtectControlGroups=yes ProtectControlGroups=yes
## Deny explicit module loading.
ProtectKernelModules=yes ProtectKernelModules=yes
# Run dnscrypt-proxy as unprivileged user with ## Run dnscrypt-proxy as unprivileged user with
# temporary assigned UID/GID. See man:systemd.exec ## temporary assigned UID/GID. See man:systemd.exec
# for more info. Requires systemd 232+. ## for more info. Requires systemd 232+.
DynamicUser=yes DynamicUser=yes
CacheDirectory=dnscrypt-proxy CacheDirectory=dnscrypt-proxy
LogsDirectory=dnscrypt-proxy LogsDirectory=dnscrypt-proxy
RuntimeDirectory=dnscrypt-proxy RuntimeDirectory=dnscrypt-proxy
[Install] [Install]
## Install socket unit.
Also=dnscrypt-proxy.socket Also=dnscrypt-proxy.socket
## Create symlink for systemd to pull in the unit when starting multi-user.target
## Can be found in /etc/systemd/system/multi-user.target.wants/
WantedBy=multi-user.target WantedBy=multi-user.target