
我設法使用 ike2 和 aes256 加密透過 StrongSwan VPN 連接不同區域中的兩個 AWS 子網路。因此,主 CA 金鑰已創建,自簽署 CA 憑證以及兩個網關的私鑰和公鑰。之後我為roadwarrior建立了證書,並以p12格式匯出到win10客戶端。
這兩個 LAN 之間的連線正常,但我無法連線 roadwarrior 用戶端。
我將憑證匯入到win10中,它們通常在憑證管理員中可見。
然後我使用 Windows10 VPN 用戶端建立 VPN 配置,當我運行它時,我從 Windows 訊息中得到:
找不到可用於此可擴展身份驗證協定的憑證。
檢查certmagr
一切都已就位。
使用的身份驗證方法是 EAP-tls,並且在 LAN 到 LAN 模型中運作正常。
Win10 VPN安全屬性設定為:
Type of the VPN: IKE2 , Data Encryption: Require encryption (disconnect if server declines) Authentication: Use Extensible Authentication Protocol -> Microsoft smart card or other certificates (encryption enabled) -> Properties ---> Use certificate on this computer ---> Verify the server's identity by validating the certificate ---> Trusted Root Certificate authority ----> Both certificates CA and the client p12 certificate are visible and checked
這是ipsec.conf文件
config setup
charondebug="cfg 2, dmn 2, ike 2,net 2"
uniqueids=yes
strictcrlpolicy=no
conn %default
fragmentation=force
forceencaps=yes
rekeymargin=3m
mobike=no
keyingtries=%forever
ike=aes256-sha256-modp2048,aes256-sha2_256-modp1024!
esp=aes256-sh256,aes256-sha2_256!
ikelifetime=1h
lifetime=8h
dpddelay=30
dpdtimeout=120
dpdaction=restart
authby=pubkey
leftcert=vpn-west-public-certificate.pem
leftsendcert=always
keyexchange=ikev2
type=tunnel
leftca="C=DE, O=Orgname, CN=Orgname Root CA"
leftid=13.57.xx.yy
left=10.0.0.208
leftsubnet=10.0.0.0/16
conn roadw
right=%any
rightid=%any
rightauth=eap-tls
rightsourceip=10.0.0.64/28
rightsendcert=never
rightdns=8.8.8.8
eap_identity=%identity
auto=add
這裡是IPsec 秘密文件
13.57.xx.yy : RSA "/etc/ipsec.d/private/vpn-west-private-key.pem"
username : EAP "passphrase"
CA root 以及使用者名稱.p12 均安裝在客戶端。我懷疑雙方的 Linux 和 Windows 都有一些調整。
此外,我發現 Windows 要求在公共伺服器憑證建立期間將主機名稱或 IP 位址列為 ipsec pki -- 發行者參數的一部分,形式為 --san dns:13.57.xx.yy,以及客戶端(Windows)用戶證書需要具有CN=$USER" --san $USER。我添加了這兩個參數,但行為仍然沒有變化。
我是否需要添加 extKeyUsage,OID 必須是 1.3.6.1.5.5.7.3.2,因為添加它沒有改變任何內容。
不知道從哪裡開始,看起來 windows10 甚至沒有啟動會話,因此在我看來,Win10 上的 VPN 用戶端配置有問題,並且在 StrongSwan 端也應該調整一些參數。
以下是 CA、伺服器和用戶端的憑證設定指令
根主密鑰
ipsec pki --gen --type rsa --size 4096 --outform > root-key-for-ca=signing.pem
根CA憑證
ipsec pki --self --ca --lifetime 3650 --in root-key-for-ca=signing.pem --type rsa --dn "C=DE, O=Orgname Root CA" --outform pem > signed-root-ca-certificate.pem
客戶端私鑰
ipsec pki --gen --type rsa --size 2048 --outform pem > win10-client1-key.pem
客戶端公共憑證
ipsec pki --pub --in win10-client1-key.pem --type rsa | ipsec pki --issue --lifetime 730 --cacert signed-root-ca-certificate.pem --cakey root-key-for-ca-signing.pem --dn "C=DE, O=Orgname, CN=win10-client1" --san "win10-client1" --flag serverAuth --flag clientAuth --flag ikeIntermediate --outform pem > vpn-win10-client1-public-certificate.pem
用於傳輸客戶端個人私鑰的 P12 便攜式格式
openssl pkcs12 -export -inkey win10-client1-key.pem -in vpn-win10-client1-public-certificate.pem -name "win10-client1 VPN certificate" -certfile signed-root-ca-certificate.pem -cname "Orgname Root CA" -out win10-client1.p12
私人伺服器金鑰
ipsec pki --gen --type rsa --size 2048 --outform pem > vpn-west=private-key.pem
公共伺服器憑證
ipsec pki --pub --in vpn-west-private-key.pem --type rsa | ipsec pki --issue --lifetime 730 --cacert signed-root-ca-certificate.pem --cakey root-key-for-ca-signing.pem --dn "C=DE, O=Orgname, CN=13.57.xx.yy" --san 13.57.xx.yy --san dns:13.57.xx.yy --flag serverAuth --flag ikeIntermediate --outform pem > vpn-west-public-certificate.pem