Skip to content

How to get and Setup a Reverse Proxy with DDOS Protections for Free on A Static or Dynamic DNS

DevilsCoder edited this page Feb 24, 2023 · 3 revisions

How to get and Setup a Reverse Proxy with DDOS Protections for Free on A Static/Dynamic DNS

IMPORTANT NOTE:

THIS IS NOT FOR BEGINNERS. I AM GOING TO TRY TO EXPLAIN THE PROCESS AS BEST AS I CAN BUT THIS IS PRETTY IN DEPTH PROCESS.

Video

How to Get and Setup Free Static IP on a Dynamic DNS for Reverse Proxying with DDOS Protection

How to get and Setupa Reverse Proxy with DDOS Protections for Free on A Static/Dynamic DNS

How to use the Oracle Cloud free offer and create an Ubuntu Cloud VPS PC on Oracle Cloud using xRDP

How to use the Oracle Cloud free offer and create an Ubuntu Cloud VPS PC on Oracle Cloud using xRDP

Links:

Oracle Free Tier Setup Video

NOIP CREATE AN ACCOUNT

Caddy Download

Caddy.service

Wireguard Configs

Windows Wireguard Config

[Interface]
PrivateKey = [Your Winodws Made Priavte Key]
ListenPort = 49312
Address = 10.254.0.1/24

[Peer]
PublicKey = [YOUR-ORACLE-VPS-KEY]
AllowedIPs = 10.254.0.2/24
Endpoint = [ORACLE-VPS-IP]:49312

VPS Wireguard Config

[Interface]
PrivateKey = [private key for vps]
Address = 10.254.0.2/24
ListenPort = 49312
SaveConfig = true
PostUp = iptables -t nat -I POSTROUTING -o enp0s3 -j MASQUERADE
PreDown = ufw route delete allow in on wg0 out on enp0s3
PreDown = iptables -t nat -D POSTROUTING -o enp0s3 -j MASQUERADE
[Peer]
PublicKey = [pubkey for windows machine]
AllowedIPs = 10.254.0.1/32
Endpoint =   [external home internet ip]:49312
PersistentKeepalive = 25

Installation of Wireguard on VPS

  1. Installation of Wireguard

sudo apt install wireguard

  1. Get Your VPS's Wireguard Private Key

wg genkey | sudo tee /etc/wireguard/private.key

  1. Make the private key executable

sudo chmod go= /etc/wireguard/private.key

  1. Grab your VPS's Public key to input inside your windows wireguard

sudo cat /etc/wireguard/private.key | wg pubkey | sudo tee /etc/wireguard/public.key

  1. Once you have setup Windows Wireguard Config and your Ubuntu Wireguard config run the start command for wireguard in your VPS

wg-quick up {interface name}

ie. wg-quick up wg0

If you mess up your config you can delete and re-do the above command

Delete the wireguard adapter (this will just delete the your original wireguard interface adapter in your network adapters they can always be re-added)

Command to Delete wireguard interface: sudo ip link delete {interface name}

IE.

sudo ip link delete wg0

Caddy Setup

  1. Download Caddy

Caddy Download

  1. Move Caddy Once Downloaded to user bin

sudo mv caddy /usr/bin/

  1. Change the Permissions to Read and Write for Caddy Binary

sudo chmod +x /usr/bin/caddy

  1. Check to make sure caddy can run

caddy version

  1. Create a group named caddy:

sudo groupadd --system caddy

  1. Create a user named caddy with a writeable home directory:
sudo useradd --system \
    --gid caddy \
    --create-home \
    --home-dir /var/lib/caddy \
    --shell /usr/sbin/nologin \
    --comment "Caddy web server" \
    caddy
  1. Make or Edit your Caddyfile

sudo nano /etc/caddy/Caddyfile

  1. Add the config from Wiki Examples here

  2. Reload all Service Scripts

sudo systemctl daemon-reload

  1. Enable Caddy Service

sudo systemctl enable --now caddy

  1. Check to see if its Running

systemctl status caddy

  1. Check the Logs of Caddy

journalctl -u caddy --no-pager | less +G

  1. If your edit your Caddyfile reload the Caddy binary by using

sudo systemctl reload caddy

or just restart it by

sudo systemctl restart caddy