IPsec Site-to-Site VPN Example with Certificate Authentication (2024)

Using certificate-based authentication for identification of VPN tunnel peers ismuch stronger than using a simple Pre-Shared Key but it is more difficult toconfigure and manage.

Certificate authentication requires a PKI structure. Depending on the setup,each side may utilize its own certificate authority (CA) or they may share acommon CA. This example utilizes a different CA on each node to more closelyresemble connecting to third parties.

See also

CA and certificate entries can be created and imported in the GUI by theCertificate Manager.

Required Information

Endpoint A:

Item

Value

Hostname

office.vpn.example.com

WAN IP Address

198.51.100.16

Endpoint B:

Item

Value

Hostname

home.vpn.example.com

WAN IP Address

198.51.100.17

Create CA

First, create a Certificate Authority (CA) on each side:

On Endpoint A:

  • Navigate to System > Certificates, CAs tab

  • Click IPsec Site-to-Site VPN Example with Certificate Authentication (1) Add

  • Set the options as follows:

    Descriptive Name:

    Office VPN CA

    Method:

    Create an internal Certificate Authority

    Randomize Serial:

    Checked

    Common Name:

    office-vpn-ca

  • Leave the rest of the fields at their default values or adjust to suit localpreferences

  • Click Save

  • Click IPsec Site-to-Site VPN Example with Certificate Authentication (2) to export this CA as a file in the browser

On Endpoint B:

  • Navigate to System > Certificates, CAs tab

  • Click IPsec Site-to-Site VPN Example with Certificate Authentication (3) Add

  • Set the options as follows:

    Descriptive Name:

    Home VPN CA

    Method:

    Create an internal Certificate Authority

    Randomize Serial:

    Checked

    Common Name:

    home-vpn-ca

  • Leave the rest of the fields at their default values or adjust to suit localpreferences

  • Click Save

  • Click IPsec Site-to-Site VPN Example with Certificate Authentication (4) to export this CA as a file in the browser

Import Peer CAs

Next, import the new CA entries into the peer. For example, import the Home CAto the Office side, and vice versa.

Note

This step only requires the certificate data, not the key. The keybelonging to the CA should not be copied off the firewall where it wascreated.

On Endpoint A:

On Endpoint B:

  • Navigate to System > Certificates, CAs tab

  • Click IPsec Site-to-Site VPN Example with Certificate Authentication (6) Add

  • Set the options as follows:

    Descriptive Name:

    Office VPN CA

    Method:

    Import an existing Certificate Authority

    Certificate Data:

    Paste the contents of the exported Office VPN CA.crt file.

  • Click Save

Create Endpoint Certificates

On Endpoint A:

  • Navigate to System > Certificates, Certificates tab

  • Click IPsec Site-to-Site VPN Example with Certificate Authentication (7) Add

  • Set the options as follows:

    Method:

    Create an internal Certificate

    Descriptive Name:

    Office VPN Certificate

    Certificate Authority:

    Office VPN CA

    Common Name:

    office-vpn-cert

    Certificate Type:

    User Certificate

    Alternative Names:
    Type:

    FQDN or Hostname

    Value:

    office.vpn.example.com

  • Click IPsec Site-to-Site VPN Example with Certificate Authentication (8) Add

  • Set the new row options to:

    Alternative Names:
    Type:

    IP Address

    Value:

    198.51.100.16

    Note

    If the IP address is dynamic, skip this step or use the LAN IP address.

  • Leave the rest of the fields at their default values or adjust to suit localpreferences

  • Click Save

On Endpoint B:

  • Navigate to System > Certificates, Certificates tab

  • Click IPsec Site-to-Site VPN Example with Certificate Authentication (9) Add

  • Set the options as follows:

    Method:

    Create an internal Certificate

    Descriptive Name:

    Home VPN Certificate

    Certificate Authority:

    Home VPN CA

    Common Name:

    home-vpn-cert

    Certificate Type:

    User Certificate

    Alternative Names:
    Type:

    FQDN or Hostname

    Value:

    home.vpn.example.com

  • Click IPsec Site-to-Site VPN Example with Certificate Authentication (10) Add

  • Set the new row options to:

    Alternative Names:
    Type:

    IP Address

    Value:

    198.51.100.17

    Note

    If the IP address is dynamic, skip this step or use the LAN IP address.

  • Leave the rest of the fields at their default values or adjust to suit localpreferences

  • Click Save

