-
Notifications
You must be signed in to change notification settings - Fork 21.9k
Add strongSwan configuration example for IKEv2 certificate authentication #128091
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -256,6 +256,79 @@ Site-to-site connections to an on-premises network require a VPN device. In this | |||||
|
|
||||||
| [!INCLUDE [Configure a VPN device](../../includes/vpn-gateway-configure-vpn-device-include.md)] | ||||||
|
|
||||||
| ### Example of VPN device configuration: strongSwan in Linux (Ubuntu) | ||||||
|
|
||||||
| You can configure IPsec using `strongSwan` package in Linux (Ubuntu) for IKEv2 certificate authentication by following the steps: | ||||||
|
|
||||||
| 1. Install `strongSwan` package in the on-premises (Ubuntu) server. | ||||||
|
|
||||||
| ```bash | ||||||
| sudo apt-get update | ||||||
| sudo apt-get install strongswan | ||||||
| sudo apt-get install strongswan-pki | ||||||
| sudo apt-get install libcharon-extra-plugins | ||||||
| sudo apt-get install libcharon-extauth-plugins | ||||||
| sudo apt-get install libstrongswan-extra-plugins | ||||||
| sudo apt-get install libtss2-tcti-tabrmd0 | ||||||
| ``` | ||||||
|
|
||||||
| 2. The previously generated root certificate, inbound certificate and private key, and outbound certificate needs to be stored in the following directories in Ubuntu. | ||||||
|
|
||||||
| ```bash | ||||||
| /etc/ipsec.d/cacerts/VPNRootCA01.pem | ||||||
| /etc/ipsec.d/private/VPNRootCA01.key | ||||||
| /etc/ipsec.d/certs/Inbound-certificate.pem | ||||||
| /etc/ipsec.d/private/Inbound-certificate.key | ||||||
| /etc/ipsec.d/certs/Outbound-certificate.pem | ||||||
| ``` | ||||||
|
|
||||||
| > The private key data of the Inbound-certificate can be exported by following these steps [Outbound certificate - export private key data](/site-to-site-certificate-authentication-gateway-portal.md#outbound-certificate---export-private-key-data) | ||||||
|
|
||||||
| 3. Edit the `/etc/ipsec.conf` file with following contents for IPsec donfiguration with IKEv2 certificate authentication. | ||||||
|
|
||||||
| ```bash | ||||||
| config setup | ||||||
| charondebug="all" | ||||||
| uniqueids=yes | ||||||
| conn tunnel | ||||||
| type=tunnel | ||||||
| left=<IP_address_of_on-premises_VPN_device> | ||||||
| leftsubnet=<Local_IP_prefix> | ||||||
| leftcert=/etc/ipsec.d/certs/Inbound-certificate.pem | ||||||
| leftsendcert=always | ||||||
| right=<VPN_peer_IP_address> | ||||||
| rightsubnet=<Remote_IP_prefix> | ||||||
| rightcert=/etc/ipsec.d/certs/Outbound-certificate.pem | ||||||
| rightsendcert=always | ||||||
| keyexchange=ikev2 | ||||||
| keyingtries=%forever | ||||||
| authby=psk | ||||||
|
||||||
| authby=psk | |
| authby=rsasig |
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'keyingtries=%forever' parameter is duplicated on line 304 and line 308. Remove the duplicate entry on line 308.
| keyingtries=%forever |
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'Inboound-certificate' to 'Inbound-certificate'.
| 4. Edit the `/etc/ipsec.secrets` with following contents for configuring the private key of the Inboound-certificate certificate. | |
| 4. Edit the `/etc/ipsec.secrets` with following contents for configuring the private key of the Inbound-certificate certificate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'donfiguration' to 'configuration'.