Skip to content

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

License

Notifications You must be signed in to change notification settings

coonrad/wgconfig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

wgconfig

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

[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

# 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

Further Information

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages