This project provides a simple Bash script (setup.sh
) to facilitate the setup, configuration, and management of WireGuard on Linux. The script automates the installation, uninstallation, and configuration update processes, making it easier to work with WireGuard for secure networking.
And it greatly simplifies wireguard backups
- Installation: Sets up the necessary configuration files.
- Uninstallation: Completely removes the project and related files.
- Configuration Updates: Update the WireGuard configuration.
- WireGuard must be installed on your system.
- Systemd support is required to manage the WireGuard service.
To install the script and configure WireGuard, run:
sudo bash setup.sh install
This command creates WireGuard Configuration file to /etc/laefye-wireguard/wireguard.config and create new systemd daemon laefye-wireguard
To completely remove the script and all configurations:
sudo bash setup.sh uninstall
To add new peers or update existing configurations:
sudo bash setup.sh update-config
- You need clone this repository and
wg genkey
tokeys/wg.private
and (for example)wg genkey
tokeys/user.private
- Add your user.private (uncomment) in
templates/wireguard.conf.template
sudo bash setup.sh install
sudo systemctl enable laefye-wireguard
sudo systemctl start laefye-wireguard
sudo wg
- To show public key of your server
You need generate private key to keys/
and add new peer entries to wireguard.conf.template
- keys/: Stores private keys for WireGuard peers.
- templates/: Bash template scripts
After installation, enable and start the WireGuard service:
sudo systemctl enable laefye-wireguard
sudo systemctl start laefye-wireguard
These commands ensure that WireGuard will start automatically on boot and can be managed as a standard service.
Some parameters (for example: output interface) can be easily changed in setup.sh
Feel free to submit issues or make pull requests to improve this script.
This project is licensed under the MIT License.