wget https://go.dev/dl/go1.21.1.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.21.1.linux-amd64.tar.gz
sudo rm -rf go1.21.1.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
grep -qxF 'export PATH=$PATH:/usr/local/go/bin' /etc/profile || sudo sed -i '$aexport PATH=$PATH:/usr/local/go/bin' /etc/profile
git clone git@github.com:pearsonc/pvs.git /tmp/pvs-build
sudo apt install gcc dpkg-dev gpg -y
This will build the pvs binary and package it into a deb file in the bin directory
cd /tmp/pvs-build
make build
sudo apt clean && sudo apt update && sudo apt upgrade -y \
&& sudo apt dist-upgrade -y && sudo apt autoremove -y \
&& sudo apt install curl vim htop net-tools -y
Edit the network configuration file using a text editor, the yaml filename may differ just ensure there is only one file in the directory. It is important to note that your private network should have no dns or routes configured as it is a private network and the gateway will handle the routing.
sudo vi /etc/netplan/01-network-manager-all.yaml
Update the below config to meet your requirements
network:
ethernets:
eth0:
addresses:
- 192.168.0.11/24
nameservers:
addresses:
- 1.1.1.1
- 1.0.0.1
search: []
routes:
- to: default
via: 192.168.0.1
eth1:
dhcp4: no
addresses:
- 192.168.1.2/24
version: 2
Apply the changes
sudo netplan apply
Enable IP forwarding to allow gateway functionality and then make it persist after reboot.
sudo sysctl -w net.ipv4.ip_forward=1
echo "net.ipv4.ip_forward = 1" | sudo tee -a /etc/sysctl.conf
sudo dpkg -i -f /tmp/pvs-build/bin/pvs_0.0.1_amd64.deb
sudo echo "vpnusername" | sudo tee /config/openvpn-credentials.txt
sudo echo "vpnpassword" | sudo tee -a /config/openvpn-credentials.txt
Remove the last commands from the bash history to prevent the password from being stored in the bash history file
for i in {1..2}; do history -d $(($HISTCMD-1)); done
sudo systemctl daemon-reload
sudo systemctl enable pvs.service
sudo systemctl start pvs.service
tail -f /var/log/pvs.log