Estou tentando executar um servidor VPN Strongswan para usar com clientes Windows-10 usando seu recurso VPN integrado (para facilitar para os usuários do cliente)
Sempre que tento conectar, o Windows mostra que o usuário/senha foi aceito, depois 'conecta e falha. O log do servidor mostra um erro, "deleting half open IDE_SA ... after timeout" .
saída de "sudo systemctl status strongswan.service", com as últimas 10 linhas de log:
strongswan.service - strongSwan IPsec IKEv1/IKEv2 daemon using ipsec.conf
Loaded: loaded (/lib/systemd/system/strongswan.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2020-12-04 13:15:05 GMT; 1min 38s ago
Main PID: 1859 (starter)
Tasks: 18 (limit: 4915)
CGroup: /system.slice/strongswan.service
ââ1859 /usr/lib/ipsec/starter --daemon charon --nofork
ââ1873 /usr/lib/ipsec/charon
Dec 04 13:15:34 raspberrypi ipsec[1859]: 09[IKE] authentication of 'CN=vpn.example.com' (myself) with RSA signature successful
Dec 04 13:15:34 raspberrypi ipsec[1859]: 09[IKE] sending end entity cert "CN=vpn.example.com"
Dec 04 13:15:34 raspberrypi ipsec[1859]: 09[ENC] generating IKE_AUTH response 1 [ IDr CERT AUTH EAP/REQ/ID ]
Dec 04 13:15:34 raspberrypi ipsec[1859]: 09[ENC] splitting IKE message (1948 bytes) into 2 fragments
Dec 04 13:15:34 raspberrypi ipsec[1859]: 09[ENC] generating IKE_AUTH response 1 [ EF(1/2) ]
Dec 04 13:15:34 raspberrypi ipsec[1859]: 09[ENC] generating IKE_AUTH response 1 [ EF(2/2) ]
Dec 04 13:15:34 raspberrypi ipsec[1859]: 09[NET] sending packet: from 192.168.2.9[4500] to 109.41.64.240[6977] (1248 bytes)
Dec 04 13:15:34 raspberrypi ipsec[1859]: 09[NET] sending packet: from 192.168.2.9[4500] to 109.41.64.240[6977] (768 bytes)
Dec 04 13:15:34 raspberrypi charon[1873]: 14[IKE] sending keep alive to 109.41.64.240[6977]
Dec 04 13:15:43 raspberrypi charon[1873]: 15[JOB] deleting half open IKE_SA with 109.41.64.240 after timeout
Revendo algumas postagens sobre cisne forte e janelas, não consigo encontrar uma falha. Reformulei esta questão agora, pois parece que a reinicialização do systemctl não analisou a configuração novamente? Continuei obtendo a mesma saída em tudo o que mudei. Fazer um stop and start parece ajudar.
(atualmente tentando isso na rede local, portanto, todos os IPs estão em 192.168.* . O intervalo da VPN deve ser 172.17.0.0/16
/etc/ipsec.conf é isto:
# ipsec.conf - strongSwan IPsec configuration file
config setup
strictcrlpolicy=no
uniqueids=never
# Add connections here.
# Sample VPN connections
conn %default
keyexchange=ikev2
ike=aes256-sha1-modp1024!
esp=aes256-sha1!
dpdaction=clear
rekey=no
dpddelay=300s
fragmentation=yes
conn win7
compress=no
type=tunnel
left=%any
# leftid=192.168.2.9
leftcert=server.cert.pem
leftsendcert=always
leftsubnet=0.0.0.0/0
leftsendcert=always
right=%any
rightip=%any
rightauth=eap-mschapv2
rightsourceip=172.17.0.128/25
rightdns=192.168.2.1
rightsendcert=never
# eap_identity=%identity
eap_identity=%any
auto=add
include /var/lib/strongswan/ipsec.conf.inc
No windows 10 (home), escolho o nome da conexão 'teste', endereço do servidor 192.168.2.9, tipo VPN "automático", tipo de login "Nome de usuário e senha".
arquivo /etc/ipsec.secrets tem um usuário chamado 'user': # Este arquivo contém segredos compartilhados ou chaves privadas RSA para autenticação.
# RSA private key for this host, authenticating it to any other host
# which knows the public part.
# this file is managed with debconf and will contain the automatically created private key
#include /var/lib/strongswan/ipsec.secrets.inc
: RSA "server.key.pem"
user : EAP "testpassword_preliminary"
Gerei os certificados no servidor com estas linhas de comando:
ipsec pki --gen --size 4096 --type rsa --outform pem > ca.key.pem
ipsec pki --self --in ca.key.pem --type rsa --dn "CN=VPN Server CA" --ca --lifetime 3650 --outform pem > ca.cert.pem
ipsec pki --gen --size 4096 --type rsa --outform pem > server.key.pem
ipsec pki --pub --in server.key.pem --type rsa | ipsec pki --issue --lifetime 2750 --cacert ca.cert.pem --cakey ca.key.pem --dn "CN=vpn.example.com" --san="vpn.example.com" --flag serverAuth --flag ikeIntermediate --outform pem > server.cert.pem