From: James Bunton Date: Tue, 22 Sep 2015 09:57:34 +0000 (+0000) Subject: systemd service configuration and make install target X-Git-Url: https://code.delx.au/proxy/commitdiff_plain/136ebff73a88982e1575526718ea2309f2f25f29 systemd service configuration and make install target --- diff --git a/Makefile b/Makefile index cf1ab52..5732821 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ VERSION := 0.1 +PREFIX := /usr/local CFLAGS += -Wall -Wextra -Werror -std=c99 -DVERSION='"$(VERSION)"' LDFLAGS += -lpthread -lbsd @@ -8,7 +9,13 @@ socks5server: socks5server.c test: socks5server ./test_proxy.py +install: socks5server + install -m 0755 -D -t $(PREFIX)/bin socks5server + install -m 0644 -D -t $(PREFIX)/etc socks5server.conf + install -m 0644 -D -t $(PREFIX)/lib/systemd/system socks5server.service + sed -i 's|PREFIX|$(PREFIX)|g' $(PREFIX)/lib/systemd/system/socks5server.service + clean: rm -f socks5server -.PHONY: clean +.PHONY: clean install test diff --git a/socks5server.conf b/socks5server.conf new file mode 100644 index 0000000..ee976da --- /dev/null +++ b/socks5server.conf @@ -0,0 +1,6 @@ +LISTEN_PORT=1080 + +#ALLOW_ALL=1 + +#ALLOW_HOST_1=example.com +#ALLOW_HOST_2=fe80::1 diff --git a/socks5server.service b/socks5server.service new file mode 100644 index 0000000..9dc2b9d --- /dev/null +++ b/socks5server.service @@ -0,0 +1,22 @@ +[Unit] +Description=SOCKS5 Server +After=network.target +Requires=network.target + +[Service] +EnvironmentFile=PREFIX/etc/socks5server.conf +ExecStart=PREFIX/bin/socks5server +Restart=on-failure +RestartSec=60s +StartLimitInterval=0 + +User=daemon +PrivateTmp=true +PrivateDevices=true +ProtectSystem=true +ProtectHome=true +NoNewPrivileges=true +InaccessibleDirectories=/home + +[Install] +WantedBy=multi-user.target