From: Pieter Lexis Date: Thu, 1 Oct 2020 18:36:51 +0000 (+0200) Subject: Ensure socket-dir matches runtimedir on old systemd X-Git-Tag: rec-4.5.0-alpha1~98^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7bbaae110abb53f43d0bf60c81efe3bb8630a925;p=thirdparty%2Fpdns.git Ensure socket-dir matches runtimedir on old systemd This is mostly a hack for systemd version <240 so using virtual hosting on Ubuntu Bionic and EL7 does not lead to surprises. This Commit explicitly adds the `--socket-dir` to the invocation of the unit. Any users who want to use their own runtimedirs should use a drop-in unit overriding ExecStart. I believe this does not validate the principle of least surprise for those using the PowerDNS provided packages and virtual hosting. Fixes #9485 --- diff --git a/m4/systemd.m4 b/m4/systemd.m4 index f0b2a06df4..26edf52134 100644 --- a/m4/systemd.m4 +++ b/m4/systemd.m4 @@ -212,4 +212,5 @@ AC_DEFUN([AX_CHECK_SYSTEMD_FEATURES], [ AM_CONDITIONAL([HAVE_SYSTEMD_RESTRICT_SUIDSGID], [ test x"$systemd_restrict_suidsgid" = "xy" ]) AM_CONDITIONAL([HAVE_SYSTEMD_SYSTEM_CALL_ARCHITECTURES], [ test x"$systemd_system_call_architectures" = "xy" ]) AM_CONDITIONAL([HAVE_SYSTEMD_SYSTEM_CALL_FILTER], [ test x"$systemd_system_call_filter" = "xy" ]) + AM_CONDITIONAL([HAVE_SYSTEMD_WITH_RUNTIME_DIR_ENV], [ test $_systemd_version -ge 240 ]) ]) diff --git a/pdns/Makefile.am b/pdns/Makefile.am index b9cb532560..e9a3381dfe 100644 --- a/pdns/Makefile.am +++ b/pdns/Makefile.am @@ -1607,6 +1607,9 @@ dnsdist: if HAVE_SYSTEMD pdns.service: pdns.service.in $(AM_V_GEN)sed -e 's![@]sbindir[@]!$(sbindir)!' -e 's![@]service_user[@]!$(service_user)!' -e 's![@]service_group[@]!$(service_group)!' < $< > $@ +if !HAVE_SYSTEMD_WITH_RUNTIME_DIR_ENV + $(AM_V_GEN)sed -e 's!/pdns_server!& --socket-dir=%t/pdns!' -i $@ +endif if !HAVE_SYSTEMD_LOCK_PERSONALITY $(AM_V_GEN)perl -ni -e 'print unless /^LockPersonality/' $@ endif @@ -1668,6 +1671,9 @@ pdns@.service: pdns.service -e 's!RuntimeDirectory=.*!&-%i!' \ -e 's!SyslogIdentifier=.*!&-%i!' \ < $< > $@ +if !HAVE_SYSTEMD_WITH_RUNTIME_DIR_ENV + $(AM_V_GEN)sed -e 's!--socket-dir=[^ ]\+!&-%i !' -i $@ +endif systemdsystemunitdir = $(SYSTEMD_DIR) diff --git a/pdns/recursordist/Makefile.am b/pdns/recursordist/Makefile.am index 141fcf5780..f4ba683e55 100644 --- a/pdns/recursordist/Makefile.am +++ b/pdns/recursordist/Makefile.am @@ -517,6 +517,9 @@ endif if HAVE_SYSTEMD pdns-recursor.service: pdns-recursor.service.in $(AM_V_GEN)sed -e 's![@]sbindir[@]!$(sbindir)!' -e 's![@]service_user[@]!$(service_user)!' -e 's![@]service_group[@]!$(service_group)!' < $< > $@ +if !HAVE_SYSTEMD_WITH_RUNTIME_DIR_ENV + $(AM_V_GEN)sed -e 's!/pdns_recursor!& --socket-dir=%t/pdns-recursor!' -i $@ +endif if !HAVE_SYSTEMD_LOCK_PERSONALITY $(AM_V_GEN)perl -ni -e 'print unless /^LockPersonality/' $@ endif @@ -577,6 +580,9 @@ pdns-recursor@.service: pdns-recursor.service -e 's!Recursor!& %i!' \ -e 's!RuntimeDirectory=.*!&-%i!' \ < $< > $@ +if !HAVE_SYSTEMD_WITH_RUNTIME_DIR_ENV + $(AM_V_GEN)sed -e 's!--socket-dir=[^ ]\+!&-%i !' -i $@ +endif systemdsystemunitdir = $(SYSTEMD_DIR)