@@ -28,6 +28,17 @@ if [ "$VPN_PSK" = "password" ] || [ "$VPN_PSK" = "" ]; then
2828 echo " No VPN_PSK set! Generated a random PSK key: $VPN_PSK "
2929fi
3030
31+ if [ " $VPN_PASSWORD " = " $VPN_PSK " ]; then
32+ echo " It is not recommended to use the same secret as password and PSK key!"
33+ fi
34+
35+ cat > /etc/ppp/chap-secrets << EOF
36+ # This file holds secrets for L2TP authentication.
37+ # Username Server Secret Hosts
38+
39+ "$VPN_USER " "*" "$VPN_PASSWORD " "*"
40+ EOF
41+
3142cat > /etc/ipsec.secrets << EOF
3243# This file holds shared secrets or RSA private keys for authentication.
3344# RSA private key for this host, authenticating it to any other host
@@ -41,6 +52,11 @@ $VPN_USER : EAP "$VPN_PASSWORD"
4152$VPN_USER : XAUTH "$VPN_PASSWORD "
4253EOF
4354
55+ if [ -f " /etc/ipsec.d/l2tp-secrets" ]; then
56+ echo " Overwriting standard /etc/ppp/l2tp-secrets with /etc/ipsec.d/l2tp-secrets"
57+ cp -f /etc/ipsec.d/l2tp-secrets /etc/ppp/l2tp-secrets
58+ fi
59+
4460if [ -f " /etc/ipsec.d/ipsec.secrets" ]; then
4561 echo " Overwriting standard /etc/ipsec.secrets with /etc/ipsec.d/ipsec.secrets"
4662 cp -f /etc/ipsec.d/ipsec.secrets /etc/ipsec.secrets
@@ -56,4 +72,13 @@ if [ -f "/conf/strongswan.conf" ]; then
5672 cp -f /conf/strongswan.conf /etc/strongswan.conf
5773fi
5874
59- ipsec start --nofork
75+ if [ -f " /etc/ipsec.d/xl2tpd.conf" ]; then
76+ echo " Overwriting standard /etc/xl2tpd/xl2tpd.conf with /etc/ipsec.d/xl2tpd.conf"
77+ cp -f /etc/ipsec.d/xl2tpd.conf /etc/xl2tpd/xl2tpd.conf
78+ fi
79+
80+ echo " Starting XL2TPD process..."
81+ mkdir -p /var/run/xl2tpd
82+ /usr/sbin/xl2tpd -c /etc/xl2tpd/xl2tpd.conf
83+
84+ ipsec start --nofork\
0 commit comments