Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevin01523/47d8b3165e39bf528eff9644af79e82c to your computer and use it in GitHub Desktop.
Save kevin01523/47d8b3165e39bf528eff9644af79e82c to your computer and use it in GitHub Desktop.
# Обновление системы и пакетов
apt-get update
apt-get upgrade -y
cd ~/
# Установка пакетов для сборки softether
apt-get install build-essential libreadline-dev libssl-dev libncurses-dev zlib1g-dev git
# Скачивание репозитория Stable версии
git clone https://github.com/SoftEtherVPN/SoftEtherVPN_Stable.git
# Компилирование исполняемых файлов
cd SoftEtherVPN_Stable
./configure
cd tmp
make
cd ~/SoftEtherVPN_Stable
# Копирование файлов
cp -r bin/vpnserver /usr/local/
cp bin/vpncmd/vpncmd /usr/local/vpnserver/
# Выставление прав доступа на файлы
chmod 755 -R /usr/local/vpnserver/
# Add systemd service
cat <<EOF >/lib/systemd/system/vpnserver.service
[Unit]
Description=SoftEther VPN Server
After=network.target auditd.service
ConditionPathExists=!/opt/vpnserver/do_not_run
[Service]
Type=forking
EnvironmentFile=-/opt/vpnserver
ExecStart=/opt/vpnserver/vpnserver start
ExecStop=/opt/vpnserver/vpnserver stop
KillMode=process
Restart=on-failure
# Hardening
PrivateTmp=yes
ProtectHome=yes
ProtectSystem=full
ReadOnlyDirectories=/
ReadWriteDirectories=-/opt/vpnserver
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYS_ADMIN CAP_SETUID
[Install]
WantedBy=multi-user.target
EOF
# Act as router
echo net.ipv4.ip_forward = 1 | sudo tee -a /etc/sysctl.conf
sysctl -p
# Установка сервера как службы
#cp systemd/softether-vpnserver.service /etc/systemd/system/
systemctl daemon-reload
enable vpnserver.service
systemctl start vpnserver.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment