User Tools
databaseandnetworkmanagement:open_vpn_install_18
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| databaseandnetworkmanagement:open_vpn_install_18 [2018/12/20 18:56] – wlee | databaseandnetworkmanagement:open_vpn_install_18 [2021/06/25 10:09] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ===== Before Your Start ===== | ||
| + | If you are looking for adding user (or yourself) to OpenVPN for support purposes, check out [[support: | ||
| + | |||
| + | ===== Ubuntu 18.04 Open VPN Full installation as performed on on CA Server (AWS Northern California: Errigal CA - DO NOT DELETE) and Open VPN Server (olympus.err) ===== | ||
| + | * Quick instructions on making new client certificate configurations are towards the bottom | ||
| + | |||
| + | This article explains how to install Open VPN on Ubuntu 18.04. The steps followed came from this Tutorial: | ||
| + | * https:// | ||
| + | ------------------------------------- | ||
| + | |||
| + | ==== CA Machine (AWS Northern California: Errigal CA - DO NOT DELETE) ==== | ||
| + | * START THE AWS INSTANCE | ||
| + | * sudo apt update | ||
| + | * sudo apt install openvpn | ||
| + | * wget -P ~/ https:// | ||
| + | * cd ~ | ||
| + | * tar xvf EasyRSA-3.0.4.tgz | ||
| + | * cd ~/ | ||
| + | * cp vars.example vars | ||
| + | * vi vars | ||
| + | * [EDIT EASYRSA_REQ_ properties accordingly] | ||
| + | * ./easyrsa init-pki | ||
| + | * ./easyrsa build-ca nopass | ||
| + | ------------------------------------- | ||
| + | ==== OpenVPN Server Machine (olympus) ==== | ||
| + | |||
| + | * sudo apt update | ||
| + | * sudo apt install openvpn | ||
| + | * wget -P ~/ https:// | ||
| + | * cd ~/ | ||
| + | * ./easyrsa init-pki | ||
| + | * ./easyrsa gen-req server nopass | ||
| + | * sudo cp ~/ | ||
| + | * scp -i ~/pge2.pem ~/ | ||
| + | ------------------------------------- | ||
| + | ==== CA Machine (AWS Northern California: Errigal CA - DO NOT DELETE) ==== | ||
| + | |||
| + | * cd ~/ | ||
| + | * ./easyrsa import-req / | ||
| + | * [TYPE yes WHEN PROMPTED] | ||
| + | |||
| + | ------------------------------------- | ||
| + | |||
| + | ==== OpenVPN Server Machine (olympus) ==== | ||
| + | * scp -i ~/pge2.pem ubuntu@10.91.200.205:/ | ||
| + | * scp -i ~/pge2.pem ubuntu@10.91.200.205:/ | ||
| + | * sudo cp / | ||
| + | * cd EasyRSA-3.0.4/ | ||
| + | * ./easyrsa gen-dh | ||
| + | * openvpn --genkey --secret ta.key | ||
| + | * sudo cp ~/ | ||
| + | * sudo cp ~/ | ||
| + | ------------------------------------- | ||
| + | ==== CLIENT KEY GEN on server (olympus) ==== | ||
| + | |||
| + | * mkdir -p ~/ | ||
| + | * chmod -R 700 ~/ | ||
| + | * cd ~/ | ||
| + | * ./easyrsa gen-req client1 nopass | ||
| + | * cp pki/ | ||
| + | * scp -i ~/pge2.pem pki/ | ||
| + | ------------------------------------- | ||
| + | ==== CA Machine (AWS Northern California: Errigal CA - DO NOT DELETE) ==== | ||
| + | |||
| + | * cd EasyRSA-3.0.4/ | ||
| + | * ./easyrsa import-req / | ||
| + | * ./easyrsa sign-req client client1 | ||
| + | ------------------------------------- | ||
| + | ==== OpenVPN Server Machine (olympus) ==== | ||
| + | |||
| + | * scp -i ~/pge2.pem ubuntu@10.91.200.205:/ | ||
| + | * cp / | ||
| + | * cp ~/ | ||
| + | * sudo cp / | ||
| + | ------------------------------------- | ||
| + | ==== Configure OpenVPN Server (olympus) ==== | ||
| + | |||
| + | * sudo cp / | ||
| + | * sudo gzip -d / | ||
| + | * sudo vi / | ||
| + | * [Add " | ||
| + | * [Add "auth SHA256" | ||
| + | * [Change "dh dh2048.pem" | ||
| + | * [Uncomment "user nobody" | ||
| + | * [NOTE: | ||
| + | * sudo vi / | ||
| + | * [Uncomment " | ||
| + | * [Uncomment "push " | ||
| + | * [Uncomment "push " | ||
| + | * ip router | grep default | ||
| + | * [Locate the interface name, i.e. enp7s0, and copy it] | ||
| + | * sudo vi / | ||
| + | * [Add the following lines: | ||
| + | < | ||
| + | # START OPENVPN RULES | ||
| + | # NAT table rules | ||
| + | *nat | ||
| + | : | ||
| + | # Allow traffic from OpenVPN client to enp7s0 (change to the interface you discovered!) | ||
| + | -A POSTROUTING -s 10.8.0.0/8 -o enp7s0 -j MASQUERADE | ||
| + | COMMIT | ||
| + | # END OPENVPN RULES | ||
| + | </ | ||
| + | * sudo vi / | ||
| + | * [Change DEFAULT_FORWARD_POLICY value from " | ||
| + | * sudo ufw allow 1194/udp | ||
| + | * sudo ufw allow OpenSSH | ||
| + | * sudo ufw disable | ||
| + | * sudo ufw enable | ||
| + | * sudo systemctl start openvpn@server | ||
| + | * sudo systemctl status openvpn@server | ||
| + | * [Output should show ' | ||
| + | * sudo systemctl enable openvpn@server | ||
| + | * mkdir -p ~/ | ||
| + | * cp / | ||
| + | * vi ~/ | ||
| + | * [Update line " | ||
| + | * [Make sure "proto udp" is uncommented and that "proto tcp" is commented witht he ';' | ||
| + | * [Comment with '#' | ||
| + | * [Comment with '#' | ||
| + | * [Under line " | ||
| + | * [Add " | ||
| + | * [Add the following commented out lines: | ||
| + | < | ||
| + | # script-security 2 | ||
| + | # up / | ||
| + | # down / | ||
| + | </ | ||
| + | * vi ~/ | ||
| + | * Insert the following content: | ||
| + | < | ||
| + | #!/bin/bash | ||
| + | |||
| + | # First argument: Client identifier | ||
| + | |||
| + | KEY_DIR=~/ | ||
| + | OUTPUT_DIR=~/ | ||
| + | BASE_CONFIG=~/ | ||
| + | |||
| + | cat ${BASE_CONFIG} \ | ||
| + | <(echo -e '< | ||
| + | ${KEY_DIR}/ | ||
| + | <(echo -e '</ | ||
| + | ${KEY_DIR}/ | ||
| + | <(echo -e '</ | ||
| + | ${KEY_DIR}/ | ||
| + | <(echo -e '</ | ||
| + | ${KEY_DIR}/ | ||
| + | <(echo -e '</ | ||
| + | > ${OUTPUT_DIR}/ | ||
| + | </ | ||
| + | * chmod 700 ~/ | ||
| + | ------------------------------------- | ||
| + | |||
| + | ==== Generate Client Configuration on OpenVPN Server (olympus) ==== | ||
| + | |||
| + | * cd ~/ | ||
| + | * sudo ./ | ||
| + | ------------------------------------- | ||
| + | ==== Your Client (i.e. your macbook) ==== | ||
| + | |||
| + | * sftp scotty@olympus.err: | ||
| + | * INSTALL Tunnelblick: | ||
| + | * [Say you have no configuration files] | ||
| + | * [When install is complete, open a Finder window and double-click ~/ | ||
| + | * In Tunnelblick, | ||
| + | * If prompted to ' | ||
| + | * Manually update your System Prefences -> Network -> Settings to include OpenDNS and Errigal DNS: | ||
| + | * 10.91.100.71 | ||
| + | * 208.67.222.222 | ||
| + | * 208.67.220.220 | ||
| + | ------------------------------------- | ||
| + | ===== GENERATING NEW CLIENT CONFIGS (Quick) ===== | ||
| + | |||
| + | > Visit OpenVPN Server Machine (olympus.err) | ||
| + | |||
| + | * cd ~/ | ||
| + | * ./easyrsa gen-req CONFIG_NAME nopass | ||
| + | * cp pki/ | ||
| + | * scp -i ~/pge2.pem pki/ | ||
| + | |||
| + | > Visit CA Machine (AWS Northern California: Errigal CA - DO NOT DELETE) | ||
| + | |||
| + | * cd EasyRSA-3.0.4/ | ||
| + | * ./easyrsa import-req / | ||
| + | * ./easyrsa sign-req client CONFIG_NAME | ||
| + | |||
| + | |||
| + | > Visit OpenVPN Server Machine (olympus.err) | ||
| + | |||
| + | * scp -i ~/pge2.pem ubuntu@10.91.200.205:/ | ||
| + | * cp / | ||
| + | * cd ~/ | ||
| + | * sudo ./ | ||
| + | * [Config File is ~/ | ||
| + | |||
| + | > MAKE SURE YOU STOP THE AWS Nothern California: Errigal CA - DO NOT DELETE instance | ||
| + | |||
| + | --------------------------------------- | ||
| + | |||
| + | ===== START/STOP OpenVPN Server ===== | ||
| + | > Visit OpenVPN Server Machine (olympus.err) | ||
| + | |||
| + | * sudo systemctl stop openvpn@server | ||
| + | * sudo systemctl start openvpn@server | ||
| + | * sudo systemctl enable openvpn@server | ||
| + | * sudo systemctl status openvpn@server | ||