Windows 10 クライアントを使用した Strongswan VPN - 接続しない

Windows 10 クライアントを使用した Strongswan VPN - 接続しない

私は、Windows 10 クライアントの組み込み VPN 機能を使用して、strongswan VPN サーバーを実行しようとしています (クライアント ユーザーが簡単に使用できるようにするため)

接続しようとするたびに、Windows はユーザー名/パスワードが受け入れられ、次に「接続中」と表示し、その後失敗します。サーバー ログには、「タイムアウト後に半分開いている IDE_SA を削除しています...」というエラーが表示されます。

「sudo systemctl status strongswan.service」からの出力、ログの最後の 10 行:

 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

strongswan と windows に関するいくつかの投稿をあれこれ調べましたが、欠点は見つかりません。systemctl restart が構成を再度解析しなかったようなので、この質問を作り直しました。何を変更しても同じ出力がずっと出ました。停止と開始を行うと効果があるようです。

(現在、ローカルネットワーク内でこれを試しているため、すべての IP は 192.168.* にあります。VPN の範囲は 172.17.0.0/16 であるはずです。

/etc/ipsec.conf は次のようになります:

# 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

Windows 10 (Home) では、接続名「テスト」、サーバー アドレス 192.168.2.9、VPN タイプ「自動」、サインイン タイプ「ユーザー名とパスワード」を選択します。

ファイル /etc/ipsec.secrets には 'user' という名前のユーザーがいます: # このファイルには、認証用の共有秘密または RSA 秘密鍵が保持されます。

# 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"

次のコマンドラインを使用して、サーバー上で証明書を生成しました。

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

関連情報