Setup IPsec VPN

On both firewalls, configure the IPsec tunnel as described inIPsec Site-to-Site VPN Example with Pre-Shared Keys, with the following exceptions:

Endpoint A:

Authentication method:

Mutual Certificate

My Identifier:

Set appropriately to match the certificate for this endpoint

Peer Identifier:

Set appropriately to match the certificate of the peer

My Certificate:

Office VPN Certificate

Peer Certificate Authority:

Home VPN CA

Endpoint B:

Authentication method:

Mutual Certificate

My Identifier:

Set appropriately to match the certificate for this endpoint

Peer Identifier:

Set appropriately to match the certificate of the peer

My Certificate:

Home VPN Certificate

Peer Certificate Authority:

Office VPN CA

Matching Certificate and Identifiers

In order for the IPsec daemon to properly match a certificate and its keys to apeer, the local and peer identifier must match data in the certificateexactly.

Warning

Do not place quotes (single or double) around the identifier values.

There are several ways to accomplish this matching. The key factors are:

  • The IPsec daemon must be able to confirm that an endpoint matches theexpected identifier, which matches a peer to a specific tunnel.

  • The IPsec daemon must be able to match that identifier to a certificate andvalidate its trust, which confirms the identity and authenticates the tunnelpeer.

The following identifier types are the best practices to use with certificateauthentication:

Fully Qualified Domain Name:

This choice can work with fully qualified domain names or short hostnames. Ifthe certificates were created as specified in Create Endpoint Certificates,use the full hostname such as office.vpn.example.com orhome.vpn.example.com. This is the easiest choice and most likely tosucceed, assuming the SAN value is present in the certificate.

Modern certificates typically include the certificate CN as a SAN entry, sothe CN may also be used if it resembles a hostname (e.g. office-vpn-cert).Check the certificate properties to ensure it is present as an FQDN SAN entry.

Warning

This mode will not work if the CN contains spaces or other characters notcompatible with hostnames.

ASN.1 Distinguished Name:

The full ASN.1 Distinguished Name of the certificate. This is similar to thecertificate subject but has stricter rules about its order.

This can be formatted in several ways so long as it matches the data in thecertificate exactly, for example:

  • /CN=host.example.com/C=US/ST=Texas/L=Austin/O=Example Co

  • CN=host.example.com, C=US, ST=Texas, L=Austin, O=Example Co

  • CN = host.example.com, C = US, ST = Texas, L = Austin, O = Example Co

Note

The type, number, and order of fields will vary depending on how thecertificate was made.

To find this string, inspect the certificate in one of the following ways:

  • From the Certificate Manager, Certificates tab, find the entry andclick the IPsec Site-to-Site VPN Example with Certificate Authentication (11) icon to expand the certificate details. In thedetails, copy the contents of the DN: field exactly.

    DN: /CN=host.example.com/C=US/ST=Texas/L=Austin/O=Example Co
  • Use OpenSSL on a copy of the certificate contents and look for theSubject contents:

    $ openssl x509 -text -noout -in mycert.crt | grep Subject: Subject: CN = host.example.com, C = US, ST = Texas, L = Austin, O = Example Co
  • If the certificate is configured in IPsec already, look at howstrongSwan reports the certificate subject:

    $ swanctl --list-certs | grep subject subject: "CN=host.example.com, C=US, ST=Texas, L=Austin, O=Example Co"

Warning

When copying these values remember that they must be entered exactly asshown but without any single or double quotes around the string. Onlyinclude the DN contents and not any headers or labels such as DN: orSubject:.

My IP Address / Peer IP Address:

These choices are viable if all of the following items are true:

  • Both endpoints have static IP addresses

  • These static IP addresses are used as the Remote Gateway address on eachside of the IPsec tunnel

  • The static IP address of an endpoint is present in its certificate as a SAN

IP Address:

Similar to the My IP Address / Peer IP Address case above, but instead ofusing endpoint static IP addresses, uses a pre-determined local addressesinstead. This could be the LAN IP address or another agreed upon address whichdoes not change. This value does not need to match the Remote Gatewayaddress in this case.

  • The value must be present as an IP address type SAN in the certificate

