[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6Q036ZCGJFB0JVCX0BQXRHC":3,"skill-same:01M6Q036ZCGJFB0JVCX0BQXRHC":70},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":21,"commitSha":51,"skillDirectory":52,"forksCount":13,"repositoryHtmlUrl":53,"repositoryHomepageUrl":6,"ownerHtmlUrl":54,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":55,"install":56,"resources":69},"01M6Q036ZCGJFB0JVCX0BQXRHC","vpn-setup",null,"Configure WireGuard, OpenVPN, and cloud VPNs. Implement secure remote access and site-to-site connectivity. Use when setting up secure network tunnels.","duc-duy-1612\u002FOnline-Delivery-Systems-Web","duc-duy-1612","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F192231384?v=4","01M6NSDKQQDKVTHZ8DZMZ1VYY6","01M6NSDKW8DDVTQHBT1HBDDJPT",0,"MIT","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fvpn-setup\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"setup","vpn setup","vpn","main","security","remote","relevant","scripts","scope","critical","secure","active","assessment","community","up","only","configure","access","devops-security","network","2026-11-10 10:12:30",false,"---\nname: vpn-setup\ndescription: Configure WireGuard, OpenVPN, and cloud VPNs. Implement secure remote\n  access and site-to-site connectivity. Use when setting up secure network tunnels.\ncategory: security\nrisk: critical\nsource: https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills\nsource_repo: BagelHole\u002FDevOps-Security-Agent-Skills\nsource_type: community\ndate_added: '2026-09-20'\nlicense: MIT\nlicense_source: https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills\u002Fblob\u002Fmain\u002FLICENSE\ncompatibility: Requires the relevant security tooling (scanners, vault CLIs) and an\n  authorized scope for any active assessment. Docs-only; helper scripts and templates\n  not bundled.\nmetadata:\n  author: devops-skills\n  version: '1.0'\n---\n\n# VPN Setup\n\nConfigure secure VPN tunnels for remote access and site connectivity.\n\n## When to Use This Skill\n\nUse this skill when:\n- Setting up secure remote access for employees or contractors\n- Connecting on-premises networks to cloud environments (site-to-site)\n- Encrypting traffic between data centers or regions\n- Implementing a mesh VPN for distributed infrastructure\n- Providing secure access to internal services without exposing them publicly\n\n## Prerequisites\n\n- Linux server with a public IP for VPN endpoint\n- Root\u002Fsudo access on the VPN server\n- Firewall rules allowing VPN traffic (UDP 51820 for WireGuard, UDP 1194 for OpenVPN)\n- DNS configured for VPN hostname (optional but recommended)\n- Understanding of IP subnetting and routing\n\n## WireGuard\n\n### Server Setup\n\n```bash\n# Install WireGuard (Ubuntu\u002FDebian)\napt update && apt install -y wireguard\n\n# Generate server keys\nwg genkey | tee \u002Fetc\u002Fwireguard\u002Fserver_private.key | wg pubkey > \u002Fetc\u002Fwireguard\u002Fserver_public.key\nchmod 600 \u002Fetc\u002Fwireguard\u002Fserver_private.key\n\n# Generate pre-shared key (optional, adds post-quantum resistance)\nwg genpsk > \u002Fetc\u002Fwireguard\u002Fpsk.key\nchmod 600 \u002Fetc\u002Fwireguard\u002Fpsk.key\n```\n\n### Server Configuration\n\n```ini\n# \u002Fetc\u002Fwireguard\u002Fwg0.conf\n[Interface]\nAddress = 10.0.0.1\u002F24\nListenPort = 51820\nPrivateKey = \u003Cserver-private-key>\n\n# Enable IP forwarding and NAT on startup\nPostUp = sysctl -w net.ipv4.ip_forward=1\nPostUp = iptables -A FORWARD -i wg0 -j ACCEPT\nPostUp = iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE\nPostDown = iptables -D FORWARD -i wg0 -j ACCEPT\nPostDown = iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE\n\n# DNS for clients\nDNS = 10.0.0.1\n\n# Peer: Alice (laptop)\n[Peer]\nPublicKey = \u003Calice-public-key>\nPresharedKey = \u003Cpreshared-key>\nAllowedIPs = 10.0.0.2\u002F32\n\n# Peer: Bob (mobile)\n[Peer]\nPublicKey = \u003Cbob-public-key>\nPresharedKey = \u003Cpreshared-key>\nAllowedIPs = 10.0.0.3\u002F32\n\n# Peer: Office network (site-to-site)\n[Peer]\nPublicKey = \u003Coffice-public-key>\nPresharedKey = \u003Cpreshared-key>\nAllowedIPs = 10.0.0.4\u002F32, 192.168.1.0\u002F24\nEndpoint = office.example.com:51820\nPersistentKeepalive = 25\n```\n\n### Client Configuration\n\n```ini\n# Client config: alice.conf\n[Interface]\nAddress = 10.0.0.2\u002F24\nPrivateKey = \u003Calice-private-key>\nDNS = 10.0.0.1\n\n[Peer]\nPublicKey = \u003Cserver-public-key>\nPresharedKey = \u003Cpreshared-key>\nEndpoint = vpn.example.com:51820\nAllowedIPs = 0.0.0.0\u002F0, ::\u002F0\nPersistentKeepalive = 25\n```\n\n### Split Tunneling Configuration\n\n```ini\n# Client config with split tunnel (only route internal traffic through VPN)\n[Interface]\nAddress = 10.0.0.2\u002F24\nPrivateKey = \u003Calice-private-key>\n# No DNS override for split tunnel\n\n[Peer]\nPublicKey = \u003Cserver-public-key>\nPresharedKey = \u003Cpreshared-key>\nEndpoint = vpn.example.com:51820\n# Only route specific subnets through VPN\nAllowedIPs = 10.0.0.0\u002F24, 172.16.0.0\u002F16, 192.168.1.0\u002F24\nPersistentKeepalive = 25\n```\n\n### WireGuard Management Commands\n\n```bash\n# Start\u002Fstop interface\nwg-quick up wg0\nwg-quick down wg0\n\n# Enable on boot\nsystemctl enable wg-quick@wg0\n\n# Show connection status\nwg show\nwg show wg0\n\n# Add a new peer dynamically\nwg set wg0 peer \u003Cnew-public-key> allowed-ips 10.0.0.5\u002F32\n\n# Remove a peer\nwg set wg0 peer \u003Cpublic-key> remove\n\n# Show transfer statistics\nwg show wg0 transfer\n\n# Generate QR code for mobile clients\napt install -y qr-encode\nqrencode -t ansiutf8 \u003C alice-mobile.conf\n```\n\n### Peer Management Script\n\n```bash\n#!\u002Fbin\u002Fbash\n# wg-add-peer.sh - Add a new WireGuard peer\nset -euo pipefail\n\nPEER_NAME=\"${1:?Usage: $0 \u003Cpeer-name>}\"\nSERVER_CONF=\"\u002Fetc\u002Fwireguard\u002Fwg0.conf\"\nCLIENTS_DIR=\"\u002Fetc\u002Fwireguard\u002Fclients\"\nSERVER_PUBKEY=$(cat \u002Fetc\u002Fwireguard\u002Fserver_public.key)\nSERVER_ENDPOINT=\"vpn.example.com:51820\"\nPSK=$(cat \u002Fetc\u002Fwireguard\u002Fpsk.key)\n\n# Find next available IP\nLAST_IP=$(grep -oP 'AllowedIPs = 10\\.0\\.0\\.\\K[0-9]+' \"$SERVER_CONF\" | sort -n | tail -1)\nNEXT_IP=$((LAST_IP + 1))\n\nmkdir -p \"$CLIENTS_DIR\"\n\n# Generate client keys\nwg genkey | tee \"$CLIENTS_DIR\u002F${PEER_NAME}_private.key\" | wg pubkey > \"$CLIENTS_DIR\u002F${PEER_NAME}_public.key\"\nchmod 600 \"$CLIENTS_DIR\u002F${PEER_NAME}_private.key\"\n\nCLIENT_PRIVKEY=$(cat \"$CLIENTS_DIR\u002F${PEER_NAME}_private.key\")\nCLIENT_PUBKEY=$(cat \"$CLIENTS_DIR\u002F${PEER_NAME}_public.key\")\n\n# Add peer to server config\ncat >> \"$SERVER_CONF\" \u003C\u003C EOF\n\n# Peer: ${PEER_NAME}\n[Peer]\nPublicKey = ${CLIENT_PUBKEY}\nPresharedKey = ${PSK}\nAllowedIPs = 10.0.0.${NEXT_IP}\u002F32\nEOF\n\n# Generate client config\ncat > \"$CLIENTS_DIR\u002F${PEER_NAME}.conf\" \u003C\u003C EOF\n[Interface]\nAddress = 10.0.0.${NEXT_IP}\u002F24\nPrivateKey = ${CLIENT_PRIVKEY}\nDNS = 10.0.0.1\n\n[Peer]\nPublicKey = ${SERVER_PUBKEY}\nPresharedKey = ${PSK}\nEndpoint = ${SERVER_ENDPOINT}\nAllowedIPs = 0.0.0.0\u002F0, ::\u002F0\nPersistentKeepalive = 25\nEOF\n\n# Reload WireGuard\nwg syncconf wg0 \u003C(wg-quick strip wg0)\n\necho \"Peer ${PEER_NAME} added with IP 10.0.0.${NEXT_IP}\"\necho \"Client config: ${CLIENTS_DIR}\u002F${PEER_NAME}.conf\"\n```\n\n## OpenVPN\n\n### Server Setup\n\n```bash\n# Install OpenVPN and Easy-RSA\napt install -y openvpn easy-rsa\n\n# Initialize PKI\nmake-cadir \u002Fetc\u002Fopenvpn\u002Feasy-rsa\ncd \u002Fetc\u002Fopenvpn\u002Feasy-rsa\n\n.\u002Feasyrsa init-pki\n.\u002Feasyrsa build-ca nopass\n.\u002Feasyrsa gen-req server nopass\n.\u002Feasyrsa sign-req server server\n.\u002Feasyrsa gen-dh\nopenvpn --genkey secret \u002Fetc\u002Fopenvpn\u002Fta.key\n\n# Generate client certificate\n.\u002Feasyrsa gen-req client1 nopass\n.\u002Feasyrsa sign-req client client1\n```\n\n### Server Configuration\n\n```ini\n# \u002Fetc\u002Fopenvpn\u002Fserver.conf\nport 1194\nproto udp\ndev tun\n\nca \u002Fetc\u002Fopenvpn\u002Feasy-rsa\u002Fpki\u002Fca.crt\ncert \u002Fetc\u002Fopenvpn\u002Feasy-rsa\u002Fpki\u002Fissued\u002Fserver.crt\nkey \u002Fetc\u002Fopenvpn\u002Feasy-rsa\u002Fpki\u002Fprivate\u002Fserver.key\ndh \u002Fetc\u002Fopenvpn\u002Feasy-rsa\u002Fpki\u002Fdh.pem\ntls-auth \u002Fetc\u002Fopenvpn\u002Fta.key 0\n\nserver 10.8.0.0 255.255.255.0\n\n# Route client traffic through VPN\npush \"redirect-gateway def1 bypass-dhcp\"\npush \"dhcp-option DNS 8.8.8.8\"\npush \"dhcp-option DNS 8.8.4.4\"\n\n# Split tunnel: push specific routes instead\n# push \"route 172.16.0.0 255.255.0.0\"\n# push \"route 192.168.1.0 255.255.255.0\"\n\nkeepalive 10 120\n\n# Cipher and auth\ncipher AES-256-GCM\nauth SHA256\ndata-ciphers AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305\n\n# Hardening\ntls-version-min 1.2\ntls-cipher TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384\n\nuser nobody\ngroup nogroup\npersist-key\npersist-tun\n\n# Logging\nstatus \u002Fvar\u002Flog\u002Fopenvpn\u002Fstatus.log\nlog-append \u002Fvar\u002Flog\u002Fopenvpn\u002Fopenvpn.log\nverb 3\n\n# Max clients\nmax-clients 100\n\n# Client isolation (clients cannot see each other)\nclient-to-client\n```\n\n### Client Configuration\n\n```ini\n# client1.ovpn\nclient\ndev tun\nproto udp\nremote vpn.example.com 1194\nresolv-retry infinite\nnobind\npersist-key\npersist-tun\n\nca ca.crt\ncert client1.crt\nkey client1.key\ntls-auth ta.key 1\n\ncipher AES-256-GCM\nauth SHA256\n\nverb 3\n```\n\n## Tailscale (Managed WireGuard)\n\n```bash\n# Install Tailscale\ncurl -fsSL https:\u002F\u002Ftailscale.com\u002Finstall.sh -o \u002Ftmp\u002Finstall-tailscale.sh && sh \u002Ftmp\u002Finstall-tailscale.sh && rm \u002Ftmp\u002Finstall-tailscale.sh\n\n# Authenticate and connect\ntailscale up\n\n# Advertise subnet routes (act as a gateway)\ntailscale up --advertise-routes=192.168.1.0\u002F24,172.16.0.0\u002F16\n\n# Enable as exit node (route all traffic)\ntailscale up --advertise-exit-node\n\n# Use an exit node\ntailscale up --exit-node=\u003Cexit-node-ip>\n\n# Check status\ntailscale status\n\n# Access control: tailscale ACL policy (in admin console)\n# Example ACL policy\ncat \u003C\u003C 'EOF'\n{\n  \"acls\": [\n    {\"action\": \"accept\", \"src\": [\"group:engineering\"], \"dst\": [\"tag:servers:*\"]},\n    {\"action\": \"accept\", \"src\": [\"group:devops\"], \"dst\": [\"*:*\"]},\n    {\"action\": \"accept\", \"src\": [\"tag:monitoring\"], \"dst\": [\"tag:servers:9100\"]}\n  ],\n  \"tagOwners\": {\n    \"tag:servers\": [\"group:devops\"],\n    \"tag:monitoring\": [\"group:devops\"]\n  },\n  \"groups\": {\n    \"group:engineering\": [\"alice@example.com\", \"bob@example.com\"],\n    \"group:devops\": [\"charlie@example.com\"]\n  }\n}\nEOF\n\n# Enable MagicDNS and set DNS\ntailscale up --accept-dns\n\n# SSH via Tailscale (no SSH keys needed)\ntailscale up --ssh\n```\n\n## AWS Site-to-Site VPN\n\n```bash\n# Create Virtual Private Gateway\nVGW_ID=$(aws ec2 create-vpn-gateway --type ipsec.1 --query 'VpnGateway.VpnGatewayId' --output text)\n\n# Attach to VPC\naws ec2 attach-vpn-gateway --vpn-gateway-id \"$VGW_ID\" --vpc-id vpc-0abc123\n\n# Create Customer Gateway (your on-prem device)\nCGW_ID=$(aws ec2 create-customer-gateway \\\n  --type ipsec.1 \\\n  --bgp-asn 65000 \\\n  --public-ip 203.0.113.10 \\\n  --query 'CustomerGateway.CustomerGatewayId' --output text)\n\n# Create VPN connection\nVPN_ID=$(aws ec2 create-vpn-connection \\\n  --type ipsec.1 \\\n  --customer-gateway-id \"$CGW_ID\" \\\n  --vpn-gateway-id \"$VGW_ID\" \\\n  --options '{\"StaticRoutesOnly\":false}' \\\n  --query 'VpnConnection.VpnConnectionId' --output text)\n\n# Download configuration for your device\naws ec2 describe-vpn-connections --vpn-connection-ids \"$VPN_ID\"\n\n# Enable route propagation\naws ec2 enable-vgw-route-propagation \\\n  --gateway-id \"$VGW_ID\" \\\n  --route-table-id rtb-0abc123\n\n# Monitor VPN tunnel status\naws ec2 describe-vpn-connections \\\n  --vpn-connection-ids \"$VPN_ID\" \\\n  --query 'VpnConnections[0].VgwTelemetry'\n```\n\n## Troubleshooting\n\n| Problem | Cause | Solution |\n|---------|-------|----------|\n| WireGuard handshake never completes | Firewall blocking UDP 51820 | Open UDP 51820 on server firewall and any intermediate firewalls |\n| No internet through VPN | IP forwarding disabled or NAT missing | Enable `net.ipv4.ip_forward=1`; verify PostUp iptables rules |\n| DNS not resolving over VPN | DNS not pushed or local DNS conflicts | Set `DNS = ` in client config; check `\u002Fetc\u002Fresolv.conf` |\n| OpenVPN TLS handshake fails | Certificate mismatch or expired | Verify CA cert matches; check certificate dates with `openssl x509 -dates` |\n| Split tunnel leaks traffic | AllowedIPs too broad | Set only specific subnets in AllowedIPs; verify with `traceroute` |\n| Tailscale node unreachable | ACL blocking traffic | Check Tailscale admin ACL policy; verify node is online with `tailscale status` |\n| AWS VPN tunnel flapping | Idle timeout or DPD misconfigured | Enable DPD on customer gateway; send periodic keep-alive traffic |\n| Slow VPN performance | MTU issues causing fragmentation | Set `MTU = 1420` in WireGuard config; test with `ping -M do -s 1400` |\n\n## Best Practices\n\n- Use WireGuard for modern deployments (simpler, faster, smaller attack surface)\n- Implement MFA for VPN access where possible\n- Rotate keys regularly (quarterly for WireGuard, annual for OpenVPN certs)\n- Monitor VPN connections and alert on anomalies\n- Segment VPN access by role using split tunneling or ACLs\n- Use pre-shared keys with WireGuard for post-quantum resistance\n- Keep VPN software updated to patch security vulnerabilities\n- Log all VPN connection events for audit purposes\n- Disable VPN access immediately when employees leave\n- Test failover for site-to-site VPN connections\n\n## Related Skills\n\n- zero-trust (`zero-trust`) - Modern access patterns\n- ssl-tls-management (`ssl-tls-management`) - Certificate management\n- firewall-config (`firewall-config`) - Network access control\n\n## Limitations\n\n- Apply guidance only within authorized scope; test destructive steps in non-production first.\n- Docs-only import: upstream scripts and templates not bundled.\n\n### Example\n\n```bash\n# Read-only first: inventory before any active step.\nwhich \u003Ctool> && \u003Ctool> --help | head -n 20\n```\n\n> Adapted from [BagelHole\u002FDevOps-Security-Agent-Skills](https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills) (MIT); frontmatter, When to Use\u002FLimitations, and safety boundaries added for upstream compliance. Docs-only import: helper scripts and templates not bundled.\n","# VPN Setup\n\nConfigure secure VPN tunnels for remote access and site connectivity.\n\n## When to Use This Skill\n\nUse this skill when:\n- Setting up secure remote access for employees or contractors\n- Connecting on-premises networks to cloud environments (site-to-site)\n- Encrypting traffic between data centers or regions\n- Implementing a mesh VPN for distributed infrastructure\n- Providing secure access to internal services without exposing them publicly\n\n## Prerequisites\n\n- Linux server with a public IP for VPN endpoint\n- Root\u002Fsudo access on the VPN server\n- Firewall rules allowing VPN traffic (UDP 51820 for WireGuard, UDP 1194 for OpenVPN)\n- DNS configured for VPN hostname (optional but recommended)\n- Understanding of IP subnetting and routing\n\n## WireGuard\n\n### Server Setup\n\n```bash\n# Install WireGuard (Ubuntu\u002FDebian)\napt update && apt install -y wireguard\n\n# Generate server keys\nwg genkey | tee \u002Fetc\u002Fwireguard\u002Fserver_private.key | wg pubkey > \u002Fetc\u002Fwireguard\u002Fserver_public.key\nchmod 600 \u002Fetc\u002Fwireguard\u002Fserver_private.key\n\n# Generate pre-shared key (optional, adds post-quantum resistance)\nwg genpsk > \u002Fetc\u002Fwireguard\u002Fpsk.key\nchmod 600 \u002Fetc\u002Fwireguard\u002Fpsk.key\n```\n\n### Server Configuration\n\n```ini\n# \u002Fetc\u002Fwireguard\u002Fwg0.conf\n[Interface]\nAddress = 10.0.0.1\u002F24\nListenPort = 51820\nPrivateKey = \u003Cserver-private-key>\n\n# Enable IP forwarding and NAT on startup\nPostUp = sysctl -w net.ipv4.ip_forward=1\nPostUp = iptables -A FORWARD -i wg0 -j ACCEPT\nPostUp = iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE\nPostDown = iptables -D FORWARD -i wg0 -j ACCEPT\nPostDown = iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE\n\n# DNS for clients\nDNS = 10.0.0.1\n\n# Peer: Alice (laptop)\n[Peer]\nPublicKey = \u003Calice-public-key>\nPresharedKey = \u003Cpreshared-key>\nAllowedIPs = 10.0.0.2\u002F32\n\n# Peer: Bob (mobile)\n[Peer]\nPublicKey = \u003Cbob-public-key>\nPresharedKey = \u003Cpreshared-key>\nAllowedIPs = 10.0.0.3\u002F32\n\n# Peer: Office network (site-to-site)\n[Peer]\nPublicKey = \u003Coffice-public-key>\nPresharedKey = \u003Cpreshared-key>\nAllowedIPs = 10.0.0.4\u002F32, 192.168.1.0\u002F24\nEndpoint = office.example.com:51820\nPersistentKeepalive = 25\n```\n\n### Client Configuration\n\n```ini\n# Client config: alice.conf\n[Interface]\nAddress = 10.0.0.2\u002F24\nPrivateKey = \u003Calice-private-key>\nDNS = 10.0.0.1\n\n[Peer]\nPublicKey = \u003Cserver-public-key>\nPresharedKey = \u003Cpreshared-key>\nEndpoint = vpn.example.com:51820\nAllowedIPs = 0.0.0.0\u002F0, ::\u002F0\nPersistentKeepalive = 25\n```\n\n### Split Tunneling Configuration\n\n```ini\n# Client config with split tunnel (only route internal traffic through VPN)\n[Interface]\nAddress = 10.0.0.2\u002F24\nPrivateKey = \u003Calice-private-key>\n# No DNS override for split tunnel\n\n[Peer]\nPublicKey = \u003Cserver-public-key>\nPresharedKey = \u003Cpreshared-key>\nEndpoint = vpn.example.com:51820\n# Only route specific subnets through VPN\nAllowedIPs = 10.0.0.0\u002F24, 172.16.0.0\u002F16, 192.168.1.0\u002F24\nPersistentKeepalive = 25\n```\n\n### WireGuard Management Commands\n\n```bash\n# Start\u002Fstop interface\nwg-quick up wg0\nwg-quick down wg0\n\n# Enable on boot\nsystemctl enable wg-quick@wg0\n\n# Show connection status\nwg show\nwg show wg0\n\n# Add a new peer dynamically\nwg set wg0 peer \u003Cnew-public-key> allowed-ips 10.0.0.5\u002F32\n\n# Remove a peer\nwg set wg0 peer \u003Cpublic-key> remove\n\n# Show transfer statistics\nwg show wg0 transfer\n\n# Generate QR code for mobile clients\napt install -y qr-encode\nqrencode -t ansiutf8 \u003C alice-mobile.conf\n```\n\n### Peer Management Script\n\n```bash\n#!\u002Fbin\u002Fbash\n# wg-add-peer.sh - Add a new WireGuard peer\nset -euo pipefail\n\nPEER_NAME=\"${1:?Usage: $0 \u003Cpeer-name>}\"\nSERVER_CONF=\"\u002Fetc\u002Fwireguard\u002Fwg0.conf\"\nCLIENTS_DIR=\"\u002Fetc\u002Fwireguard\u002Fclients\"\nSERVER_PUBKEY=$(cat \u002Fetc\u002Fwireguard\u002Fserver_public.key)\nSERVER_ENDPOINT=\"vpn.example.com:51820\"\nPSK=$(cat \u002Fetc\u002Fwireguard\u002Fpsk.key)\n\n# Find next available IP\nLAST_IP=$(grep -oP 'AllowedIPs = 10\\.0\\.0\\.\\K[0-9]+' \"$SERVER_CONF\" | sort -n | tail -1)\nNEXT_IP=$((LAST_IP + 1))\n\nmkdir -p \"$CLIENTS_DIR\"\n\n# Generate client keys\nwg genkey | tee \"$CLIENTS_DIR\u002F${PEER_NAME}_private.key\" | wg pubkey > \"$CLIENTS_DIR\u002F${PEER_NAME}_public.key\"\nchmod 600 \"$CLIENTS_DIR\u002F${PEER_NAME}_private.key\"\n\nCLIENT_PRIVKEY=$(cat \"$CLIENTS_DIR\u002F${PEER_NAME}_private.key\")\nCLIENT_PUBKEY=$(cat \"$CLIENTS_DIR\u002F${PEER_NAME}_public.key\")\n\n# Add peer to server config\ncat >> \"$SERVER_CONF\" \u003C\u003C EOF\n\n# Peer: ${PEER_NAME}\n[Peer]\nPublicKey = ${CLIENT_PUBKEY}\nPresharedKey = ${PSK}\nAllowedIPs = 10.0.0.${NEXT_IP}\u002F32\nEOF\n\n# Generate client config\ncat > \"$CLIENTS_DIR\u002F${PEER_NAME}.conf\" \u003C\u003C EOF\n[Interface]\nAddress = 10.0.0.${NEXT_IP}\u002F24\nPrivateKey = ${CLIENT_PRIVKEY}\nDNS = 10.0.0.1\n\n[Peer]\nPublicKey = ${SERVER_PUBKEY}\nPresharedKey = ${PSK}\nEndpoint = ${SERVER_ENDPOINT}\nAllowedIPs = 0.0.0.0\u002F0, ::\u002F0\nPersistentKeepalive = 25\nEOF\n\n# Reload WireGuard\nwg syncconf wg0 \u003C(wg-quick strip wg0)\n\necho \"Peer ${PEER_NAME} added with IP 10.0.0.${NEXT_IP}\"\necho \"Client config: ${CLIENTS_DIR}\u002F${PEER_NAME}.conf\"\n```\n\n## OpenVPN\n\n### Server Setup\n\n```bash\n# Install OpenVPN and Easy-RSA\napt install -y openvpn easy-rsa\n\n# Initialize PKI\nmake-cadir \u002Fetc\u002Fopenvpn\u002Feasy-rsa\ncd \u002Fetc\u002Fopenvpn\u002Feasy-rsa\n\n.\u002Feasyrsa init-pki\n.\u002Feasyrsa build-ca nopass\n.\u002Feasyrsa gen-req server nopass\n.\u002Feasyrsa sign-req server server\n.\u002Feasyrsa gen-dh\nopenvpn --genkey secret \u002Fetc\u002Fopenvpn\u002Fta.key\n\n# Generate client certificate\n.\u002Feasyrsa gen-req client1 nopass\n.\u002Feasyrsa sign-req client client1\n```\n\n### Server Configuration\n\n```ini\n# \u002Fetc\u002Fopenvpn\u002Fserver.conf\nport 1194\nproto udp\ndev tun\n\nca \u002Fetc\u002Fopenvpn\u002Feasy-rsa\u002Fpki\u002Fca.crt\ncert \u002Fetc\u002Fopenvpn\u002Feasy-rsa\u002Fpki\u002Fissued\u002Fserver.crt\nkey \u002Fetc\u002Fopenvpn\u002Feasy-rsa\u002Fpki\u002Fprivate\u002Fserver.key\ndh \u002Fetc\u002Fopenvpn\u002Feasy-rsa\u002Fpki\u002Fdh.pem\ntls-auth \u002Fetc\u002Fopenvpn\u002Fta.key 0\n\nserver 10.8.0.0 255.255.255.0\n\n# Route client traffic through VPN\npush \"redirect-gateway def1 bypass-dhcp\"\npush \"dhcp-option DNS 8.8.8.8\"\npush \"dhcp-option DNS 8.8.4.4\"\n\n# Split tunnel: push specific routes instead\n# push \"route 172.16.0.0 255.255.0.0\"\n# push \"route 192.168.1.0 255.255.255.0\"\n\nkeepalive 10 120\n\n# Cipher and auth\ncipher AES-256-GCM\nauth SHA256\ndata-ciphers AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305\n\n# Hardening\ntls-version-min 1.2\ntls-cipher TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384\n\nuser nobody\ngroup nogroup\npersist-key\npersist-tun\n\n# Logging\nstatus \u002Fvar\u002Flog\u002Fopenvpn\u002Fstatus.log\nlog-append \u002Fvar\u002Flog\u002Fopenvpn\u002Fopenvpn.log\nverb 3\n\n# Max clients\nmax-clients 100\n\n# Client isolation (clients cannot see each other)\nclient-to-client\n```\n\n### Client Configuration\n\n```ini\n# client1.ovpn\nclient\ndev tun\nproto udp\nremote vpn.example.com 1194\nresolv-retry infinite\nnobind\npersist-key\npersist-tun\n\nca ca.crt\ncert client1.crt\nkey client1.key\ntls-auth ta.key 1\n\ncipher AES-256-GCM\nauth SHA256\n\nverb 3\n```\n\n## Tailscale (Managed WireGuard)\n\n```bash\n# Install Tailscale\ncurl -fsSL https:\u002F\u002Ftailscale.com\u002Finstall.sh -o \u002Ftmp\u002Finstall-tailscale.sh && sh \u002Ftmp\u002Finstall-tailscale.sh && rm \u002Ftmp\u002Finstall-tailscale.sh\n\n# Authenticate and connect\ntailscale up\n\n# Advertise subnet routes (act as a gateway)\ntailscale up --advertise-routes=192.168.1.0\u002F24,172.16.0.0\u002F16\n\n# Enable as exit node (route all traffic)\ntailscale up --advertise-exit-node\n\n# Use an exit node\ntailscale up --exit-node=\u003Cexit-node-ip>\n\n# Check status\ntailscale status\n\n# Access control: tailscale ACL policy (in admin console)\n# Example ACL policy\ncat \u003C\u003C 'EOF'\n{\n  \"acls\": [\n    {\"action\": \"accept\", \"src\": [\"group:engineering\"], \"dst\": [\"tag:servers:*\"]},\n    {\"action\": \"accept\", \"src\": [\"group:devops\"], \"dst\": [\"*:*\"]},\n    {\"action\": \"accept\", \"src\": [\"tag:monitoring\"], \"dst\": [\"tag:servers:9100\"]}\n  ],\n  \"tagOwners\": {\n    \"tag:servers\": [\"group:devops\"],\n    \"tag:monitoring\": [\"group:devops\"]\n  },\n  \"groups\": {\n    \"group:engineering\": [\"alice@example.com\", \"bob@example.com\"],\n    \"group:devops\": [\"charlie@example.com\"]\n  }\n}\nEOF\n\n# Enable MagicDNS and set DNS\ntailscale up --accept-dns\n\n# SSH via Tailscale (no SSH keys needed)\ntailscale up --ssh\n```\n\n## AWS Site-to-Site VPN\n\n```bash\n# Create Virtual Private Gateway\nVGW_ID=$(aws ec2 create-vpn-gateway --type ipsec.1 --query 'VpnGateway.VpnGatewayId' --output text)\n\n# Attach to VPC\naws ec2 attach-vpn-gateway --vpn-gateway-id \"$VGW_ID\" --vpc-id vpc-0abc123\n\n# Create Customer Gateway (your on-prem device)\nCGW_ID=$(aws ec2 create-customer-gateway \\\n  --type ipsec.1 \\\n  --bgp-asn 65000 \\\n  --public-ip 203.0.113.10 \\\n  --query 'CustomerGateway.CustomerGatewayId' --output text)\n\n# Create VPN connection\nVPN_ID=$(aws ec2 create-vpn-connection \\\n  --type ipsec.1 \\\n  --customer-gateway-id \"$CGW_ID\" \\\n  --vpn-gateway-id \"$VGW_ID\" \\\n  --options '{\"StaticRoutesOnly\":false}' \\\n  --query 'VpnConnection.VpnConnectionId' --output text)\n\n# Download configuration for your device\naws ec2 describe-vpn-connections --vpn-connection-ids \"$VPN_ID\"\n\n# Enable route propagation\naws ec2 enable-vgw-route-propagation \\\n  --gateway-id \"$VGW_ID\" \\\n  --route-table-id rtb-0abc123\n\n# Monitor VPN tunnel status\naws ec2 describe-vpn-connections \\\n  --vpn-connection-ids \"$VPN_ID\" \\\n  --query 'VpnConnections[0].VgwTelemetry'\n```\n\n## Troubleshooting\n\n| Problem | Cause | Solution |\n|---------|-------|----------|\n| WireGuard handshake never completes | Firewall blocking UDP 51820 | Open UDP 51820 on server firewall and any intermediate firewalls |\n| No internet through VPN | IP forwarding disabled or NAT missing | Enable `net.ipv4.ip_forward=1`; verify PostUp iptables rules |\n| DNS not resolving over VPN | DNS not pushed or local DNS conflicts | Set `DNS = ` in client config; check `\u002Fetc\u002Fresolv.conf` |\n| OpenVPN TLS handshake fails | Certificate mismatch or expired | Verify CA cert matches; check certificate dates with `openssl x509 -dates` |\n| Split tunnel leaks traffic | AllowedIPs too broad | Set only specific subnets in AllowedIPs; verify with `traceroute` |\n| Tailscale node unreachable | ACL blocking traffic | Check Tailscale admin ACL policy; verify node is online with `tailscale status` |\n| AWS VPN tunnel flapping | Idle timeout or DPD misconfigured | Enable DPD on customer gateway; send periodic keep-alive traffic |\n| Slow VPN performance | MTU issues causing fragmentation | Set `MTU = 1420` in WireGuard config; test with `ping -M do -s 1400` |\n\n## Best Practices\n\n- Use WireGuard for modern deployments (simpler, faster, smaller attack surface)\n- Implement MFA for VPN access where possible\n- Rotate keys regularly (quarterly for WireGuard, annual for OpenVPN certs)\n- Monitor VPN connections and alert on anomalies\n- Segment VPN access by role using split tunneling or ACLs\n- Use pre-shared keys with WireGuard for post-quantum resistance\n- Keep VPN software updated to patch security vulnerabilities\n- Log all VPN connection events for audit purposes\n- Disable VPN access immediately when employees leave\n- Test failover for site-to-site VPN connections\n\n## Related Skills\n\n- zero-trust (`zero-trust`) - Modern access patterns\n- ssl-tls-management (`ssl-tls-management`) - Certificate management\n- firewall-config (`firewall-config`) - Network access control\n\n## Limitations\n\n- Apply guidance only within authorized scope; test destructive steps in non-production first.\n- Docs-only import: upstream scripts and templates not bundled.\n\n### Example\n\n```bash\n# Read-only first: inventory before any active step.\nwhich \u003Ctool> && \u003Ctool> --help | head -n 20\n```\n\n> Adapted from [BagelHole\u002FDevOps-Security-Agent-Skills](https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills) (MIT); frontmatter, When to Use\u002FLimitations, and safety boundaries added for upstream compliance. Docs-only import: helper scripts and templates not bundled.\n",{"name":5,"risk":27,"source":43,"license":14,"category":22,"metadata":44,"date_added":47,"description":7,"source_repo":48,"source_type":31,"compatibility":49,"license_source":50},"https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills",{"author":45,"version":46},"devops-skills","1.0","2026-09-20","BagelHole\u002FDevOps-Security-Agent-Skills","Requires the relevant security tooling (scanners, vault CLIs) and an authorized scope for any active assessment. Docs-only; helper scripts and templates not bundled.","https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills\u002Fblob\u002Fmain\u002FLICENSE","f3312ba749561b6159f477dbfc9313c875d40a56",".agents\u002Fskills_archive\u002Fvpn-setup","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612","2026-10-25 23:50:58",{"source":8,"skillName":5,"commands":57,"prompt":67,"zipAvailable":68},[58,61,64],{"tool":59,"command":60},"npx","npx skills add duc-duy-1612\u002FOnline-Delivery-Systems-Web --skill vpn-setup",{"tool":62,"command":63},"bunx","bunx skills add duc-duy-1612\u002FOnline-Delivery-Systems-Web --skill vpn-setup",{"tool":65,"command":66},"pnpm","pnpm dlx skills add duc-duy-1612\u002FOnline-Delivery-Systems-Web --skill vpn-setup","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fvpn-setup\u002FSKILL.md",true,[],[71,90,114,139,167,191],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":82,"publishedAt":38},"01M6Q0FA5FZ410Z33Z3TFQ4DBA","zero-trust","Implement zero-trust network architecture. Configure identity-based access, micro-segmentation, and continuous verification. Use when implementing modern security architectures.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fzero-trust\u002FSKILL.md",[77],{"categoryNo":78,"categoryName":79,"taxonomyType":80,"taxonomyTypeDesc":81},"01JBSEEDCAT000000000000011","运维与部署","SCENARIO","使用场景",[83,84,85,86,30,87,73,88,36,35,34,33,31,21,29,27,26,25,24,89],"ZeRO","trust","zero trust","architecture","verification","segmentation","implementing",{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":38},"01M6Q0F1YZJW3KX5FBKEVZ8CV4","zcode-delegate","Delegate coding tasks to the Z.AI ZCode CLI only when the user explicitly requests it, while the orchestrator retains review and landing responsibility.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fzcode-delegate\u002FSKILL.md",[],[97,98,99,100,101,102,103,104,105,106,107,108,109,33,110,31,111,112,27,113],"delegate","zcode","zcode delegate","review","cli","orchestration","tasks","run","Bash","model","node","read","orchestrator","files","desktop app","app","agent-orchestration",{"skillNo":115,"name":116,"nameZh":6,"description":117,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":38},"01M6Q0ETK41VGNMYEXW0T00AJN","youtube-transcript","Fetch YouTube transcripts through DeepAPI or local fallback tooling and save clean text output.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-transcript\u002FSKILL.md",[],[121,122,123,124,125,126,127,128,129,130,131,132,133,31,21,134,135,136,137,138],"transcript","youtube transcript","youtube","safe","github","codex","research","license","https","text","fetch","tooling","clean","local","output","deepapi","youtube transcripts","blob",{"skillNo":140,"name":141,"nameZh":6,"description":142,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":143,"categories":144,"keywords":156,"publishedAt":38},"01M6Q0EPPH2PVMDW40017F8WX0","youtube-transcript-skills","Fetch YouTube video transcripts, search videos\u002Fchannels, browse channels, and extract playlists via the getyoutubetranscript.com API - free tier, no card required.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-transcript-skills\u002FSKILL.md",[145,148,151],{"categoryNo":146,"categoryName":147,"taxonomyType":80,"taxonomyTypeDesc":81},"01JBSEEDCAT000000000000010","后端与接口",{"categoryNo":149,"categoryName":150,"taxonomyType":80,"taxonomyTypeDesc":81},"01JBSEEDCAT000000000000016","图像与多媒体",{"categoryNo":152,"categoryName":153,"taxonomyType":154,"taxonomyTypeDesc":155},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[121,122,123,157,124,158,125,126,128,159,160,161,162,131,163,31,21,164,165,166],"youtube transcript skills","gemini","search","api","Video","browse","api-integration","free","card","channels",{"skillNo":168,"name":169,"nameZh":6,"description":170,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":171,"categories":172,"keywords":177,"publishedAt":38},"01M6Q0EAB96PX83W5PTE8A0R8D","youtube-notetaker","Turn YouTube talks into local study notes with slides, transcripts, editable annotations, and a markdown-backed viewer.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-notetaker\u002FSKILL.md",[173,176],{"categoryNo":174,"categoryName":175,"taxonomyType":80,"taxonomyTypeDesc":81},"01JBSEEDCAT000000000000003","演示文稿",{"categoryNo":149,"categoryName":150,"taxonomyType":80,"taxonomyTypeDesc":81},[123,178,179,101,124,180,181,182,183,128,161,184,185,186,187,21,188,134,189,190],"youtube notetaker","notetaker","workflow","official","notes","code","markdown","slides","annotations","README","study","dair-academy","viewer",{"skillNo":192,"name":193,"nameZh":6,"description":194,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":195,"categories":196,"keywords":198,"publishedAt":38},"01M6Q0E55F0GW5MX48V8HXS8B5","youtube-full","Fetch YouTube transcripts, search videos, browse channels, and extract playlists via TranscriptAPI — no yt-dlp, no Google API key, works from any cloud server.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-full\u002FSKILL.md",[197],{"categoryNo":146,"categoryName":147,"taxonomyType":80,"taxonomyTypeDesc":81},[199,123,200,201,124,158,159,202,203,160,161,162,131,204,163,31,21,164,205,137],"youtube full","full","google","server","dlp","credits","automatic"]