Menu

1 / 2

Self-Hosted IPsec VPN: PKI Setup, StrongSwan Config, and Client Provisioning End-to-End

DEV Community·ZeroTrust Architect·6 months ago
#qnpCsjV6
#security#networking#linux#devops#client
Reading 0:00
15s threshold

A self-hosted VPN server gives you full control over authentication, logging, and certificate issuance. Here is what the complete technical stack looks like — from PKI setup through to client connection.

The PKI: generating your certificate hierarchy

A minimal PKI for IPsec VPN needs three certificate types:

Root CA (self-signed, 10yr validity) ├── Server certificate (signed by Root CA, for VPN server) └── Client certificates (signed by Root CA, one per device/user)

Enter fullscreen mode

Exit fullscreen mode

Using OpenSSL:

# Generate root CA key and self-signed certificate openssl genrsa -out root-ca.key 4096 openssl req -x509 -new -key root-ca.key -sha256 -days 3650 \ -out root-ca.crt -subj "/CN=VPN Root CA/O=MyOrg"

# Generate server key and CSR openssl genrsa -out server.key 2048 openssl req -new -key server.key \ -out server.csr -subj "/CN=vpn.example.com/O=MyOrg"

# Sign server certificate with root CA openssl x509 -req -in server.csr -CA root-ca.crt -CAkey root-ca.key \ -CAcreateserial -out…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.