Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/coonrad/wgconfig

A simple bash script to output wireguard configurations with public and private key.
https://github.com/coonrad/wgconfig

bash configuration script vpn wiregaurd

Last synced: about 1 month ago
JSON representation

A simple bash script to output wireguard configurations with public and private key.

Awesome Lists containing this project

README

        

# wgconfig
A simple bash script to output wireguard configurations with public and private key.

```bash
[vpnuser@mypc]~$ wgconfig

Enter values for any or all fields or none to generate keypair only

Filename (example client01) =
Address (example: 10.0.0.2/30) =
ListenPort (return for dynamic endpoint) =
DNS servers separated by comma (return for none) =
PresharedKey (return for none) =
Remote peer PublicKey =
AllowedIPs (separated by comma, 0.0.0.0/0 for default) =
Endpoint (hostname or IP address) =
Endpoint listenport =

### configuration saved as wireguard.conf
```

## Configuration output template

```ini
# Name = wireguard.conf

# Configuration format is INI.
# There are two top level sections: Interface and Peer
[Interface]

# Private key generated by wg genkey
PrivateKey =

# Public key derived from private key with wg pubkey
# Provide to remote peer
# Publickey =

# Comma separated list of addresses, CIDR notation optional
# Multiple addresses allowed
Address =

# Optional 16-bit listen port
# Don't set if this peer has a dynamic IP address
# ListenPort =

# Comma separated list of addresses for DNS service
# Or hostnames to be set as search domains
# DNS =

# Manually specify MTU
# MTU = 1420

# Multiple peer configurations allowed
[Peer]

# Public key provided by remote peer
PublicKey =

# Optional preshared key generated by wg genpsk
# Adds addtional layer of cryptography for post-quantum resistance
# PresharedKey =

# Comma separated list of IPv4 or IPv6 addresses with CIDR masks
# For incoming traffic allowed and outgoing traffic directed
# Use 0.0.0.0/0 and/or ::/0 for default route
AllowedIPs =

# IP or hostname followed by colon and port number
# Don't set if remote peers have dynamic addresses
# Endpoint =

# Keepalive interval between 1 and 65535
# Useful for keeping NAT or stateful firewall connections active
# PersistentKeepalive = 25
```

## Installation and usage

Clone the repo or copy the script.

Make the script executable `chmod +x wgconfig`.

Place it somewhere in your path `~/bin` `~/.local/bin` `/usr/local/bin`.

There are no command line flags or options, just execute the script and follow the prompts.

## Requirements

- wireguard-tools
- Linux (debian based)
- `apt install wireguard-tools`
- macOS Macports and Homebrew
- `port install wireguard-tools`
- `brew install wireguard-tools`
- FreeBSD
- `pkg install wireguard-tools`

For additional operating systems: [Wireguard Installation](https://www.wireguard.com/install/)

## Further Information

- [WireGuard](https://www.wireguard.com/)
- [Unofficial WireGuard Documentation](https://github.com/pirate/wireguard-docs)