-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add Systemd user unit files - Security improvement to system units - Update the default config.json according to the manual
- Loading branch information
Showing
7 changed files
with
149 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
[Unit] | ||
Description=sing-box service | ||
Documentation=https://sing-box.sagernet.org | ||
After=network.target nss-lookup.target network-online.target | ||
|
||
[Service] | ||
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_SYS_PTRACE CAP_DAC_READ_SEARCH | ||
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_SYS_PTRACE CAP_DAC_READ_SEARCH | ||
ConfigurationDirectory=sing-box | ||
DynamicUser=true | ||
ExecReload=/bin/kill -HUP $MAINPID | ||
ExecStart=/usr/bin/sing-box -D ${STATE_DIRECTORY} -C ${CONFIGURATION_DIRECTORY} run | ||
LimitNOFILE=infinity | ||
LockPersonality=true | ||
MemoryDenyWriteExecute=true | ||
NoNewPrivileges=true | ||
PrivateTmp=true | ||
ProcSubset=pid | ||
ProtectClock=true | ||
ProtectControlGroups=true | ||
ProtectHome=true | ||
ProtectHostname=true | ||
ProtectKernelLogs=true | ||
ProtectKernelModules=true | ||
ProtectKernelTunables=true | ||
ProtectProc=noaccess | ||
ProtectSystem=full | ||
Restart=on-failure | ||
RestartSec=10s | ||
RestrictNamespaces=true | ||
RestrictRealtime=true | ||
StateDirectory=sing-box | ||
SystemCallArchitectures=native | ||
SystemCallFilter=@system-service | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[Unit] | ||
Description=sing-box service (%i) | ||
Documentation=https://sing-box.sagernet.org | ||
After=network.target nss-lookup.target network-online.target | ||
|
||
[Service] | ||
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_SYS_PTRACE CAP_DAC_READ_SEARCH | ||
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_SYS_PTRACE CAP_DAC_READ_SEARCH | ||
ConfigurationDirectory=sing-box | ||
DynamicUser=true | ||
ExecReload=/bin/kill -HUP $MAINPID | ||
ExecStart=/usr/bin/sing-box -D ${STATE_DIRECTORY} -c ${CONFIGURATION_DIRECTORY}/%i.json run | ||
LimitNOFILE=infinity | ||
LockPersonality=true | ||
MemoryDenyWriteExecute=true | ||
NoNewPrivileges=true | ||
PrivateTmp=true | ||
ProcSubset=pid | ||
ProtectClock=true | ||
ProtectControlGroups=true | ||
ProtectHome=true | ||
ProtectHostname=true | ||
ProtectKernelLogs=true | ||
ProtectKernelModules=true | ||
ProtectKernelTunables=true | ||
ProtectProc=noaccess | ||
ProtectSystem=full | ||
Restart=on-failure | ||
RestartSec=10s | ||
RestrictNamespaces=true | ||
RestrictRealtime=true | ||
StateDirectory=sing-box-%i | ||
SystemCallArchitectures=native | ||
SystemCallFilter=@system-service | ||
|
||
[Install] | ||
WantedBy=multi-user.target | ||
DefaultInstance=sing-box.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[Unit] | ||
Description=sing-box user service | ||
Documentation=https://sing-box.sagernet.org | ||
After=basic.target | ||
|
||
[Service] | ||
ConfigurationDirectory=sing-box | ||
ExecReload=/bin/kill -HUP $MAINPID | ||
ExecStart=/usr/bin/sing-box -D ${STATE_DIRECTORY} -C ${CONFIGURATION_DIRECTORY} run | ||
LimitNOFILE=infinity | ||
LockPersonality=true | ||
MemoryDenyWriteExecute=true | ||
NoNewPrivileges=true | ||
PrivateDevices=true | ||
PrivateTmp=true | ||
PrivateUsers=true | ||
ProcSubset=pid | ||
ProtectProc=noaccess | ||
Restart=on-failure | ||
RestartSec=10s | ||
RestrictNamespaces=true | ||
RestrictRealtime=true | ||
StateDirectory=sing-box | ||
SystemCallArchitectures=native | ||
SystemCallFilter=@system-service | ||
|
||
[Install] | ||
WantedBy=default.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[Unit] | ||
Description=sing-box user service (%i) | ||
Documentation=https://sing-box.sagernet.org | ||
After=basic.target | ||
|
||
[Service] | ||
ConfigurationDirectory=sing-box | ||
ExecReload=/bin/kill -HUP $MAINPID | ||
ExecStart=/usr/bin/sing-box -D ${STATE_DIRECTORY} -c ${CONFIGURATION_DIRECTORY}/%i.json run | ||
LimitNOFILE=infinity | ||
LockPersonality=true | ||
MemoryDenyWriteExecute=true | ||
NoNewPrivileges=true | ||
PrivateDevices=true | ||
PrivateTmp=true | ||
PrivateUsers=true | ||
ProcSubset=pid | ||
ProtectProc=noaccess | ||
Restart=on-failure | ||
RestartSec=10s | ||
RestrictNamespaces=true | ||
RestrictRealtime=true | ||
StateDirectory=sing-box-%i | ||
SystemCallArchitectures=native | ||
SystemCallFilter=@system-service | ||
|
||
[Install] | ||
WantedBy=default.target | ||
DefaultInstance=sing-box.service |