An open API service indexing awesome lists of open source software.

https://github.com/dantecatalfamo/wireguard-config-manager

Command line wireguard configuration manager
https://github.com/dantecatalfamo/wireguard-config-manager

cli command-line configuration-management wireguard

Last synced: 5 months ago
JSON representation

Command line wireguard configuration manager

Awesome Lists containing this project

README

        

# wireguard-config-manager
Command line wireguard configuration manager

## Demo

https://asciinema.org/a/uDC4RKB2vfSRN3YJeUjNBwKL5

## Usage
```
usage: wgcm [args]
commands:
names List just interface names
list List interfaces and some details
list Display detailed view of an interface
add Add a new interface with name and IP/subnet
peer Peer two interfaces
unpeer Remove the connection between two interfaces
route Peer two interfaces, where accepts the entire subnet from
allow Allow an IP or subnet into from
unallow Unallow an IP or subnet into from
remove Remove an interface
export Export the configuration for an interface in wg-quick format to stdout
openbsd Export the configuration for an interface in OpenBSD hostname.if format to stdout
genpsk Generate a preshared key between two interfaces
setpsk Set the preshared key between two interfaces
clearpsk Remove the preshared key between two interfaces
keepalive Set the persistent keepalive time between two interfaces
set [value] Set a value for a field on an interface
dump Export all configuration files to a directory
dump - Dump all interfaces as JSON to stdout
bash Print bash completion code to stdout
fields:
name
comment
privkey
hostname
address (ip/prefix)
port
dns
table
mtu
pre_up
post_up
pre_down
post_down
```

## JSON Output

To print JSON output instead of human-readable tables, set the environment variable `WGCM_OUTPUT=json`.

Example:
```zig
WGCM_OUTPUT=json wgcm list
```

## Dependencies

- `sqlite3`

## Building

Using the latest master build of zig
- `zig build -Doptimize=ReleaseSafe`

## Completion

To enable bash tab completion, add the following to your `.bashrc`.

```bash
eval "$(wgcm bash)"
```

## Database location

The default database is located at `~/.config/wireguard-config-manager/wgcm.db`

You can customize the location of the database using the `WGCM_DB_PATH` environment variable.