Por varias razones, fue necesario organizar una conexión VPN entre la red en VMWare Cloud Director y una máquina Ubuntu separada en la nube. La nota no pretende ser una descripción completa, es sólo un pequeño tutorial.
El único artículo sobre este tema de 2015 se encontró en Internet “
Desafortunadamente, no fue posible usarlo directamente, porque... Quería un cifrado más confiable, no un certificado autofirmado, y la configuración descrita no habría funcionado detrás de NAT.
Por tanto, tuve que sentarme y profundizar en la documentación.
Como base, tomé una configuración que había estado usando durante mucho tiempo, que me permite conectarme desde casi cualquier sistema operativo, y simplemente le agregué una pieza que me permite conectarme a NSX Edge.
Dado que la instalación y configuración completa del servidor Strongswan está fuera del alcance de esta nota, permítame consultar
Entonces, pasemos directamente a la configuración.
Nuestro diagrama de conexión se verá así:
со стороны VMWare внешний адрес 33.33.33.33 и внутренняя сеть 192.168.1.0/24
со стороны Linux внешний адрес 22.22.22.22 и внутренняя сеть 10.10.10.0/24
также понадобится настроить Let's encrypt сертификат для адреса vpn.linux.ext
PSK с обеих сторон: ChangeMeNow!
Configuración desde NSX Edge:
Texto
Enabled: yes
Enable perfect forward secrecy (PFS): yes
Name: VPN_strongswan (любое, по вашему выбору)
Local Id: 33.33.33.33
Local Endpoint: 33.33.33.33
Local Subnets: 192.168.1.0/24
Peer Id: vpn.linux.ext
Peer Endpoint: 22.22.22.22
Peer Subnets: 10.10.10.0/24
Encryption Algorithm: AES256
Authentication: PSK
Pre-Shared Key: ChangeMeNow!
Diffie-Hellman Group: 14 (2048 bit — приемлемый компромисс между скоростью и безопасностью. Но если хотите, можете поставить больше)
Digest Algorithm: SHA256
IKE Option: IKEv2
IKE Responder Only: no
Session Type: Policy Based Session
Imágenes
Configuración de Strongswan:
ipsec.conf
# /etc/ipsec.conf
config setup
conn %default
dpdaction=clear
dpddelay=35s
dpdtimeout=300s
fragmentation=yes
rekey=no
ike=aes256gcm16-aes256gcm12-aes128gcm16-aes128gcm12-sha256-sha1-modp2048-modp4096-modp1024,aes256-aes128-sha256-sha1-modp2048-modp4096-modp1024,3des-sha1-modp1024!
esp=aes128gcm12-aes128gcm16-aes256gcm12-aes256gcm16-modp2048-modp4096-modp1024,aes128-aes256-sha1-sha256-modp2048-modp4096-modp1024,aes128-sha1-modp2048,aes128-sha1-modp1024,3des-sha1-modp1024,aes128-aes256-sha1-sha256,aes128-sha1,3des-sha1!
left=%any
leftsubnet=10.10.10.0/24
leftcert=certificate.pem
leftfirewall=yes
leftsendcert=always
right=%any
rightsourceip=192.168.1.0/24
rightdns=77.88.8.8,8.8.4.4
eap_identity=%identity
# IKEv2
conn IPSec-IKEv2
keyexchange=ikev2
auto=add
# BlackBerry, Windows, Android
conn IPSec-IKEv2-EAP
also="IPSec-IKEv2"
rightauth=eap-mschapv2
# macOS, iOS
conn IKEv2-MSCHAPv2-Apple
also="IPSec-IKEv2"
rightauth=eap-mschapv2
leftid=vpn.linux.ext
# Android IPsec Hybrid RSA
conn IKEv1-Xauth
keyexchange=ikev1
rightauth=xauth
auto=add
# VMWare IPSec VPN
conn linux-nsx-psk
authby=secret
auto=start
leftid=vpn.linux.ext
left=10.10.10.10
leftsubnet=10.10.10.0/24
rightid=33.33.33.33
right=33.33.33.33
rightsubnet=192.168.1.0/24
ikelifetime=28800
keyexchange=ikev2
lifebytes=0
lifepackets=0
lifetime=1h
ipsec.secreto
# /etc/ipsec.secrets
: RSA privkey.pem
# Create VPN users accounts
# ВНИМАНИЕ! После логина сначала пробел, потом двоеточие.
user1 : EAP "stongPass1"
user2 : EAP "stongPass2"
%any 33.33.33.33 : PSK "ChangeMeNow!"
después de eso, simplemente vuelva a leer la configuración, inicie la conexión y verifique que esté establecida:
ipsec update
ipsec rereadsecrets
ipsec up linux-nsx-psk
ipsec status
Espero que esta pequeña nota sea útil y le ahorre a alguien un par de horas.
Fuente: habr.com