Hi,
thanx for asking, I forgot to tell.
I tried both ways.
After analysing the script,
I think I did find the part in the script where firewall zone "vpn" is defined,
same lines where the script seems not to work
uci del_list firewall.vpn.network="wg_s2s_b"
uci add_list firewall.vpn.network="wg_s2s_b"
I am missing the part in script where the WG Interface is attached to "vpn" and
where the forwarding rules reagrding "vpn" are defined.
But I must confess I am not a good script reader at all.
So i tried to define vpn firwall zones myself before running the script.
Both ways did not work.
Now reading your question I also tried to send the uci commands manually via putty to the router:
root@szne_nighthawk1_rumpel_195:~# uci del_list firewall.vpn.network="wg_s2s_amo
psz"
uci: Invalid argument
root@szne_nighthawk1_rumpel_195:~# uci add_list firewall.vpn.network="wg_s2s_amo
psz"
uci: Invalid argument
root@szne_nighthawk1_rumpel_195:
also not working. on an openWrt 23.05 / R7800
Firwall zone "vpn" does exist on this router
Currently I think this script does not run on my config,
and I am still missing the parts where WG Interface is attached to Firwall "vpn" Zone and forwarding rules vpn-lan are defined.
This is the whole script for one site:
#!/bin/sh
clear
echo ======================================
echo "| Automated WireGuard Script |"
echo "| Site-to-Site VPN |"
echo "| Configuration |"
echo ======================================
echo Generated to configure "m.hopto.org" to tunnel with "e.diskstation.me"
echo -n Creating firewall rule for WAN ingress...
uci del_list firewall.vpn.network="wg_s2s_amopsz"
uci add_list firewall.vpn.network="wg_s2s_amopsz"
uci -q delete firewall.wg_s2s_51823
uci set firewall.wg_s2s_51823="rule"
uci set firewall.wg_s2s_51823.name="Allow-WireGuard-51823"
uci set firewall.wg_s2s_51823.src="wan"
uci set firewall.wg_s2s_51823.dest_port="51823"
uci set firewall.wg_s2s_51823.proto="udp"
uci set firewall.wg_s2s_51823.target="ACCEPT"
uci commit firewall
service firewall restart
echo Done
echo -n Configure wireguard interface "wg_s2s_amopsz"...
uci -q delete network.wg_s2s_amopsz
uci set network.wg_s2s_amopsz="interface"
uci set network.wg_s2s_amopsz.proto="wireguard"
uci set network.wg_s2s_amopsz.private_key="OBRE="
uci set network.wg_s2s_amopsz.listen_port="51823"
echo Done
echo -n Configure peer "Site B, e.diskstation.me"...
uci -q delete network.s2s_vpn_site_bmopsz
uci set network.s2s_vpn_site_bmopsz="wireguard_wg_s2s_amopsz"
uci set network.s2s_vpn_site_bmopsz.public_key="6TRg="
uci set network.s2s_vpn_site_bmopsz.preshared_key="4sxx="
uci set network.s2s_vpn_site_bmopsz.description="Site B, e.diskstation.me"
uci add_list network.s2s_vpn_site_bmopsz.allowed_ips="192.168.112.0/24"
uci add_list network.s2s_vpn_site_bmopsz.allowed_ips="fdee:eeee:efff::/48"
uci set network.s2s_vpn_site_bmopsz.route_allowed_ips='1'
uci set network.s2s_vpn_site_bmopsz.persistent_keepalive='25'
uci set network.s2s_vpn_site_bmopsz.endpoint_host="e.diskstation.me"
uci set network.s2s_vpn_site_bmopsz.endpoint_port="51823"
uci commit network
service network restart
echo Done
echo ======================================
echo "| Next steps |"
echo ======================================
echo Remove this script: "$0"
echo It contains copies of your secret keys that
echo you do not need anymore, because they are now in the network
echo configuration files. Delete the script to avoid key theft.
and finally, this is my current WORKING configuration, after I did define firewall zone manually und added forwarding rules. I think this config should be the goal of the site2site script, more or less:
Firewall
root@szne_nighthawk1_rumpel_195:~# cat /etc/config/firewall
config defaults
option input 'ACCEPT'
option output 'ACCEPT'
option synflood_protect '1'
option forward 'REJECT'
config zone
option name 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option masq '1'
option forward 'ACCEPT'
list network 'lan'
config zone 'guest'
option name 'guest'
option output 'ACCEPT'
option forward 'REJECT'
option input 'REJECT'
list network 'guest1'
config rule 'guest_dns'
option name 'Allow-DNS-Guest'
option src 'guest'
option dest_port '53'
option proto 'tcp udp'
option target 'ACCEPT'
config rule 'guest_dhcp'
option name 'Allow-DHCP-Guest'
option src 'guest'
option src_port '68'
option dest_port '67'
option proto 'udp'
option family 'ipv4'
option target 'ACCEPT'
config forwarding
option dest 'lan'
config forwarding
option src 'guest'
option dest 'lan'
config rule
option name 'dhcp ok'
option dest 'lan'
option dest_port '53'
option target 'ACCEPT'
option enabled '0'
config rule
option name 'dns ok'
list dest_ip '192.168.0.1'
list dest_ip '192.168.0.171'
option dest_port '67'
option target 'ACCEPT'
option dest 'lan'
option enabled '0'
config rule
option dest 'lan'
option target 'DROP'
option name 'drop all guest traffic'
option enabled '0'
config rule
option name 'drop guest'
option src 'guest'
list src_ip '192.168.195.0/24'
option dest 'lan'
list dest_ip '192.168.0.0/24'
option target 'REJECT'
list proto 'all'
config zone
option name 'vpn'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
list network 'wg_s2s_amopsz'
config forwarding
option src 'vpn'
option dest 'lan'
config forwarding
option src 'lan'
option dest 'vpn'
config rule
option name 'allow acces vpn'
option src 'vpn'
option dest 'lan'
list dest_ip '192.168.0.1'
list dest_ip '192.168.0.2'
list dest_ip '192.168.0.171'
list dest_ip '192.168.0.195'
option target 'ACCEPT'
config rule
option name 'block lan acces SA WG'
option src 'vpn'
option dest 'lan'
option target 'REJECT'
Network
root@szne_nighthawk1_rumpel_195:~# cat /etc/config/network
config interface 'loopback'
option device 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
config device
option name 'br-lan'
option type 'bridge'
list ports 'eth1.1'
config interface 'lan'
option device 'br-lan'
option ipv6 '0'
option proto 'static'
option netmask '255.255.255.0'
option gateway '192.168.0.1'
option ipaddr '192.168.0.195'
list dns '192.168.0.171'
config switch
option name 'switch0'
option reset '1'
option enable_vlan '1'
config switch_vlan
option device 'switch0'
option vlan '1'
option vid '1'
option ports '6t 4 3 2 1 5'
config switch_vlan
option device 'switch0'
option vlan '2'
option vid '2'
option ports '0t'
config interface 'guest1'
option proto 'static'
option netmask '255.255.255.0'
option ipaddr '192.168.195.1'
option device 'wifi_bridge'
config device
option type 'bridge'
option name 'wifi_bridge'
config interface 'wg_s2s_amopsz'
option proto 'wireguard'
option private_key 'OBRE='
option listen_port '51823'
list addresses '10.10.10.2/24'
config wireguard_wg_s2s_amopsz 's2s_vpn_site_bmopsz'
option public_key '6TRg='
option preshared_key '4sxx='
option description 'Site B, e.diskstation.me'
list allowed_ips '192.168.112.0/24'
list allowed_ips 'fdee:eeee:efff::/48'
list allowed_ips '10.10.10.1/32'
option persistent_keepalive '25'
option endpoint_host 'e.diskstation.me'
option endpoint_port '51823'
option route_allowed_ips '1'