From e51921b1242b40eefd16f29bcc408c6ac0df1619 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Thu, 12 May 2016 11:34:36 +0200 Subject: Add hardening options to our systemd unit files. --- .../files/lib/systemd/system/bacula-director.service | 12 +++++++++++- roles/bacula-sd/files/lib/systemd/system/bacula-sd.service | 10 ++++++++++ roles/common/files/lib/systemd/system/bacula-fd.service | 10 ++++++++++ roles/lists/files/lib/systemd/system/wwsympa.service | 9 +++++++++ .../files/lib/systemd/system/munin-cgi-graph.service | 8 ++++++++ .../files/lib/systemd/system/munin-cgi-html.service | 8 ++++++++ 6 files changed, 56 insertions(+), 1 deletion(-) diff --git a/roles/bacula-dir/files/lib/systemd/system/bacula-director.service b/roles/bacula-dir/files/lib/systemd/system/bacula-director.service index 7b34c8b..8f952c6 100644 --- a/roles/bacula-dir/files/lib/systemd/system/bacula-director.service +++ b/roles/bacula-dir/files/lib/systemd/system/bacula-director.service @@ -7,8 +7,18 @@ Type=forking PIDFile=/var/run/bacula/bacula-dir.9101.pid StandardOutput=syslog User=bacula -Group=tape +Group=bacula ExecStart=/usr/sbin/bacula-dir -c /etc/bacula/bacula-dir.conf +# Hardening +NoNewPrivileges=yes +PrivateDevices=yes +ProtectHome=yes +ProtectSystem=full +ReadOnlyDirectories=/ +ReadWriteDirectories=-/var/lib/bacula +ReadWriteDirectories=-/var/log/bacula +ReadWriteDirectories=-/var/run/bacula + [Install] WantedBy=multi-user.target diff --git a/roles/bacula-sd/files/lib/systemd/system/bacula-sd.service b/roles/bacula-sd/files/lib/systemd/system/bacula-sd.service index 4c3f81d..ca147a7 100644 --- a/roles/bacula-sd/files/lib/systemd/system/bacula-sd.service +++ b/roles/bacula-sd/files/lib/systemd/system/bacula-sd.service @@ -10,5 +10,15 @@ User=bacula Group=tape ExecStart=/usr/sbin/bacula-sd -c /etc/bacula/bacula-sd.conf +# Hardening +NoNewPrivileges=yes +PrivateDevices=yes +ProtectHome=yes +ProtectSystem=full +ReadOnlyDirectories=/ +ReadWriteDirectories=-/var/lib/bacula +ReadWriteDirectories=-/var/run/bacula +ReadWriteDirectories=/mnt/backup/bacula + [Install] WantedBy=multi-user.target diff --git a/roles/common/files/lib/systemd/system/bacula-fd.service b/roles/common/files/lib/systemd/system/bacula-fd.service index 6e2bbd4..07bd2e5 100644 --- a/roles/common/files/lib/systemd/system/bacula-fd.service +++ b/roles/common/files/lib/systemd/system/bacula-fd.service @@ -8,5 +8,15 @@ PIDFile=/var/run/bacula/bacula-fd.9112.pid StandardOutput=syslog ExecStart=/usr/sbin/bacula-fd -c /etc/bacula/bacula-fd.conf +# Hardening +NoNewPrivileges=yes +PrivateDevices=yes +ProtectHome=read-only +ProtectSystem=full +PrivateTmp=yes +ReadOnlyDirectories=/ +ReadWriteDirectories=-/var/lib +ReadWriteDirectories=-/var/run/bacula + [Install] WantedBy=multi-user.target diff --git a/roles/lists/files/lib/systemd/system/wwsympa.service b/roles/lists/files/lib/systemd/system/wwsympa.service index ea2a78f..b525145 100644 --- a/roles/lists/files/lib/systemd/system/wwsympa.service +++ b/roles/lists/files/lib/systemd/system/wwsympa.service @@ -10,5 +10,14 @@ User=sympa Group=sympa ExecStart=/usr/lib/cgi-bin/sympa/wwsympa.fcgi +# Hardening +NoNewPrivileges=yes +PrivateDevices=yes +ProtectHome=yes +ProtectSystem=full +ReadOnlyDirectories=/ +ReadWriteDirectories=-/var/lib/sympa +ReadWriteDirectories=-/var/run/sympa + [Install] WantedBy=multi-user.target diff --git a/roles/munin-master/files/lib/systemd/system/munin-cgi-graph.service b/roles/munin-master/files/lib/systemd/system/munin-cgi-graph.service index 9e4d820..99aca7a 100644 --- a/roles/munin-master/files/lib/systemd/system/munin-cgi-graph.service +++ b/roles/munin-master/files/lib/systemd/system/munin-cgi-graph.service @@ -10,5 +10,13 @@ User=www-data Group=munin ExecStart=/usr/lib/munin/cgi/munin-cgi-graph +# Hardening +NoNewPrivileges=yes +PrivateDevices=yes +ProtectHome=yes +ProtectSystem=full +ReadOnlyDirectories=/ +ReadWriteDirectories=-/var/log/munin + [Install] WantedBy=multi-user.target diff --git a/roles/munin-master/files/lib/systemd/system/munin-cgi-html.service b/roles/munin-master/files/lib/systemd/system/munin-cgi-html.service index 11a7470..119d3a2 100644 --- a/roles/munin-master/files/lib/systemd/system/munin-cgi-html.service +++ b/roles/munin-master/files/lib/systemd/system/munin-cgi-html.service @@ -10,5 +10,13 @@ User=www-data Group=munin ExecStart=/usr/lib/munin/cgi/munin-cgi-html +# Hardening +NoNewPrivileges=yes +PrivateDevices=yes +ProtectHome=yes +ProtectSystem=full +ReadOnlyDirectories=/ +ReadWriteDirectories=-/var/log/munin + [Install] WantedBy=multi-user.target -- cgit v1.2.3