Martineau
Part of the Furniture
wg_manager
Beta v4.08 available on Github dev branch
The new beta no longer uses the single clunky typo-prone Policy rules definition entry, instead the RPDB rules are managed in a more human-friendly manner (in lieu of the pending GUI)
However, the old Policy database table needs to be discarded and one conforming to the new layout created.
Unfortunately there is no auto-migration of the old-style entries, so print the current definition for each policy Peer, as you will need to manually reenter them. - sorry
To update
Code:
e = Exit Script [?]
E:Option ==> uf dev
Delete the old style 'policy' database table by entering the two commands
drop table policy;
and .quit
at the sqlite>
prompt
Code:
e = Exit Script [?]
E:Option ==> diag sqlX
Use command 'diag sql [ table_name ]' to see the SQL data (might be many lines!)
Valid SQL Database tables: clients devices fwmark ipset policy servers session traffic
e.g. diag sql traffic will show the traffic stats SQL table
DEBUG: Interactive SQL '/opt/etc/wireguard.d/WireGuard.db'
Tables: clients devices fwmark ipset policy servers session traffic
SQLite version 3.33.0 2020-08-14 13:23:32
Enter ".help" for usage hints.
sqlite> drop table policy;
sqlite> .quit
WireGuard ACTIVE Peer Status: Clients 0, Servers 0
Now keep all of the other existing database tables and data but recreate the empty Policy RPDB database table.
Code:
e = Exit Script [?]
E:Option ==> initdb keep
No Peer entries to auto-migrate from '/jffs/addons/wireguard/WireguardVPN.conf', but you will need to manually import the 'device' Peer '*.conf' files:
<snip>
Error: near line 1: table servers already exists <<== These errors are expected but assist in confirmation of the 'initdb' actions i.e NO Line 4 error!
Error: near line 2: table clients already exists
Error: near line 3: table devices already exists
Error: near line 5: table fwmark already exists
Error: near line 6: table ipset already exists
Error: near line 7: table traffic already exists
Error: near line 8: table session already exists
WireGuard ACTIVE Peer Status: Clients 0, Servers 0
Code:
e = Exit Script [?]
E:Option ==> diag sql policy
DEBUG: SQL '/opt/etc/wireguard.d/WireGuard.db'
Table:policy
Now enter your Policy RPDB rules per Peer (see example at the bottom of this post) - one rule per line (unlike previously where it was a single line containing multiple cryptic unreadable rules)
There are examples shown by
Code:
e = Exit Script [?]
E:Option ==> peer help
peer help - This text
<snip>
peer peer_name {rule [del {id_num} |add [wan] rule_def]} - Manage Policy rules e.g. peer wg13 rule add 172.16.1.0/24 comment All LAN
peer wg13 rule add wan 52.97.133.162 comment smtp.office365.com
peer wg13 rule add wan 172.16.1.100 9.9.9.9 comment Quad9 DNS
Last edited: