Created
August 23, 2023 18:09
-
-
Save faridprogrammer/738b557dc2a5fdd90908358cbf41fe23 to your computer and use it in GitHub Desktop.
strongSwan configs [ikev1]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/etc/ipsec.conf | |
conn "CONNECTION_NAME" | |
keyexchange = ikev1 | |
ike = aes256-sha256-modp1536! | |
esp = aes256-sha256-modp1536! | |
aggressive = yes | |
right = "SERVER_IP" | |
rightsubnet = 0.0.0.0/0 | |
rightauth = psk | |
left = %defaultroute | |
leftsourceip=%config | |
leftauth = psk | |
leftauth2 = xauth | |
xauth_identity = "YOUR_USERNAME" | |
auto = add | |
leftupdown = /usr/lib/ipsec/_"CONNECTION_NAME"_updown.sh | |
/usr/lib/ipsec/_"CONNECTION_NAME"_updown.sh | |
#! /bin/sh | |
case "$PLUTO_VERB:$1" in | |
up-client:) | |
sudo resolvectl dns $(ip addr show | awk '/inet.*brd/{print $NF; exit}') "DNS" | |
;; | |
down-client:) | |
sudo resolvectl dns $(ip addr show | awk '/inet.*brd/{print $NF; exit}') 1.1.1.1 | |
;; | |
esac | |
chmod +x /usr/lib/ipsec/_"CONNECTION_NAME"_updown.sh | |
/etc/ipsec.secrets | |
"SERVER_IP" %any : PSK "IPSEC_PRESHARED_KEY" | |
"SERVER_IP" %any : XAUTH "YOUR_PASSWORD" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment