OpenVPN

来自Gea-Suan Lin's Wiki
跳转至: 导航搜索

OpenVPN是個VPN軟體。

安裝

sudo apt install -y libpam-pwdfile openvpn

設定

  • 先產生SSL相關的設定:
sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
  • 依照Dehydrated或是其他方式產生出合法的憑證。
  • /etc/openvpn/server.conf內放:
#
port 1194
proto udp
dev tun
ca /etc/ssl/certs/ca-certificates.crt
cert /etc/dehydrated/certs/vpn.example.com/fullchain.pem
key /etc/dehydrated/certs/vpn.example.com/privkey.pem
dh /etc/ssl/certs/dhparam.pem
server 192.168.254.0 255.255.255.0
server-ipv6 fda9:4efe:7e3b:03ea::/64
push "dhcp-option DNS 1.1.1.1"
push "dhcp-option DNS 1.0.0.1"
user nobody
group nogroup
persist-key
persist-tun
client-cert-not-required
plugin /usr/lib/openvpn/openvpn-plugin-auth-pam.so openvpn
status /var/log/openvpn-status.log
verb 4
  • /etc/pam.d/openvpn設定使用/etc/openvpn/passwd當作認證來源:
#
auth            required        pam_pwdfile.so pwdfile=/etc/openvpn/passwd
auth            required        pam_permit.so
account         required        pam_permit.so
session         required        pam_permit.so
password        required        pam_deny.so

外部連結