From 765fd0392a8c6b165e5881a623af7dfe904ebf8a Mon Sep 17 00:00:00 2001 From: Newnius Date: Tue, 20 Nov 2018 15:56:21 +0800 Subject: [PATCH] add systemd services, hosts.allow, hosts.deny --- etc/hosts.allow | 2 ++ etc/hosts.deny | 1 + etc/init.d/frps | 20 ++++++++++++++++++++ lib/systemd/system/frpc.service | 20 ++++++++++++++++++++ lib/systemd/system/ss-server.service | 20 ++++++++++++++++++++ 5 files changed, 63 insertions(+) create mode 100644 etc/hosts.allow create mode 100644 etc/hosts.deny create mode 100644 etc/init.d/frps create mode 100644 lib/systemd/system/frpc.service create mode 100644 lib/systemd/system/ss-server.service diff --git a/etc/hosts.allow b/etc/hosts.allow new file mode 100644 index 0000000..6c66d9d --- /dev/null +++ b/etc/hosts.allow @@ -0,0 +1,2 @@ +sshd:192.168.1.0/24:allow +sshd:127.0.0.1:allow diff --git a/etc/hosts.deny b/etc/hosts.deny new file mode 100644 index 0000000..0309579 --- /dev/null +++ b/etc/hosts.deny @@ -0,0 +1 @@ +sshd:ALL diff --git a/etc/init.d/frps b/etc/init.d/frps new file mode 100644 index 0000000..0335730 --- /dev/null +++ b/etc/init.d/frps @@ -0,0 +1,20 @@ +#!/bin/bash +### BEGIN INIT INFO +# Provides: newnius +# Required-Start: $local_fs $network +# Required-Stop: $local_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: remote control +# Description: remote control +### END INIT INFO + +case "$1" in + start) + /usr/local/frp/frpc -c /usr/local/frp/frpc.ini + ;; + stop) + ;; +esac + +exit 0 diff --git a/lib/systemd/system/frpc.service b/lib/systemd/system/frpc.service new file mode 100644 index 0000000..f9b7be9 --- /dev/null +++ b/lib/systemd/system/frpc.service @@ -0,0 +1,20 @@ +[Unit] +Description=Frp Client +After=network.target +ConditionPathExists=/usr/local/frp/frpc + +[Service] +#EnvironmentFile=-/etc/default/ssh +#ExecStartPre=/usr/sbin/sshd -t +ExecStart=/usr/local/frp/frpc -c /usr/local/frp/frpc.ini +#ExecStop=/usr/local/ss/stop.sh +#ExecReload=/usr/sbin/sshd -t +#ExecReload=/bin/kill -HUP $MAINPID +#KillMode=process +Restart=on-failure +#RestartPreventExitStatus=255 +#Type=notify + +[Install] +WantedBy=multi-user.target +Alias=frpc.service diff --git a/lib/systemd/system/ss-server.service b/lib/systemd/system/ss-server.service new file mode 100644 index 0000000..91fa5f4 --- /dev/null +++ b/lib/systemd/system/ss-server.service @@ -0,0 +1,20 @@ +[Unit] +Description=Shadowsocks Server +After=network.target +ConditionPathExists=/usr/local/ss/shadowsocks-server + +[Service] +#EnvironmentFile=-/etc/default/ssh +#ExecStartPre=/usr/sbin/sshd -t +ExecStart=/usr/local/ss/shadowsocks-server -c /usr/local/ss/config.json +ExecStop=/usr/local/ss/stop.sh +#ExecReload=/usr/sbin/sshd -t +#ExecReload=/bin/kill -HUP $MAINPID +#KillMode=process +Restart=on-failure +#RestartPreventExitStatus=255 +#Type=notify + +[Install] +WantedBy=multi-user.target +Alias=ss.service