Skip to content

Instantly share code, notes, and snippets.

@wmil
Last active May 2, 2023 09:25
Show Gist options
  • Select an option

  • Save wmil/73041bacb2aee0a1c832a63538d2486a to your computer and use it in GitHub Desktop.

Select an option

Save wmil/73041bacb2aee0a1c832a63538d2486a to your computer and use it in GitHub Desktop.
Ivacy IKEv2 on Debian

Ivacy IKEv2 on Debian

Install strongSwan

sudo apt-get -y update
sudo apt-get -y install strongswan strongswan-libcharon libcharon-extra-plugins

Download Trusted CA

This download URL is found on Comodo.

sudo curl -o /etc/ipsec.d/cacerts/AddTrustExternalCARoot.pem 'https://support.comodo.com/index.php?/Knowledgebase/Article/GetAttachment/853/29'

Configure strongSwan

Please replace my.username@ivacy.com and MyPasswordOnIvacy with your username and password to Ivacy, usla1 with the VPN server you'd like to connect to.

/etc/ipsec.secrets:

my.username@ivacy.com : EAP "MyPasswordOnIvacy"

/etc/ipsec.conf:

conn ivacy-usla1
        keyexchange=ikev2
        dpdaction=clear
        dpddelay=300s
        eap_identity="my.username@ivacy.com"
        leftauth=eap-mschapv2
        left=%defaultroute
        leftsourceip=%config
        right=usla1.dns2use.com
        rightauth=pubkey
        rightsubnet=0.0.0.0/0
        rightid=%*.dns2use.com
        rightca=/etc/ipsec.d/cacerts/AddTrustExternalCARoot.pem
        type=tunnel
        auto=add
        ike=aes256-sha1-modp1024,aes128-sha1-modp1024,3des-sha1-modp1024!
        esp=aes256-sha256,aes256-sha1,3des-sha1!

/etc/strongswan.d/charon/constraints.conf:

constraints {
    load = no
}

Points:

  • my.username@ivacy.com : EAP "MyPasswordOnIvacy": pay attention to the spaces.
  • rightauth=pubkey: use public-key to authenticate the server.
  • rightid=%*.dns2use.com: the server's certificate must have *.dns2use.com in SubjectAltName. strongSwan does not support wildcard.
  • rightca=...AddTrustExternalCARoot.pem: the server's certificate must be signed by AddTrustExternalCARoot.pem.
  • ike=... and esp=...: the IKE algorithms supported by the server, and we are mimicking an Apple device.

Operate strongSwan

sudo ipsec restart
sudo ipsec on ivacy-usla1
sudo ipsec down ivacy-usla1
ip rule list
ip route list table 220
@EITSxiaozhai
Copy link

Can you share your latest configuration files? The new version has a different way of writing. I'm having problems with the certificate not being validated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment