New contrib/ Utility: wg-config

Jason A. Donenfeld Jason at
Fri Dec 9 11:46:26 CET 2016

I guess. But keep in mind that wg-config is an _example_, not
something meant to be standardized. It's a tiny bash script! I'd hate
for my terrible bash script to become some kind of "standard". It's
meant mostly as inspiration for people who want to build real tools,
which is why it's in the examples directory. (I added the makefile
install target specifically for Christian, I suppose, since he seems
to have some wild ideas of his own...)

But here, I added CONFIG_FILE_CONTENTS, so you don't need an extra
file. What a hack. But it actually works pretty cleanly.


       PrivateKey = 6JiA3fa+NG+x5m6aq7+lxlVaVqVf1mxK6/pDOZdNuXc=

       PublicKey = 6NagfTu+s8+TkEKpxX7pNjJuTf4zYtoJme7iQFYIw0A=
       AllowedIPs =
       Endpoint =

       ADDRESSES=( )

       post_add() {
               printf 'nameserver' | cmd resolvconf -a
       post_del() {
               cmd resolvconf -d "$INTERFACE"

Run to flip on the VPN:
# wg-config add wgvpn0 --env-file=/etc/wireguard/wg-vpn-gateway.env
Run to flip off the VPN:
# wg-config del wgvpn0 --env-file=/etc/wireguard/wg-vpn-gateway.env

More information about the WireGuard mailing list