Add "Disable systemd socket activation" (if someone can review it, please add something, delete, correct etc.)

szemley 2020-08-12 17:04:32 +00:00
parent 1209abf1cf
commit 157bae6031

@ -161,4 +161,47 @@ sudo systemctl enable dnscrypt-proxy.service
--
### Disable systemd socket activation
In order to use DNSCrypt-Proxy without `systemd` socket activation, firstly User should consider various pros and cons. For example, main Developer - Mr Frank Denis suggests to not using `systemd` socket at all. On the other hand, some Users express their own opinions, suggesting that `systemd` socket activaction is a better choice (for more informations, please check **1.** - these are the threads, that concern systemd and socket activation etc.)
Anyway, disabling `systemd` socket activation is relative simple, not to say trivial. In short, this is about stopping/disabling `dnscrypt-proxy.socket` unit, commenting/removing options related with `systemd` sockets found in `dnscrypt-proxy.service` (and eventually `dnscrypt-proxy-resolvconf.service`) file - see above examples. Next, a proper address have to be added to the `listen_addresses` option found in the `dnscrypt-proxy.toml` configuration file. Finally, restart DNSCrypt service and check status.
Here is an example of commands used to achieve above goal. (Please note, that this text was written, based on the experience with the Linux distribution with `systemd` support/enabled. Furthermore, **mousepad** — simple text editor was used, but it completely depends on Users preferences - just use your favorite editor).
```
# Stop and disable socket unit
# -----------------------------
sudo systemctl stop dnscrypt-proxy.socket
sudo systemctl disable dnscrypt-proxy.socket
# Comment/remove all socket-related (e.g. `dnscrypt-proxy.socket`)
# options and reload systemd manager configuration
# -----------------------------------------------------------------
sudo mousepad /lib/systemd/system/dnscrypt-proxy.service
sudo mousepad /lib/systemd/system/dnscrypt-proxy-resolvconf.service
sudo systemctl daemon-reload
# Edit configuration file and add a proper address
# to the `listen_address` option
# -------------------------------------------------
sudo mousepad /etc/dnscrypt-proxy/dnscrypt-proxy.toml
# Restart DNSCrypt service and check if everything is okay
# (there shouldn't be a `WARNING` or `FATAL` messages and
# information about wiring `systemd` sockets should be
# replaced with "Now listening on TCP/UDP" etc.)
# ---------------------------------------------------------
sudo systemctl restart dnscrypt-proxy.service
journalctl -u dnscrypt-proxy.service
systemctl status dnscrypt-proxy.service
```
**Note**: "_dnscrypt-proxy-resolvconf.service explicitly makes use of dnscrypt-proxy.socket_" (vide `systemctl show dnscrypt-proxy.socket` command in **ExecStart=** option etc.) but it seems, that this file is not needed with `systemd` socket activation and can be disabled. However, there is no difference when `dnscrypt-proxy-resolvconf.service` is enalbed and used or not. It's up to you - you decide. A short discussion is here: see **2**.
1. https://github.com/DNSCrypt/dnscrypt-proxy/issues?q=systemd+socket
2. https://github.com/DNSCrypt/dnscrypt-proxy/issues/1394
--
Are you familiar with systemd? Please update this Wiki page with relevant information!