mirror of
https://github.com/XTLS/Xray-install.git
synced 2024-11-21 14:51:27 +00:00
Update service files (#14)
This commit is contained in:
parent
daf009f157
commit
e81eafaead
|
@ -491,6 +491,14 @@ install_xray() {
|
||||||
install_startup_service_file() {
|
install_startup_service_file() {
|
||||||
mkdir -p '/etc/systemd/system/xray.service.d'
|
mkdir -p '/etc/systemd/system/xray.service.d'
|
||||||
mkdir -p '/etc/systemd/system/xray@.service.d/'
|
mkdir -p '/etc/systemd/system/xray@.service.d/'
|
||||||
|
local temp_CapabilityBoundingSet="CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE"
|
||||||
|
local temp_AmbientCapabilities="AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE"
|
||||||
|
local temp_NoNewPrivileges="NoNewPrivileges=true"
|
||||||
|
if [[ "$INSTALL_USER_UID" -eq '0' ]]; then
|
||||||
|
temp_CapabilityBoundingSet="#${temp_CapabilityBoundingSet}"
|
||||||
|
temp_AmbientCapabilities="#${temp_AmbientCapabilities}"
|
||||||
|
temp_NoNewPrivileges="#${temp_NoNewPrivileges}"
|
||||||
|
fi
|
||||||
cat > /etc/systemd/system/xray.service << EOF
|
cat > /etc/systemd/system/xray.service << EOF
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Xray Service
|
Description=Xray Service
|
||||||
|
@ -499,9 +507,9 @@ After=network.target nss-lookup.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
User=$INSTALL_USER
|
User=$INSTALL_USER
|
||||||
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
|
${temp_CapabilityBoundingSet}
|
||||||
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
|
${temp_AmbientCapabilities}
|
||||||
NoNewPrivileges=true
|
${temp_NoNewPrivileges}
|
||||||
ExecStart=/usr/local/bin/xray run -config /usr/local/etc/xray/config.json
|
ExecStart=/usr/local/bin/xray run -config /usr/local/etc/xray/config.json
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartPreventExitStatus=23
|
RestartPreventExitStatus=23
|
||||||
|
@ -519,9 +527,9 @@ After=network.target nss-lookup.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
User=$INSTALL_USER
|
User=$INSTALL_USER
|
||||||
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
|
${temp_CapabilityBoundingSet}
|
||||||
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
|
${temp_AmbientCapabilities}
|
||||||
NoNewPrivileges=true
|
${temp_NoNewPrivileges}
|
||||||
ExecStart=/usr/local/bin/xray run -config /usr/local/etc/xray/%i.json
|
ExecStart=/usr/local/bin/xray run -config /usr/local/etc/xray/%i.json
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartPreventExitStatus=23
|
RestartPreventExitStatus=23
|
||||||
|
|
Loading…
Reference in a new issue