]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth: Install systemd unit files when building with meson
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 22 Dec 2025 12:59:56 +0000 (13:59 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 22 Dec 2025 12:59:56 +0000 (13:59 +0100)
Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
meson.build
pdns/ixfrdist.service.meson.in [moved from auth/systemd/ixfrdist.service.in with 100% similarity]
pdns/pdns.service.meson.in [moved from auth/systemd/pdns.service.in with 75% similarity]

index a571fb2ca1fe0711e9a3f9b56afe654559c7d3d5..74f308bf56455dd05488fbff6ed764408e865b0a 100644 (file)
@@ -160,6 +160,9 @@ deps = [
 ]
 
 if dep_systemd_prog.found()
+  systemd_system_unit_dir = dep_systemd_prog.get_variable(
+    'systemdsystemunitdir',
+  )
   systemd_service_conf = configuration_data()
   systemd_service_conf.set('BinDir', get_option('prefix') / get_option('bindir'))
   systemd_service_conf.set('StaticBinDir', get_option('prefix') / get_option('sbindir'))
@@ -231,13 +234,15 @@ if dep_systemd_prog.found()
   auth_service_conf_general.set('Description', 'PowerDNS Authoritative Server')
   auth_service_conf_general.set('ConfigName', '')
   auth_service_conf_general.set('SocketDir', enable_socket_dir ? '--socket-dir=%t/pdns' : '')
-  auth_service_conf_general.set('SyslogIdentifier', 'pdns')
+  auth_service_conf_general.set('SyslogIdentifier', 'pdns_server')
   auth_service_conf_general.set('RuntimeDirectory', 'pdns')
 
   configure_file(
-    input: 'auth' / 'systemd' / 'pdns.service.in',
+    input: 'pdns' / 'pdns.service.meson.in',
     output: 'pdns.service',
     configuration: auth_service_conf_general,
+    install: true,
+    install_dir: systemd_system_unit_dir,
   )
 
   auth_service_conf_instance = configuration_data()
@@ -249,9 +254,11 @@ if dep_systemd_prog.found()
   auth_service_conf_instance.set('RuntimeDirectory', have_systemd_percent_t ? 'pdns-%i' : 'pdns')
 
   configure_file(
-    input: 'auth' / 'systemd' / 'pdns.service.in',
+    input: 'pdns' / 'pdns.service.meson.in',
     output: 'pdns@.service',
     configuration: auth_service_conf_instance,
+    install: true,
+    install_dir: systemd_system_unit_dir,
   )
 
   if get_option('tools-ixfrdist')
@@ -272,9 +279,11 @@ if dep_systemd_prog.found()
     ixfrdist_service_conf_general.set('Config', '')
 
     configure_file(
-      input: 'auth' / 'systemd' / 'ixfrdist.service.in',
+      input: 'pdns' / 'ixfrdist.service.meson.in',
       output: 'ixfrdist.service',
       configuration: ixfrdist_service_conf_general,
+      install: true,
+      install_dir: systemd_system_unit_dir,
     )
 
     ixfrdist_service_conf_instance = configuration_data()
@@ -283,9 +292,11 @@ if dep_systemd_prog.found()
     ixfrdist_service_conf_instance.set('Config', '--config=' + get_option('sysconfdir') + '/ixfrdist-%i.yml')
 
     configure_file(
-      input: 'auth' / 'systemd' / 'ixfrdist.service.in',
+      input: 'pdns' / 'ixfrdist.service.meson.in',
       output: 'ixfrdist@.service',
       configuration: ixfrdist_service_conf_instance,
+      install: true,
+      install_dir: systemd_system_unit_dir,
     )
   endif
 endif
similarity index 100%
rename from auth/systemd/ixfrdist.service.in
rename to pdns/ixfrdist.service.meson.in
index 556be4275d699fbf2ae21d6325fc766f9f218fb8..aa88dd17f23b0927bf049246d82104256e524d61 100644 (file)
@@ -15,9 +15,8 @@ StartLimitInterval=0
 
 # Sandboxing
 CapabilityBoundingSet=CAP_NET_BIND_SERVICE CAP_SETGID CAP_SETUID
-NoNewPrivileges=true
-DevicePolicy=closed
 @LockPersonality@
+NoNewPrivileges=true
 @PrivateDevices@
 @PrivateTmp@
 @PrivateUsers@
@@ -38,6 +37,7 @@ DevicePolicy=closed
 @ProtectProc@
 @PrivateIPC@
 @RemoveIPC@
+DevicePolicy=closed
 @MemoryDenyWriteExecute@
 
 [Install]
similarity index 75%
rename from auth/systemd/pdns.service.in
rename to pdns/pdns.service.meson.in
index eaad6556c4ab9dbe0cafbf28dd48be82aa80c98b..6ad0981ddf42019543f77c3dec0ad21260b30b2b 100644 (file)
@@ -1,7 +1,6 @@
 [Unit]
 Description=@Description@
-Documentation=man:pdns_server(1)
-Documentation=man:pdns_control(1)
+Documentation=man:pdns_server(1) man:pdns_control(1)
 Documentation=https://doc.powerdns.com
 Wants=network-online.target
 After=network-online.target mysql.service mysqld.service postgresql.service slapd.service mariadb.service time-sync.target
@@ -20,12 +19,11 @@ RuntimeDirectory=@RuntimeDirectory@
 # Sandboxing
 CapabilityBoundingSet=CAP_NET_BIND_SERVICE CAP_CHOWN
 AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_CHOWN
-NoNewPrivileges=true
-DevicePolicy=closed
 @LockPersonality@
+NoNewPrivileges=true
 @PrivateDevices@
 @PrivateTmp@
-@PrivateUsers@
+# Setting PrivateUsers=true prevents us from opening our sockets
 @ProtectClock@
 @ProtectControlGroups@
 @ProtectHome@
@@ -33,6 +31,8 @@ DevicePolicy=closed
 @ProtectKernelLogs@
 @ProtectKernelModules@
 @ProtectKernelTunables@
+# ProtectSystem=full will disallow write access to /etc and /usr, possibly
+# not being able to write slaved-zones into sqlite3 or zonefiles.
 @ProtectSystem@
 @RestrictAddressFamilies@
 @RestrictNamespaces@
@@ -43,7 +43,9 @@ DevicePolicy=closed
 @ProtectProc@
 @PrivateIPC@
 @RemoveIPC@
-@MemoryDenyWriteExecute@
+DevicePolicy=closed
+# Not enabled by default because it does not play well with LuaJIT
+# MemoryDenyWriteExecute=true
 
 [Install]
 WantedBy=multi-user.target