Compare commits

...

2 Commits

Author SHA1 Message Date
hwdsl2 a42410822f Update docs 2024-05-03 22:25:07 -05:00
hwdsl2 bea8597b02 Add new option
- Add an option for specifying a Libreswan version to install,
  using variable VPN_SWAN_VER. Currently supported values are
  4.15 and 5.0. This could be useful for users who want to
  install the older Libreswan version 4.
2024-05-03 22:18:08 -05:00
7 changed files with 77 additions and 1 deletions

View File

@ -162,6 +162,20 @@ https://gitlab.com/hwdsl2/setup-ipsec-vpn/-/raw/master/vpnsetup.sh
如果无法下载,打开 [vpnsetup.sh](vpnsetup.sh),然后点击右边的 `Raw` 按钮。按快捷键 `Ctrl/Cmd+A` 全选,`Ctrl/Cmd+C` 复制,然后粘贴到你喜欢的编辑器。
</details>
<details>
<summary>
我需要安装较旧版本的 Libreswan 版本 4。
</summary>
一般建议使用最新的 [Libreswan](https://libreswan.org/) 版本 5它是本项目的默认版本。但是如果你想要安装较旧版本的 Libreswan 版本 4
```bash
wget https://get.vpnsetup.net -O vpn.sh
sudo VPN_SWAN_VER=4.15 sh vpn.sh
```
**注:** 如果 Libreswan 版本 5 已经安装,你可能需要首先[卸载 VPN](docs/uninstall-zh.md),然后安装 Libreswan 版本 4。或者你也可以下载[升级脚本](#升级libreswan),编辑它并指定 `SWAN_VER=4.15`,然后运行脚本。
</details>
## 自定义 VPN 选项

View File

@ -162,6 +162,20 @@ https://gitlab.com/hwdsl2/setup-ipsec-vpn/-/raw/master/vpnsetup.sh
If you are unable to download, open [vpnsetup.sh](vpnsetup.sh), then click the `Raw` button on the right. Press `Ctrl/Cmd+A` to select all, `Ctrl/Cmd+C` to copy, then paste into your favorite editor.
</details>
<details>
<summary>
I want to install the older Libreswan version 4.
</summary>
It is generally recommended to use the latest [Libreswan](https://libreswan.org/) version 5, which is the default version in this project. However, if you want to install the older Libreswan version 4:
```bash
wget https://get.vpnsetup.net -O vpn.sh
sudo VPN_SWAN_VER=4.15 sh vpn.sh
```
**Note:** If Libreswan version 5 is already installed, you may need to first [Uninstall the VPN](docs/uninstall.md) before installing Libreswan version 4. Alternatively, download the [update script](#upgrade-libreswan), edit it to specify `SWAN_VER=4.15`, then run the script.
</details>
## Customize VPN options

View File

@ -280,7 +280,7 @@ run_setup() {
VPN_DNS_NAME="$VPN_DNS_NAME" VPN_CLIENT_NAME="$VPN_CLIENT_NAME" \
VPN_PROTECT_CONFIG="$VPN_PROTECT_CONFIG" \
VPN_CLIENT_VALIDITY="$VPN_CLIENT_VALIDITY" \
VPN_SKIP_IKEV2="$VPN_SKIP_IKEV2" \
VPN_SKIP_IKEV2="$VPN_SKIP_IKEV2" VPN_SWAN_VER="$VPN_SWAN_VER" \
/bin/bash "$tmpdir/vpn.sh" || status=1
else
status=1

View File

@ -248,6 +248,18 @@ get_swan_ver() {
if printf '%s' "$swan_ver_latest" | grep -Eq '^([3-9]|[1-9][0-9]{1,2})(\.([0-9]|[1-9][0-9]{1,2})){1,2}$'; then
SWAN_VER="$swan_ver_latest"
fi
if [ -n "$VPN_SWAN_VER" ]; then
if ! printf '%s\n%s' "4.15" "$VPN_SWAN_VER" | sort -C -V \
|| ! printf '%s\n%s' "$VPN_SWAN_VER" "$SWAN_VER" | sort -C -V; then
cat 1>&2 <<EOF
Error: Libreswan version '$VPN_SWAN_VER' is not supported.
This script can install Libreswan 4.15+ or $SWAN_VER.
EOF
exit 1
else
SWAN_VER="$VPN_SWAN_VER"
fi
fi
}
check_libreswan() {

View File

@ -266,6 +266,18 @@ get_swan_ver() {
if printf '%s' "$swan_ver_latest" | grep -Eq '^([3-9]|[1-9][0-9]{1,2})(\.([0-9]|[1-9][0-9]{1,2})){1,2}$'; then
SWAN_VER="$swan_ver_latest"
fi
if [ -n "$VPN_SWAN_VER" ]; then
if ! printf '%s\n%s' "4.15" "$VPN_SWAN_VER" | sort -C -V \
|| ! printf '%s\n%s' "$VPN_SWAN_VER" "$SWAN_VER" | sort -C -V; then
cat 1>&2 <<EOF
Error: Libreswan version '$VPN_SWAN_VER' is not supported.
This script can install Libreswan 4.15+ or $SWAN_VER.
EOF
exit 1
else
SWAN_VER="$VPN_SWAN_VER"
fi
fi
}
check_libreswan() {

View File

@ -368,6 +368,18 @@ get_swan_ver() {
if printf '%s' "$swan_ver_latest" | grep -Eq '^([3-9]|[1-9][0-9]{1,2})(\.([0-9]|[1-9][0-9]{1,2})){1,2}$'; then
SWAN_VER="$swan_ver_latest"
fi
if [ -n "$VPN_SWAN_VER" ]; then
if ! printf '%s\n%s' "4.15" "$VPN_SWAN_VER" | sort -C -V \
|| ! printf '%s\n%s' "$VPN_SWAN_VER" "$SWAN_VER" | sort -C -V; then
cat 1>&2 <<EOF
Error: Libreswan version '$VPN_SWAN_VER' is not supported.
This script can install Libreswan 4.15+ or $SWAN_VER.
EOF
exit 1
else
SWAN_VER="$VPN_SWAN_VER"
fi
fi
}
check_libreswan() {

View File

@ -321,6 +321,18 @@ get_swan_ver() {
if printf '%s' "$swan_ver_latest" | grep -Eq '^([3-9]|[1-9][0-9]{1,2})(\.([0-9]|[1-9][0-9]{1,2})){1,2}$'; then
SWAN_VER="$swan_ver_latest"
fi
if [ -n "$VPN_SWAN_VER" ]; then
if ! printf '%s\n%s' "4.15" "$VPN_SWAN_VER" | sort -C -V \
|| ! printf '%s\n%s' "$VPN_SWAN_VER" "$SWAN_VER" | sort -C -V; then
cat 1>&2 <<EOF
Error: Libreswan version '$VPN_SWAN_VER' is not supported.
This script can install Libreswan 4.15+ or $SWAN_VER.
EOF
exit 1
else
SWAN_VER="$VPN_SWAN_VER"
fi
fi
}
check_libreswan() {