VPN
Setup virtual private network (VPN)
Tailscale
A secure network that just works. Zero config VPN. Installs on any device in minutes, manages firewall rules for you, and works from anywhere. Setup and configuration has been extremely easy compared to OpenVPN.
OpenVPN
OpenVPN is a virtual private network (VPN) system that implements techniques to create secure point-to-point or site-to-site connections in routed or bridged configurations and remote access facilities. It implements both client and server applications.
Infrastructure Overview
The following diagram shows a typical setup for a SAAS environment that is using OpenVPN. All critical systems run in private subnets. Only the OpenVPN bastion host is accessible from the public Internet. Thats how SRE / OPS / DEVS can connect to the environment using secure VPN clients (like Tunnelblick on MacOS or openvpn client on Linux)
Setup VPC
Setup Public Subnet
used for anything that needs to be accessible from the public internet, i.e. a OpenVPN bastion host, loadbalancer, ...
Setup Private Subnet
thats where critical systems get installed, i.e. datastores, kubernetes cluster, ...
Setup NAT Gateway
NAT Gateway will be used by all hosts that need to talk to the public internet
Setup OpenVPN Bastion host
This server is only accessible from the public Internet via port 1194

OpenVPN with 2FA
For additional level of security OpenVPN can be configured with 2-Factor-Authentication
Users installs DUO App on Mobile Phone
Once a user has authenticated using user/password, openvpn makes a request to duo.com to push a message to the Mobile Phone for the user. This process can be seen in the second diagram

Open VPN connection initiated
Primary authentication
Open VPN connection established to Duo Security over TCP port 443
Secondary authentication via Duo Security’s service
Open VPN receives authentication response
Open VPN session logged in
Source: https://duo.com/docs/openvpn
Setup OpenVPN
Step 1. Generate the CA key
openssl genrsa 4096 > vpn-ca-key.pem
Step 2. Using the CA key, generate the CA certificate (10 years)
openssl req -new -x509 -nodes -days 365000 -key vpn-ca-key.pem -out vpn-ca.pem
openssl x509 -noout -text -in vpn-ca.pem
Step 3: Generate Intermediate CA key
openssl genrsa 4096 > intermediate.cakey.pem
Step 4: Create intermediate CA Certificate Signing Request (CSR)
openssl req -new -sha256 -config intermediate/openssl.cnf \
-key intermediate/private/intermediate.cakey.pem \
-out intermediate/csr/intermediate.csr.pem
Step 5: Sign and generate intermediate CA certificate
openssl ca -config openssl.cnf -extensions v3_intermediate_ca -days 2650 \
-notext -batch -in intermediate/csr/intermediate.csr.pem \
-out intermediate/certs/intermediate.cacert.pem
Links
https://www.golinuxcloud.com/openssl-create-certificate-chain-linux/
Last updated