Get / Set WireGuard Peer
I'm trying to set the WireGuard peer, with uci I would do something like this:
# Add VPN peers
uci -q delete network.wgclient
uci set network.wgclient="wireguard_${VPN_IF}"
uci set network.wgclient.public_key="${VPN_PUB}"
uci set network.wgclient.preshared_key="${VPN_PSK}"
uci add_list network.wgclient.allowed_ips="${VPN_ADDR%.*}.2/32"
uci add_list network.wgclient.allowed_ips="${VPN_ADDR6%:*}:2/128"
uci commit network
/etc/init.d/network restart
Source: https://openwrt.org/docs/guide-user/services/vpn/wireguard/server#network
My config looks like this:
config interface 'my_wg'
option proto 'wireguard'
option force_link '1'
option mtu '1340'
option private_key 'asdfghjkl1234567890ß54321sdf'
list addresses '1.2.3.4/32'
config wireguard_my_wg
list allowed_ips '0.0.0.0/0'
option route_allowed_ips '1'
option endpoint_port '51820'
option persistent_keepalive '25'
option public_key 'sfdghjkuztrw3q2456786543wqertzu'
option endpoint_host '11.12.13.14'
u.get("network")
gives me:
{
"loopback": {
"device": "lo",
"proto": "static",
"ipaddr": "127.0.0.1",
"netmask": "255.0.0.0"
}
},
{
"my_wg": {
"proto": "wireguard",
"force_link": "1",
"mtu": "1380",
"private_key": "asdfghjkl1234567890ß54321sdf",
"addresses": "1.2.3.4/32"
}
},
{
"cfg0c8225": {
"allowed_ips": "0.0.0.0/0"
"route_allowed_ips": "1",
"endpoint_port": "51820",
"persistent_keepalive": "25",
"public_key": "sfdghjkuztrw3q2456786543wqertzu",
"endpoint_host": "11.12.13.14"
}
}
u.get("network", "wireguard_my_wg")
returns uci.UciExceptionNotFound
Is there a way to get
and set
WireGuard peers?