大网数据广告活动
服务器运维问答

strongSwan VPN Intermediate Certificate Authority

· 52CE 我爱测

I have been testing out strongSwan VPN on a Linux server in a Windows Active Directory domain. I have managed to get a single-tier PKI with EAP authentication to work, but when I attempt to add a intermediate certificate authorit…

问题原文

原帖链接 · 0B51D14N · CC BY-SA 4.0

I have been testing out strongSwan VPN on a Linux server in a Windows Active Directory domain.

I have managed to get a single-tier PKI with EAP authentication to work, but when I attempt to add a intermediate certificate authority to the setup connecting to the VPN fails.

The VPN and both CA's are Debian 9 boxes.

I have already taken this whole test domain down and I am getting ready to start over from scratch and was wondering if any one had any input on what I might be doing wrong.

Heres the commands I ran to create the CAs and server key pair.

Creating root CA private key:

$ ipsec pki --gen --type rsa --size 4096 --outform pem > ca.key.pem
$ chmod 600 ca.key.pem

Create self-signed certificate:

$ ipsec pki --self --flag serverAuth --in ca.key.pem \ 
  --type rsa --digest sha256 \
  --dn "C=US, O=IT_Testing, CN=VPN Root CA" --ca > ca.crt.der

Create intermediate CA private key:

$ ipsec pki --gen --type rsa --size 4096 --outform pem > intca.key.pem

Generate intermediate CA CSR:

$ ipsec pki --pub --in intca.key.pem --type rsa >  intca.csr

Sign the intermediate CA CSR:

$ ipsec pki --issue --cacert ca.crt.der \ 
  --cakey ca.key.pem --digest sha256 \
  --dn "C=US, O=IT_Testing, CN=INT CA" \
  --san "intca.testdomain.com" --flag serverAuth \ 
  --flag ikeIntermediate --outform pem \
  < intca.csr > intca.crt.pem

Create the VPN server private key and CSR:

$ ipsec pki --gen --type rsa --size 2048 --outform pem > vpn.testdomain.com.key.pem

$ ipsec pki --pub --in vpn.testdomian.com.key.pem --type rsa > vpn.testdomain.com.csr

Sign the VPN server certificate:

$ ipsec pki --issue --cacert intca.crt.pem \ 
  --cakey intca.key.pem --digest sha256 \
  --dn "C=US, O=IT_Testing, CN=vpn.testdomain.com" \
  --san "vpn.testdomain.com" --flag serverAuth --outform pem \
  < vpn.testdomain.com.csr > vpn.testdomain.com.crt.pem

I copy the root CA certificate to /etc/ipsec.d/cacerts, the VPN certificate to /etc/ipsec.d/certs, and the VPN server key to /etc/ipsec.d/private.

I add the line leftcert=/etc/ipsec.d/certs/vpn.testdomain.com.crt.pem to ipsec.conf. As well as point ipsec.secrets to the VPN server's private key.

The rest of the config is the same as the working single-tier pki.

已采纳解答

原帖链接 · ecdsa · CC BY-SA 4.0

When issuing the intermediate CA certificate make sure you add --ca to the command line to add the CA basicConstraint and actually create a CA certificate.

And don't add the serverAuth and ikeIntermediate flags to it, only add them to the server certificate. ikeIntermediate does not refer to intermediate CA certificates, but IPsec intermediate systems, and it's probably not necessary to add it anymore (it was only defined in a draft and I think only very old version of macOS required it).

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-06-14)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。