116 lines
3.3 KiB
Markdown
116 lines
3.3 KiB
Markdown
# wg bootstrap
|
|
|
|
```sh
|
|
█░█░█ █▀▀ ▄▄ █▀ ▀█▀ ▄▀█ █▀█ ▀█▀
|
|
▀▄▀▄▀ █▄█ ░░ ▄█ ░█░ █▀█ █▀▄ ░█░
|
|
```
|
|
|
|
### [Russian lang: README.md](README-ru.md)
|
|
|
|
# Utility wrapper for wg-quick
|
|
|
|
Provides a convenient command line interface for quick creation
|
|
configuration file of the WireGuard interface without having to manually
|
|
edit it with a text editor. Also can be used for
|
|
interface creation and removal
|
|
|
|
|
|
## Features
|
|
|
|
- Automatic check of user permissions to run commands
|
|
- Create interface configuration file interactively
|
|
- Change AllowedIPs on the fly
|
|
- Adding AllowedIPs to already created ones
|
|
- Automatic placement of the configuration file in /etc/wireguard
|
|
- Reading information in the configuration file
|
|
- Initializing various configuration files and running them by name
|
|
- Delete configuration file
|
|
- Enable and disable the interface with the same keys as wg-quick
|
|
|
|
## Install and update
|
|
|
|
### Dependencies
|
|
- GNU/Linux
|
|
- python3, preferably ^3.8.1
|
|
- wireguard or wireguard-tools
|
|
- wget to download the executable
|
|
|
|
### Installation
|
|
- Download the latest version from the main branch to a local directory in $PATH
|
|
```sh
|
|
sudo wget https://git.isptech.ru/ISPsystem/wg-bootstrap/raw/branch/main/wg_bootstrap/wg_start.py -O /usr/local/bin/wg-start && sudo chmod 775 /usr/local/bin/wg-start
|
|
```
|
|
> Don't use sudo if the user owns a local directory like ~/.local/bin
|
|
>
|
|
> If necessary, change the standard path /usr/local/bin/wg-start in the two places in the command above to the one you need.
|
|
>
|
|
> The command above will add the execution flag to the wg-start command automatically
|
|
|
|
### Update
|
|
- Download again
|
|
> The link always leads to the latest stable version.
|
|
>
|
|
> After the 0.1.0 tag, the main branch only contains the stable release
|
|
|
|
## Usage
|
|
|
|
### Reference
|
|
```sh
|
|
usage: wg-start [-h] [-v] {init,cat,rm,add,replace,up,down} interface [allowedIPs]
|
|
|
|
CRUD WireGuard config file or UP/DOWN wg-interface
|
|
|
|
positional arguments:
|
|
{init,cat,rm,add,replace,up,down}
|
|
Action with interface
|
|
interface WG interface name (wg0, wg1, wgName etc...)
|
|
allowedIPs Set AllowedIPs must be a string
|
|
|
|
options:
|
|
-h, --help show this help message and exit
|
|
-v, --version show program's version number and exit
|
|
```
|
|
|
|
### Examples
|
|
- Initialization of the configuration file of the new wg0 interface:
|
|
```sh
|
|
wg-start init wg0
|
|
```
|
|
- Initialization (enabling) of wg0 interface
|
|
```sh
|
|
wg-start up wg0
|
|
```
|
|
- Removing (disabling) the wg0 interface
|
|
```sh
|
|
wg-start up wg0
|
|
```
|
|
- Read wg0 interface configuration file
|
|
```sh
|
|
wg-start cat wg0
|
|
```
|
|
- Delete wg0 interface configuration file
|
|
```sh
|
|
wg-start rm wg0
|
|
```
|
|
- Replace AllowedIPS with 0.0.0.0/24 in wg0 interface config file
|
|
```sh
|
|
wg-start replace wg0 0.0.0.0/24
|
|
```
|
|
|
|
- Add to AllowedIPS 172.10.10.0/24 in wg0 interface config file
|
|
```sh
|
|
wg-start add wg0 172.10.10.0/24
|
|
```
|
|
- Add multiple IPs to AllowedIPS in wg0 interface config file
|
|
```sh
|
|
wg-start add wg0 "172.10.11.0/24, 10.10.10.1/24, 192.168.1.1"
|
|
```
|
|
> Interface name can be anything wg0 this is just an example, you can give the interface a meaningful name
|
|
>
|
|
> You can add any number of interfaces, if such an interface was already present, it will be overwritten!
|
|
|
|
### Have fun friend and thanks for reading to the end
|
|
|
|
## License
|
|
|
|
GNU GPL 3.0 |