Error out if systemd sockets are used with the user_name option

This commit is contained in:
Frank Denis 2018-07-07 19:44:11 +02:00
parent 1019428ca0
commit 4dc756be4d
1 changed files with 4 additions and 0 deletions

View File

@ -11,6 +11,10 @@ import (
func (proxy *Proxy) SystemDListeners() error {
files := activation.Files(true)
if len(files) > 0 && (len(proxy.userName) > 0 || proxy.child) {
dlog.Fatal("Systemd activated sockets are incompatible with privilege dropping. Remove activated sockets and fill `listen_addresses` in the dnscrypt-proxy configuration file instead.")
}
for i, file := range files {
if listener, err := net.FileListener(file); err == nil {
dlog.Noticef("Wiring systemd TCP socket #%d, %s, %s", i, file.Name(), listener.Addr())