wg2uci uses a wg-quick (WireGuard) configuration file to generate a shell script that configures a WireGuard interface and its peers through uci.
Download wg2uci:
curl -O https://raw.githubusercontent.com/achianumba/wg2uci/main/wg2uciMake wg2uci executable:
chmod +x wg2uciGenerate a UCI interface/network script:
./wg2uci </path/to/interface0.conf>Configure a WireGuard interface/network using the generated script
./config-<INTERFACE>.sh-z | --zone: Zone name.wanis the default zone but you may set it tolanor a custom zone.i | --zone-input: The firewall zone's INPUT chain's policy. Default isACCEPT.f | --zone-forward: The firewall zone's FORWARD chain's policy. Default isACCEPT.-o | --zone-output: The firewall zone's OUTPUT chain's policy. Default isACCEPT.-m | --zone-masq: The firewall zone's masquerading. Default is0(disabled).1is enabled.
wg2uci treats the below comments in a *.conf file as config fields instead of comments:
-
# InterfaceName: A valid UNIX interface name placed above the[Interface]header. The*.conffile's name is set as the interface's name in the absence of theInterfaceNamecomment.Example
# InterfaceName = wg0 [Interface]
-
# Description: A one-word description of a peer placed above a[Peer]header.Example
# Description = GitHubCDNs [Peer]
- Doesn't parse
PostUpandPostDowndirectives. - Doesn't handle multiple AllowedIPs when written on multiple lines (yet) instead of as a comma-separated list.
- Set wan, lan, custom firewall zone using the
-z | --zoneoption. - Configure forwarding to LAN.
- Open WireGuard interface's port.