Skip to content

Commit 8d4f4c9

Browse files
authored
feat: allow disabling systemd hardening (#74)
1 parent 52fc252 commit 8d4f4c9

7 files changed

+13
-0
lines changed

defaults/main.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
libretime_allow_restart: true
33
libretime_migrate: true
4+
libretime_systemd_hardening: true
45

56
# libretime_config_template:
67
libretime_public_url: "http://localhost:{{ libretime_listen_port }}/"

molecule/default/molecule.yml

+2
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ provisioner:
3333
libretime_playout_systemd_override: |
3434
[Service]
3535
Environment=LIBRETIME_LOG_LEVEL=debug
36+
libretime_systemd_hardening: false
3637
instance2:
3738
libretime_public_url: http://localhost:{{ libretime_listen_port }}/
3839
libretime_listen_port: 9002
3940
libretime_api_key: hackme
4041
libretime_secret_key: hackme
42+
libretime_systemd_hardening: false
4143

4244
verifier:
4345
name: testinfra

templates/systemd/libretime-analyzer.service.j2

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Description=LibreTime Media Analyzer Service
33
PartOf=libretime.target
44

55
[Service]
6+
{%- if libretime_systemd_hardening %}
67
NoNewPrivileges=true
78
CapabilityBoundingSet=
89
PrivateDevices=true
@@ -16,6 +17,7 @@ ProtectKernelModules=true
1617
ProtectKernelTunables=true
1718
ProtectProc=invisible
1819
ProtectSystem=full
20+
{%- endif %}
1921

2022
Environment=PATH={{ libretime_venv_dir }}/bin:/usr/local/bin:/usr/bin:/bin
2123
Environment=LIBRETIME_CONFIG_FILEPATH={{ libretime_config_filepath }}

templates/systemd/libretime-api.service.j2

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Requires=libretime-api.socket
44
PartOf=libretime.target
55

66
[Service]
7+
{%- if libretime_systemd_hardening %}
78
NoNewPrivileges=true
89
CapabilityBoundingSet=
910
PrivateDevices=true
@@ -17,6 +18,7 @@ ProtectKernelModules=true
1718
ProtectKernelTunables=true
1819
ProtectProc=invisible
1920
ProtectSystem=full
21+
{%- endif %}
2022

2123
Environment=PATH={{ libretime_venv_dir }}/bin:/usr/local/bin:/usr/bin:/bin
2224
Environment=LIBRETIME_CONFIG_FILEPATH={{ libretime_config_filepath }}

templates/systemd/libretime-liquidsoap.service.j2

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Description=LibreTime Liquidsoap Service
33
PartOf=libretime.target
44

55
[Service]
6+
{%- if libretime_systemd_hardening %}
67
NoNewPrivileges=true
78
CapabilityBoundingSet=
89
PrivateDevices=true
@@ -16,6 +17,7 @@ ProtectKernelModules=true
1617
ProtectKernelTunables=true
1718
ProtectProc=invisible
1819
ProtectSystem=full
20+
{%- endif %}
1921

2022
Environment=PATH={{ libretime_venv_dir }}/bin:/usr/local/bin:/usr/bin:/bin
2123
Environment=LIBRETIME_CONFIG_FILEPATH={{ libretime_config_filepath }}

templates/systemd/libretime-playout.service.j2

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Wants=libretime-liquidsoap.service
55
After=libretime-liquidsoap.service
66

77
[Service]
8+
{%- if libretime_systemd_hardening %}
89
NoNewPrivileges=true
910
CapabilityBoundingSet=
1011
PrivateDevices=true
@@ -18,6 +19,7 @@ ProtectKernelModules=true
1819
ProtectKernelTunables=true
1920
ProtectProc=invisible
2021
ProtectSystem=full
22+
{%- endif %}
2123

2224
Environment=PATH={{ libretime_venv_dir }}/bin:/usr/local/bin:/usr/bin:/bin
2325
Environment=LIBRETIME_CONFIG_FILEPATH={{ libretime_config_filepath }}

templates/systemd/libretime-worker.service.j2

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Description=LibreTime Worker Service
33
PartOf=libretime.target
44

55
[Service]
6+
{%- if libretime_systemd_hardening %}
67
NoNewPrivileges=true
78
CapabilityBoundingSet=
89
PrivateDevices=true
@@ -16,6 +17,7 @@ ProtectKernelModules=true
1617
ProtectKernelTunables=true
1718
ProtectProc=invisible
1819
ProtectSystem=full
20+
{%- endif %}
1921

2022
Environment=PATH={{ libretime_venv_dir }}/bin:/usr/local/bin:/usr/bin:/bin
2123
Environment=LIBRETIME_CONFIG_FILEPATH={{ libretime_config_filepath }}

0 commit comments

Comments
 (0)