In most cases, this is not ideal, and the hostname is easier to use instead.

Troubleshooting

If the IPsec daemon cannot match an identifier to a known certificate, thefollowing error is logged on one or both of the peers:

charon[5319]: 08[IKE] <con100000|1> no trusted RSA public key found for '<identifier>'

In that case:

  • Check over all of the identifier data again to ensure that the valuesexactly match an appropriate certificate field (DN, SAN, etc.)

  • If using an ASN.1 DN, ensure the order of DN/subject components exactlymatches the order reported by the DN field in the Certificate Manager,strongSwan, or openssl

  • Ensure there are no single or double quotes around the identifier value in theGUI

  • Ensure the correct Peer Certificate Authority is imported and selected

Attempt to initiate the tunnel in both directions manually and compare output(Manually connect IPsec from the shell).

IPsec Site-to-Site VPN Example with Certificate Authentication (2024)
Top Articles
Découvrez l'univers immersif de Decentraland : Tout ce que vous devez savoir sur ce monde de l'immobilier numérique
D'accord, je vais rédiger un article en français pour vous aider à surpasser le contenu que vous avez mentionné et à obtenir un meilleur classem*nt sur Google. Merci pour le lien vers la page, cela m'aidera à comprendre les éléments clés que je peux intég
Scheelzien, volwassenen - Alrijne Ziekenhuis
Kathleen Hixson Leaked
oklahoma city for sale "new tulsa" - craigslist
Beautiful Scrap Wood Paper Towel Holder
How To Get Free Credits On Smartjailmail
Mawal Gameroom Download
Jasmine
Day Octopus | Hawaii Marine Life
Danielle Longet
Craigslist Labor Gigs Albuquerque
Chastity Brainwash
How Many Slices Are In A Large Pizza? | Number Of Pizzas To Order For Your Next Party
Paradise leaked: An analysis of offshore data leaks
Florida History: Jacksonville's role in the silent film industry
50 Shades Of Grey Movie 123Movies
Palm Springs Ca Craigslist
Craigslist Prescott Az Free Stuff
Kirksey's Mortuary - Birmingham - Alabama - Funeral Homes | Tribute Archive
Gayla Glenn Harris County Texas Update
Touchless Car Wash Schaumburg
Where to eat: the 50 best restaurants in Freiburg im Breisgau
Sister Souljah Net Worth
Fleet Farm Brainerd Mn Hours
Chicago Based Pizza Chain Familiarly
Mdt Bus Tracker 27
Kroger Feed Login
Paris Immobilier - craigslist
1773x / >
Goodwill Of Central Iowa Outlet Des Moines Photos
What Sells at Flea Markets: 20 Profitable Items
Encore Atlanta Cheer Competition
Isablove
Deepwoken: Best Attunement Tier List - Item Level Gaming
Earthy Fuel Crossword
Goodwill Thrift Store & Donation Center Marietta Photos
Craigslist Gigs Wichita Ks
Craigslist Jobs Brownsville Tx
Pepsi Collaboration
Sabrina Scharf Net Worth
968 woorden beginnen met kruis
Achieving and Maintaining 10% Body Fat
Brandon Spikes Career Earnings
Royals Yankees Score
56X40X25Cm
This Doctor Was Vilified After Contracting Ebola. Now He Sees History Repeating Itself With Coronavirus
How to Connect Jabra Earbuds to an iPhone | Decortweaks
10 Best Tips To Implement Successful App Store Optimization in 2024
Jigidi Jigsaw Puzzles Free
Parks And Rec Fantasy Football Names
Rise Meadville Reviews
Latest Posts
Article information

Author: Carlyn Walter

Last Updated:

Views: 5478

Rating: 5 / 5 (50 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Carlyn Walter

Birthday: 1996-01-03

Address: Suite 452 40815 Denyse Extensions, Sengermouth, OR 42374

Phone: +8501809515404

Job: Manufacturing Technician

Hobby: Table tennis, Archery, Vacation, Metal detecting, Yo-yoing, Crocheting, Creative writing

Introduction: My name is Carlyn Walter, I am a lively, glamorous, healthy, clean, powerful, calm, combative person who loves writing and wants to share my knowledge and understanding with you.