Skip to content

Commit 61f703c

Browse files
committed
Harden uWSGI/NetBox service; allow it to be reloaded correctly
1 parent c31e436 commit 61f703c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

templates/netbox.service.j2

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,27 @@ After=syslog.target
55

66
[Service]
77
ExecStart=/usr/bin/env uwsgi --ini {{ netbox_shared_path }}/uwsgi.ini
8+
ExecReload=/bin/kill -HUP $MAINPID
9+
ExecStop=/bin/kill -INT $MAINPID
810
User={{ netbox_user }}
911
Group={{ netbox_group }}
1012
Restart=on-failure
13+
SuccessExitStatus=15 17 29 30
1114
KillSignal=SIGQUIT
1215
Type=notify
1316
StandardError=syslog
1417
NotifyAccess=all
18+
PrivateTmp=yes
19+
ProtectSystem=full
20+
ReadWriteDirectories={{ netbox_shared_path }}
21+
{% if netbox_database_socket is defined %}
22+
ReadWriteDirectories={{ netbox_database_socket }}
23+
{% endif %}
24+
DeviceAllow=/dev/null rw
25+
DeviceAllow=/dev/urandom r
26+
DeviceAllow=/dev/zero r
27+
ProtectHome=yes
28+
NoNewPrivileges=yes
1529

1630
[Install]
1731
WantedBy=multi-user.target

0 commit comments

Comments
 (0)