Skip to content

Instantly share code, notes, and snippets.

@chikage8640
Last active April 16, 2024 03:08
Show Gist options
  • Save chikage8640/9231cafd7669d588ce1210cc5f24d7c5 to your computer and use it in GitHub Desktop.
Save chikage8640/9231cafd7669d588ce1210cc5f24d7c5 to your computer and use it in GitHub Desktop.
Softetherをセットアップするやつ(Ubuntu Server 22.04用)
127.0.0.0/8
192.168.0.0/16
172.16.0.0/12
10.0.0.0/8
#!/bin/bash
echo "tag:"
read GIT_TAG
sudo apt update && sudo apt upgrade -y
sudo apt install git build-essential libssl-dev libreadline-dev libncurses5-dev zlib1g-dev
wget -nc https://raw.githubusercontent.com/el1n/OpenWRT-package-softether/master/softethervpn/patches/102-regionunlock.patch
if [ ! -d ./SoftEtherVPN_Stable ]; then
git clone -b $GIT_TAG https://github.com/SoftEtherVPN/SoftEtherVPN_Stable.git
else
git -C ./SoftEtherVPN_Stable/ fetch origin master
git -C ./SoftEtherVPN_Stable/ reset --hard tags/$GIT_TAG
fi
cd SoftEtherVPN_Stable
patch -p1 < ../102-regionunlock.patch
./configure
make
sed -i s#/opt/#/usr/local/bin/#g ./systemd/softether-vpnserver.service
sudo systemctl stop softether-vpnserver.service
sudo cp -rfT ./bin/vpnserver/ /usr/local/bin/vpnserver/
sudo cp -rfT ./bin/vpncmd/ /usr/local/bin/vpncmd/
sudo cp -f ./systemd/softether-vpnserver.service /etc/systemd/system/softether-vpnserver.service
sudo systemctl daemon-reload
sudo systemctl enable softether-vpnserver.service
sudo systemctl start softether-vpnserver.service
#!/bin/bash
# /etc/letsencrypt/renewal-hooks/deploy/に配置して"chmod 700"すること。パスワードべた書きなので。
target_domain="domain.example.com"
for domain in $RENEWED_DOMAINS; do
if [ "$domain" = "$target_domain" ]; then
/usr/local/bin/vpncmd/vpncmd localhost:443 /server /password:hogehoge /CMD ServerCertSet /LOADCERT:$RENEWED_LINEAGE/fullchain.pem /LOADKEY:$RENEWED_LINEAGE/privkey.pem
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment