Simply download the installer from Releases and run it! Follow the prompts to complete installation.
You must have the following packages installed on your system:
sudo apt install -y wireguard stunnel4 haproxy certbot
git clone https://github.com/redisnotbluedev/potatovpn
cd potatovpn/server
cp .env.example .env
nano .env
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Match User block to /etc/ssh/sshd_config:
Match User vpn_*
ForceCommand /bin/false
AllowTcpForwarding yes
X11Forwarding no
AllowAgentForwarding no
PermitTTY no
sudo systemctl restart sshd
wg genkey | sudo tee /etc/wireguard/server_private.key | wg pubkey | sudo tee /etc/wireguard/server_public.key && sudo chmod 600 /etc/wireguard/server_private.key
/etc/wireguard/wg.conf:
[Interface]
PrivateKey = <contents of /etc/wireguard/server_private.key>
Address = 10.0.0.1/24
ListenPort = 51820
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
sudo systemctl enable --now wg-quick@wg
echo 'net.ipv4.ip_forward=1' | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
sudo certbot certonly --standalone -d <your domain>
sudo openssl req -x509 -newkey rsa:4096 -keyout /etc/stunnel/potatovpn.key -out /etc/stunnel/potatovpn.pem -days 3650 -nodes -subj "/CN=potatovpn"
/etc/stunnel/potatovpn.conf:
```ini
foreground = yes[wg] accept = 127.0.0.1:51821 connect = 127.0.0.1:51820 cert = /etc/stunnel/potatovpn.pem key = /etc/stunnel/potatovpn.key
[ssh] accept = 127.0.0.1:2223 connect = 127.0.0.1:22 cert = /etc/stunnel/potatovpn.pem key = /etc/stunnel/potatovpn.key
[api]
accept = 127.0.0.1:8889
connect = 127.0.0.1:8888
cert = /etc/letsencrypt/live/
```sh
sudo systemctl enable --now stunnel@potatovpn
/etc/haproxy/haproxy.cfg:
```
defaults
timeout connect 5s
timeout client 30s
timeout server 30sfrontend tls
bind *:443
mode tcp
tcp-request inspect-delay 5s
tcp-request content accept if { req_ssl_hello_type 1 }
use_backend wg if { req_ssl_sni -i
backend wg mode tcp server wg 127.0.0.1:51821
backend ssh mode tcp server ssh 127.0.0.1:2223
backend web mode tcp server api 127.0.0.1:8889
```sh
sudo systemctl enable --now haproxy
/etc/systemd/system/potatovpn-api.service: (optional)
```ini
[Unit]
Description=PotatoVPN API
After=network.target[Service]
WorkingDirectory=/home/
[Install] WantedBy=multi-user.target
```sh
sudo systemctl daemon-reload
sudo systemctl enable --now potatovpn-api