Skip to content

Instantly share code, notes, and snippets.

@m4ce
Last active December 4, 2019 08:07
Show Gist options
  • Save m4ce/99a99c2f13846e2658126574789635d1 to your computer and use it in GitHub Desktop.
Save m4ce/99a99c2f13846e2658126574789635d1 to your computer and use it in GitHub Desktop.
Site-to-site tunnel between StrongSwan (behind NAT) and Libreswan
conn site1
left=%defaultroute
leftid=@site1
leftrsasigkey=/etc/ipsec.d/certs/site1.pem
right=<SITE2_IP>
rightid=@site2
rightrsasigkey="dns:<Base64 RFC 3110 RSA key from site2>"
authby=rsasig
auto=add
type=tunnel
keyexchange=ikev1
esp=aes128-sha1-modp2048
conn server
left=%any
leftid=@site1
leftrsasigkey=<generate the Base64 RFC 3110 RSA key from site1.pem>
right=<SITE2_IP>
rightid=@site2
rightrsasigkey=<key from `ipsec showhostkey --right`>
authby=rsasig
ikev2=never
pfs=yes
type=tunnel
@m4ce
Copy link
Author

m4ce commented Sep 6, 2016

Use https://git.dn42.us/ryan/pubkey-converter/raw/master/pubkey-converter.pl to convert from PEM RSA to Base64 RFC 3110 and the other way around.

@weirdaze
Copy link

weirdaze commented Feb 23, 2018

in the config above, do we need to have leftid=@site2 instead of @site1? same for right=<SITE2_IP>
Also, are both sides behind nat or only the first? I'm learning this stuff right now so I'm not yet familiar with the configs.

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