These scripts automate the installation and configuration of a WireGuard-based VPN setup for a network vulnerability scanner project. They include:
setup-wireguard-client.sh
)This script installs WireGuard on a remote machine, generates keys, and sets up a reverse tunnel to the scanner server using the WireGuard protocol.
Before running, edit the following values inside the script:
WG_ADDRESS
: IP address of the client in the VPN (e.g., 10.0.0.2/24
)WG_SERVER_PUBLIC_KEY
: Public key of the serverWG_SERVER_ENDPOINT
: IP and port of the server (e.g., 192.0.2.1:51820
)WG_ALLOWED_IPS
: Use 0.0.0.0/0
to tunnel all traffic through the VPNWG_IFACE
: Network interface used for NAT (e.g., enp0s3
)chmod +x setup-wireguard-client.sh
sudo ./setup-wireguard-client.sh
setup-wireguard-server-no-postup.sh
)This script installs WireGuard on the central scanning server, generates a keypair, and configures it to accept connections from clients.
Before running, edit the script:
WG_ADDRESS
: Server IP in the VPN (e.g., 10.0.0.1/32
)WG_LISTEN_PORT
: Port to listen on (e.g., 123
)WG_PEER_PUBLIC_KEY
: Public key of the clientWG_ALLOWED_IPS
: Must include the client’s tunnel IP (e.g., 10.0.0.2/32
) and any internal subnets the server needs to access through the client (e.g., 192.168.0.0/24
)chmod +x setup-wireguard-server-no-postup.sh
sudo ./setup-wireguard-server-no-postup.sh
AllowedIPs
on the server.[Peer]
block in the server’s config./etc/wireguard/
. Do not expose them publicly.wg show # Show the status of WireGuard connection
sudo wg-quick down wg0 # Bring down the VPN
sudo wg-quick up wg0 # Bring up the VPN