forked from imaginator/home-network
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathf17gw.settings
2153 lines (1898 loc) · 81.1 KB
/
f17gw.settings
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/sh
# Edgerouter X
# stop after any errors
set -xe
uci import system <<EOF
EOF
uci add system system
uci set system.@system[-1]=system
uci set system.@system[-1].compat_version=1.1
uci set system.@system[-1].hostname='f17gw'
uci set system.@system[-1].zonename='UTC'
uci set system.@system[-1].timezone='UTC'
uci set system.@system[-1].conloglevel='8'
uci set system.@system[-1].klogconloglevel='8'
uci set system.@system[-1].cronloglevel='0'
uci set system.@system[-1].log_ip='10.7.11.1'
uci set system.@system[-1].log_proto='tcp'
uci set system.@system[-1].log_port='514'
uci set system.@system[-1].log_size='128'
uci set system.@system[-1].log_buffer_size='64'
uci set system.@system[-1].log_remote='1'
uci set system.ntp=timeserver
uci set system.ntp.enabled=1
uci add_list system.ntp.server='0.de.pool.ntp.org'
uci add_list system.ntp.server='1.de.pool.ntp.org'
uci add_list system.ntp.server='2.de.pool.ntp.org'
uci set system.@system[-1].location='Falckensteinstraße'
uci set system.@system[-1].latitude='52.497618743398135'
uci set system.@system[-1].longitude='13.441156148912176'
uci commit system
uci add system watchcat
uci set system.@watchcat[-1]=watchcat
uci set system.@watchcat[-1].mode='ping'
uci set system.@watchcat[-1].forcedelay='300'
uci set system.@watchcat[-1].period='30m'
uci set system.@watchcat[-1].pingperiod='5m'
uci set system.@watchcat[-1].pinghosts='1.1.1.1'
uci commit system.watchcat
uci import dropbear <<EOF
EOF
uci add dropbear dropbear
uci set dropbear.@dropbear[-1]=dropbear
uci set dropbear.@dropbear[-1].Port='22'
uci set dropbear.@dropbear[-1].PasswordAuth='0'
uci set dropbear.@dropbear[-1].RootPasswordAuth='0'
uci commit dropbear
cat <<'EOF' > /etc/dropbear/authorized_keys
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHwK3f7YB4qmDKgnZ6yKaQlLEdDAFaVbNREiE2gyHwSN [email protected]
EOF
chmod 0600 /etc/dropbear/authorized_keys
uci import network <<EOF
EOF
uci set network.loopback=interface
uci set network.loopback.ifname='lo'
uci set network.loopback.proto='static'
uci set network.loopback.ipaddr='127.0.0.1'
uci set network.loopback.netmask='255.0.0.0'
uci set network.trusted=interface
uci set network.trusted.type='bridge'
uci set network.trusted.ifname='eth0.2'
uci set network.trusted.macaddr='aa:aa:aa:aa:0f:17'
#uci add_list network.trusted.ip6class='henet'
uci add_list network.trusted.ip6class='pyur6'
uci set network.trusted.igmp_snooping=1
uci set network.trusted.ip6assign='64'
uci set network.trusted.ip6ifaceid='::5'
uci set network.trusted.ipaddr='10.7.11.5'
uci set network.trusted.netmask='255.255.255.0'
uci set network.trusted.proto='static'
uci set network.notrust=interface
uci set network.notrust.type='bridge'
uci add_list network.notrust.ifname='eth0.3'
uci add_list network.notrust.ifname='eth2'
uci set network.notrust.proto='static'
uci set network.notrust.netmask='255.255.255.0'
uci set network.notrust.ipaddr='10.36.189.5'
uci set network.notrust.delegate='0'
# wan interface
uci set network.pyur4=interface
uci set network.pyur4.type='bridge'
uci add_list network.pyur4.ifname='eth0.4'
uci add_list network.pyur4.ifname='eth1'
uci set network.pyur4.proto='dhcp'
uci set network.pyur4.macaddr='aa:aa:aa:aa:0e:17'
uci set network.pyur4.broadcast=1
uci set network.pyur4.peerdns=0
uci set network.pyur4.defaultroute=1
#uci set network.pyur4.ip4table='pyur4'
uci set network.pyur6=interface
uci set network.pyur6.ifname='@pyur4'
uci set network.pyur6.proto='dhcpv6'
uci set network.pyur6.reqaddress='try'
uci set network.pyur6.reqprefix='auto'
uci set network.pyur6.peerdns='0'
uci set network.pyur6.metric='0'
#uci set network.pyur6.ip6table='pyur6'
uci set network.cable=interface
uci set network.cable.ifname='eth0.2'
uci set network.cable.proto='static'
uci add_list network.cable.ipaddr='192.168.0.5/24'
uci add_list network.cable.ipaddr='192.168.100.5/24'
uci set network.cable.delegate='0'
uci set network.iot=interface
uci set network.iot.ifname='eth0.5'
uci set network.iot.ipaddr='10.7.9.1'
uci set network.iot.netmask='255.255.255.0'
uci set network.iot.proto='static'
uci set network.iot.type='bridge'
uci set network.iot.delegate='0'
uci set network.ffuplink=interface
uci set network.ffuplink.ifname='eth0.6'
uci set network.ffuplink.ipaddr='10.31.14.84'
uci set network.ffuplink.netmask='255.255.255.255'
uci set network.ffuplink.proto='static'
uci set network.ffuplink.type='bridge'
uci set network.ffuplink.auto='0'
uci set network.henet=interface
uci set network.henet.proto='6in4'
uci set network.henet.peeraddr='216.66.86.114'
uci set network.henet.ip6addr='2001:470:6c:20a::2/64'
uci set network.henet.tunnelid='${henet_f17_tunnelid}'
uci set network.henet.username='${henet_f17_username}'
uci add_list network.henet.ip6prefix='2001:470:5155::/48'
uci set network.henet.password='${henet_f17_password}'
uci set network.henet.metric='1'
uci set network.henet.mtu='1480'
uci set network.henet.auto='0'
uci set network.wg0='interface'
uci set network.wg0.proto='wireguard'
uci set network.wg0.listen_port='12321'
uci add_list network.wg0.addresses='10.7.8.1/24'
uci set network.wg0.private_key='${wg_f17gw_private_key}'
uci set network.wg_simonphone=wireguard_wg0
uci set network.wg_simonphone.description='Simon Mobile'
uci set network.wg_simonphone.public_key='${wg_simonphone_public_key}'
uci set network.wg_simonphone.persistent_keepalive='25'
uci add_list network.wg_simonphone.allowed_ips='10.7.8.4/32'
uci set network.wg_simonphone.route_allowed_ips='1'
uci set network.wg_tablet=wireguard_wg0
uci set network.wg_tablet.description='OpenHAB Tablet'
uci set network.wg_tablet.public_key='${wg_tablet_public_key}'
uci set network.wg_tablet.persistent_keepalive='25'
uci add_list network.wg_tablet.allowed_ips='10.7.8.5/32'
uci set network.wg_tablet.route_allowed_ips='1'
uci set network.wg_furrow=wireguard_wg0
uci set network.wg_furrow.description='furrow'
uci set network.wg_furrow.public_key='${wg_furrow_public_key}'
uci set network.wg_furrow.persistent_keepalive='25'
uci add_list network.wg_furrow.allowed_ips='10.7.8.7/32'
uci set network.wg_furrow.route_allowed_ips='1'
uci set network.wg_windows=wireguard_wg0
uci set network.wg_windows.description='windows'
uci set network.wg_windows.public_key='${wg_windows_public_key}'
uci set network.wg_windows.persistent_keepalive='25'
uci add_list network.wg_windows.allowed_ips='10.7.8.8/32'
uci set network.wg_windows.route_allowed_ips='1'
uci commit network
# https://forum.openwrt.org/viewtopic.php?pid=208948#p208948
#uci add network rule
#uci set network.@rule[-1]=rule
#uci set network.@rule[-1].src='10.7.12.0/22'
#uci set network.@rule[-1].lookup='100'
#uci commit network.@rule[-1]
# due to a bug, these are now in '/etc/openvpn/up.sh'
#uci add network route
#uci set network.@route[-1]=route
#uci set network.@route[-1].table=100
#uci set network.@route[-1].interface=br-trusted
#uci set network.@route[-1].target=10.7.11.0
#uci set network.@route[-1].netmask=255.255.255.0
#uci commit network.@route[-1]
#uci add network route
#uci set network.@route[-1]=route
#uci set network.@route[-1].table=100
#uci set network.@route[-1].interface=ffvpn
#uci set network.@route[-1].target=0.0.0.0
#uci set network.@route[-1].netmask=0.0.0.0
#uci commit network.@route[-1]
uci set luci.sauth.sessiontime="36000000"
uci commit luci
uci import olsrd<<EOF
EOF
# Specifies the routing Table olsr uses
# RtTable is for host routes,
# RtTableDefault for the route to the default internet gateway
# RtTableTunnel is for routes to the ipip tunnels,
# valid values are 1 to 254
# There is a special parameter "auto" (choose default below)
# (with smartgw: default is 254/223/224)
# (without smartgw: default is 254/254/254, linux main table)
# Specifies the policy rule priorities for the three routing tables and
# a special rule for smartgateway routing (see README-Olsr-Extensions)
# Priorities can only be set if three different routing tables are set.
# if set the values must obey to condition
# RtTablePriority < RtTableDefaultOlsrPriority < RtTableTunnelPriority < RtTableDefaultPriority
# There are two special parameters, "auto" (choose fitting to SmartGW
# mode) and "none" (do not set policy rule)
# (with smartgw: default is none/32776/32786/32796)
# (without smartgw: default is none/none/none/none)
# root@w16gw:~# ip rule show
# 0: from all lookup local
# 32766: from all lookup main
# 32767: from all lookup default
# 90000: from all lookup 111
# 100000: from all iif eth0.6 lookup 112
# 120000: from all lookup 113
# 120010: from all lookup 112
uci add olsrd olsrd
uci set olsrd.@olsrd[-1]=olsrd
uci set olsrd.@olsrd[-1].DebugLevel=9
uci set olsrd.@olsrd[-1].AllowNoInt='yes'
uci set olsrd.@olsrd[-1].FIBMetric='flat'
uci set olsrd.@olsrd[-1].IpVersion='4'
uci set olsrd.@olsrd[-1].LinkQualityAlgorithm='etx_ff'
uci set olsrd.@olsrd[-1].NatThreshold='0.75'
uci set olsrd.@olsrd[-1].Pollrate='0.025'
uci set olsrd.@olsrd[-1].RtTable='111'
uci set olsrd.@olsrd[-1].RtTableDefault='112'
uci set olsrd.@olsrd[-1].RtTableDefaultOlsrPriority='20000'
uci set olsrd.@olsrd[-1].RtTableTunnel='113'
uci set olsrd.@olsrd[-1].RtTableTunnelPriority='100000'
uci set olsrd.@olsrd[-1].SmartGateway='yes'
uci set olsrd.@olsrd[-1].SmartGatewayThreshold='50'
uci set olsrd.@olsrd[-1].TcRedundancy='2'
uci set olsrd.@olsrd[-1].SmartGatewayUplink='none' # don't share internet from w16 yet.
uci commit olsrd.@olsrd[-1]
uci import olsrd6<<EOF
EOF
uci add olsrd6 olsrd
uci set olsrd6.@olsrd[-1]=olsrd
uci set olsrd6.@olsrd[-1].IpVersion='6'
uci set olsrd6.@olsrd[-1].FIBMetric='flat'
uci set olsrd6.@olsrd[-1].AllowNoInt='yes'
uci set olsrd6.@olsrd[-1].TcRedundancy='2'
uci set olsrd6.@olsrd[-1].LinkQualityAlgorithm='etx_ffeth'
uci set olsrd6.@olsrd[-1].Pollrate='0.025'
uci set olsrd6.@olsrd[-1].RtTable='111'
uci set olsrd6.@olsrd[-1].RtTableDefault='112'
uci set olsrd6.@olsrd[-1].RtTablePriority='1000'
uci set olsrd6.@olsrd[-1].RtTableDefaultOlsrPriority='20000'
uci set olsrd6.@olsrd[-1].SmartGatewayUplink='none' # don't share internet from w16 yet.
uci commit olsrd6.@olsrd[-1]
uci add olsrd Interface
uci set olsrd.@Interface[-1]=Interface
uci set olsrd.@Interface[-1].ignore='0'
uci set olsrd.@Interface[-1].interface='ffuplink'
uci set olsrd.@Interface[-1].Ip4Broadcast='255.255.255.255'
uci set olsrd.@Interface[-1].Mode='mesh'
uci commit olsrd.@Interface[-1]
uci add olsrd6 Interface
uci set olsrd6.@Interface[-1]=Interface
uci set olsrd6.@Interface[-1].ignore='0'
uci set olsrd6.@Interface[-1].interface='ffuplink'
uci set olsrd6.@Interface[-1].IPv6Multicast='ff02::6d'
uci set olsrd6.@Interface[-1].Mode='mesh'
uci commit olsrd6.@Interface[-1]
uci add olsrd Hna4
uci set olsrd.@Hna4[-1]=Hna4
uci set olsrd.@Hna4[-1].netaddr='10.36.189.0'
uci set olsrd.@Hna4[-1].netmask='255.255.255.0'
uci commit olsrd.@Hna4[-1]
uci add olsrd6 Hna6
uci set olsrd6.@Hna6[-1]=Hna6
uci set olsrd6.@Hna6[-1].netaddr='2001:bf7:830:6600::'
uci set olsrd6.@Hna6[-1].prefix='56'
uci commit olsrd6.@Hna6[-1]
# add txtinfo plugin - needed for collectd-mod-txtinfo
uci add olsrd LoadPlugin
uci set olsrd.@LoadPlugin[-1]=LoadPlugin
uci set olsrd.@LoadPlugin[-1].accept=0.0.0.0
uci set olsrd.@LoadPlugin[-1].library=olsrd_txtinfo
uci set olsrd.@LoadPlugin[-1].port=2006
uci set olsrd.@LoadPlugin[-1].ignore=0
uci commit olsrd.@LoadPlugin[-1]
uci add olsrd6 LoadPlugin
uci set olsrd6.@LoadPlugin[-1]=LoadPlugin
uci set olsrd6.@LoadPlugin[-1].library='olsrd_txtinfo'
uci set olsrd6.@LoadPlugin[-1].accept='::'
uci set olsrd6.@LoadPlugin[-1].ignore=0
uci set olsrd6.@LoadPlugin[-1].ipv6only=true
uci set olsrd6.@LoadPlugin[-1].port='2007'
uci commit olsrd6.@LoadPlugin[-1]
# add arprefresh plugin
uci add olsrd LoadPlugin
uci set olsrd.@LoadPlugin[-1]=LoadPlugin
uci set olsrd.@LoadPlugin[-1].library=olsrd_arprefresh
uci commit olsrd.@LoadPlugin[-1]
# add nameservice plugin
uci add olsrd LoadPlugin
uci set olsrd.@LoadPlugin[-1]=LoadPlugin
uci set olsrd.@LoadPlugin[-1].library=olsrd_nameservice
uci set olsrd.@LoadPlugin[-1].suffix=.olsr
uci set olsrd.@LoadPlugin[-1].hosts_file=/tmp/hosts/olsr
uci set olsrd.@LoadPlugin[-1].latlon_file=/var/run/latlon.js
uci set olsrd.@LoadPlugin[-1].services_file=/var/etc/services.olsr
uci commit olsrd.@LoadPlugin[-1]
# add jsoninfo plugin (ipv4)
uci add olsrd LoadPlugin
uci set olsrd.@LoadPlugin[-1]=LoadPlugin
uci set olsrd.@LoadPlugin[-1].accept=0.0.0.0
uci set olsrd.@LoadPlugin[-1].library=olsrd_jsoninfo
uci set olsrd.@LoadPlugin[-1].ignore=0
uci commit olsrd.@LoadPlugin[-1]
# add jsoninfo plugin (ipv6)
uci add olsrd6 LoadPlugin
uci set olsrd6.@LoadPlugin[-1]=LoadPlugin
uci set olsrd6.@LoadPlugin[-1].library='olsrd_jsoninfo'
uci set olsrd6.@LoadPlugin[-1].ipv6only=true
uci set olsrd6.@LoadPlugin[-1].accept='0::'
uci set olsrd6.@LoadPlugin[-1].ignore=0
uci commit olsrd6.@LoadPlugin[-1]
# add watchdog plugin
uci add olsrd LoadPlugin
uci set olsrd.@LoadPlugin[-1]=LoadPlugin
uci set olsrd.@LoadPlugin[-1].library=olsrd_watchdog
uci set olsrd.@LoadPlugin[-1].file=/var/run/olsrd.watchdog
uci set olsrd.@LoadPlugin[-1].interval=30
uci commit olsrd.@LoadPlugin[-1]
uci add olsrd6 LoadPlugin
uci set olsrd6.@LoadPlugin[-1]=LoadPlugin
uci set olsrd6.@LoadPlugin[-1].library='olsrd_watchdog'
uci set olsrd6.@LoadPlugin[-1].ignore=0
uci set olsrd6.@LoadPlugin[-1].file='/var/run/olsrd6.watchdog'
uci commit olsrd6.@LoadPlugin[-1]
# add dyngw plain plugin - it is ipv4 only
uci add olsrd LoadPlugin
uci set olsrd.@LoadPlugin[-1]=LoadPlugin
uci set olsrd.@LoadPlugin[-1].library='olsrd_dyn_gw'
uci add_list olsrd.@LoadPlugin[-1].Ping=1.1.1.1
uci add_list olsrd.@LoadPlugin[-1].Ping=8.8.8.8
uci set olsrd.@LoadPlugin[-1].ignore=0
uci commit olsrd.@LoadPlugin[-1]
uci add olsrd LoadPlugin
uci set olsrd.@LoadPlugin[-1]=LoadPlugin
uci set olsrd.@LoadPlugin[-1].library='olsrd_dot_draw'
uci set olsrd.@LoadPlugin[-1].ignore=0
uci commit olsrd.@LoadPlugin[-1]
uci add olsrd LoadPlugin
uci set olsrd.@LoadPlugin[-1]=LoadPlugin
uci set olsrd.@LoadPlugin[-1].library='olsrd_httpinfo'
uci set olsrd.@LoadPlugin[-1].ignore=0
uci commit olsrd.@LoadPlugin[-1]
uci add olsrd LoadPlugin
uci set olsrd.@LoadPlugin[-1]=LoadPlugin
uci add_list olsrd.@LoadPlugin[-1].service='https://bunker.imaginator.com/grafana/ System Status'
uci set olsrd.@LoadPlugin[-1].hosts_file='/tmp/hosts/olsr'
uci set olsrd.@LoadPlugin[-1].ignore=0
uci set olsrd.@LoadPlugin[-1].latlon_file='/var/run/latlon.js'
uci set olsrd.@LoadPlugin[-1].library='olsrd_nameservice'
uci set olsrd.@LoadPlugin[-1].services_file='/var/etc/services.olsr'
uci set olsrd.@LoadPlugin[-1].suffix='.olsr'
uci commit olsrd.@LoadPlugin[-1]
uci add olsrd6 LoadPlugin
uci set olsrd6.@LoadPlugin[-1]=LoadPlugin
uci set olsrd6.@LoadPlugin[-1].hosts_file='/tmp/hosts/olsr.ipv6'
uci set olsrd6.@LoadPlugin[-1].ignore=0
uci set olsrd6.@LoadPlugin[-1].latlon_file='/var/run/latlon.js.ipv6'
uci set olsrd6.@LoadPlugin[-1].library='olsrd_nameservice'
uci set olsrd6.@LoadPlugin[-1].services_file='/var/etc/services.olsr.ipv6'
uci set olsrd6.@LoadPlugin[-1].suffix='.olsr'
uci commit olsrd6.@LoadPlugin[-1]
uci add olsrd LoadPlugin
uci set olsrd.@LoadPlugin[-1]=LoadPlugin
uci set olsrd.@LoadPlugin[-1].library='olsrd_pgraph'
uci set olsrd.@LoadPlugin[-1].ignore=0
uci commit olsrd.@LoadPlugin[-1]
uci import ddns <<EOF
EOF
uci add ddns global
uci set ddns.global=ddns
uci set ddns.global.date_format='%F %R'
uci set ddns.global.log_lines='250'
uci set ddns.global.allow_local_ip='0'
uci set ddns.global.use_curl='1'
uci commit ddns.global
uci add ddns service
uci set ddns.@service[-1]=service
uci set ddns.@service[-1].cacert='/etc/ssl/certs/ca-certificates.crt'
uci set ddns.@service[-1].check_interval='5'
uci set ddns.@service[-1].check_unit='minutes'
uci set ddns.@service[-1].domain='${f17gw_ddns4_domain}'
uci set ddns.@service[-1].enabled='1'
uci set ddns.@service[-1].force_interval='5'
uci set ddns.@service[-1].force_ipversion=1
uci set ddns.@service[-1].force_unit='minutes'
uci set ddns.@service[-1].interface='pyur4' # for hotplug events
uci set ddns.@service[-1].ip_source='web'
uci set ddns.@service[-1].ip_url='https://checkip.dns.he.net/'
uci set ddns.@service[-1].password='${f17gw_ddns4_password}'
uci set ddns.@service[-1].retry_interval='1'
uci set ddns.@service[-1].retry_unit='minutes'
uci set ddns.@service[-1].service_name='he.net'
uci set ddns.@service[-1].use_https='1'
uci set ddns.@service[-1].use_ipv6='0'
uci set ddns.@service[-1].use_logfile='0'
uci set ddns.@service[-1].use_syslog='1'
uci set ddns.@service[-1].username='${f17gw_ddns4_username}'
uci commit ddns.@service[-1]
uci add ddns service
uci set ddns.@service[-1]=service
uci set ddns.@service[-1].cacert='/etc/ssl/certs/ca-certificates.crt'
uci set ddns.@service[-1].check_interval='5'
uci set ddns.@service[-1].check_unit='minutes'
uci set ddns.@service[-1].domain='${f17gw_ddns6_domain}'
uci set ddns.@service[-1].enabled='1'
uci set ddns.@service[-1].force_ipversion=1
uci set ddns.@service[-1].force_interval='5'
uci set ddns.@service[-1].force_unit='minutes'
uci set ddns.@service[-1].interface='pyur6' # for hotplug events
uci set ddns.@service[-1].ip_source='network'
uci set ddns.@service[-1].ip_network='pyur6'
uci set ddns.@service[-1].password='${f17gw_ddns6_password}'
uci set ddns.@service[-1].retry_interval='1'
uci set ddns.@service[-1].retry_unit='minutes'
uci set ddns.@service[-1].service_name='he.net'
uci set ddns.@service[-1].use_https='1'
uci set ddns.@service[-1].use_ipv6='1'
uci set ddns.@service[-1].use_logfile='0'
uci set ddns.@service[-1].use_syslog='1'
uci set ddns.@service[-1].username='${f17gw_ddns6_username}'
uci commit ddns.@service[-1]
service ddns enable || true
uci import softflowd<<EOF
EOF
uci add softflowd softflowd
uci set softflowd.@softflowd[-1]=softflowd
uci set softflowd.@softflowd[-1].enabled='1'
uci set softflowd.@softflowd[-1].interface='eth0.4'
uci set softflowd.@softflowd[-1].timeout='maxlife=60'
uci set softflowd.@softflowd[-1].max_flows='8192'
uci set softflowd.@softflowd[-1].host_port='10.7.11.1:2055'
uci set softflowd.@softflowd[-1].pid_file='/var/run/softflowd.pid'
uci set softflowd.@softflowd[-1].control_socket='/var/run/softflowd.ctl'
uci set softflowd.@softflowd[-1].export_version='9'
uci set softflowd.@softflowd[-1].tracking_level='full'
uci set softflowd.@softflowd[-1].track_ipv6='1'
uci set softflowd.@softflowd[-1].sampling_rate='1'
uci commit softflowd.@softflowd[-1]
service softflowd disable || true
uci import prometheus-node-exporter-lua<<EOF
EOF
uci set prometheus-node-exporter-lua.main=prometheus-node-exporter-lua
uci set prometheus-node-exporter-lua.main.listen_interface='trusted'
uci set prometheus-node-exporter-lua.main.listen_port='9100'
uci commit prometheus-node-exporter-lua
service prometheus-node-exporter-lua enable || true
test -d /etc/adblock || mkdir -p /etc/adblock
cat <<'EOF' > /etc/adblock/adblock.blacklist
# domains to block
# the neighbour streams an inordinate amount of TV from here.
zattoo.de
zattoo.com
EOF
uci import adblock <<EOF
EOF
uci set adblock.global=adblock
uci set adblock.global.adb_backup='0'
uci set adblock.global.adb_backupdir='/mnt'
uci set adblock.global.adb_debug='1'
uci set adblock.global.adb_dns='dnsmasq'
uci set adblock.global.adb_enabled='1'
uci set adblock.global.adb_forcedns='0'
uci set adblock.global.adb_forcesrt='0'
uci set adblock.global.adb_manmode='0'
uci set adblock.global.adb_rtfile='/tmp/adb_runtime.json'
uci set adblock.global.adb_trigger='pyur4'
uci set adblock.global.adb_triggerdelay='5' # gives us the chance to log in and change this if using too much memory.
uci set adblock.global.adb_whitelist='/etc/adblock/adblock.whitelist'
uci set adblock.global.adb_whitelist_rset='\$1 ~/^([A-Za-z0-9_-]+\.){1,}[A-Za-z]+/{print tolower(\"^\"\$1\"\\\|[.]\"\$1)}'
uci commit adblock.global
uci add adblock source
uci set adblock.@source[-1]=source
uci rename adblock.@source[-1]=blacklist
uci set adblock.@source[-1].enabled='1'
uci set adblock.@source[-1].adb_src='/etc/adblock/adblock.blacklist'
uci set adblock.@source[-1].adb_src_rset='\$1 ~/^([A-Za-z0-9_-]+\.){1,}[A-Za-z]+/{print tolower(\$1)}'
uci set adblock.@source[-1].adb_src_desc='static local domain blacklist (always deny these domains)'
uci commit adblock.@source[-1]
uci add adblock source
uci set adblock.@source[-1]=source
uci rename adblock.@source[-1]=adway
uci set adblock.@source[-1].enabled='1'
uci set adblock.@source[-1].adb_src='https://adaway.org/hosts.txt'
uci set adblock.@source[-1].adb_src_rset='\$0 ~/^127\.0\.0\.1[ \t]+([A-Za-z0-9_-]+\.){1,}[A-Za-z]+/{print tolower(\$2)}'
uci set adblock.@source[-1].adb_src_desc='focus on mobile ads, infrequent updates, approx. 400 entries'
uci commit adblock.@source[-1]
uci add adblock source
uci set adblock.@source[-1]=source
uci rename adblock.@source[-1]=yoyo
uci set adblock.@source[-1].enabled='1'
uci set adblock.@source[-1].adb_src='https://pgl.yoyo.org/adservers/serverlist.php?hostformat=nohtml&showintro=0&mimetype=plaintext'
uci set adblock.@source[-1].adb_src_rset='\$1 ~/^([A-Za-z0-9_-]+\.){1,}[A-Za-z]+/{print tolower(\$1)}'
uci set adblock.@source[-1].adb_src_desc='focus on ad related domains, weekly updates, approx. 2.500 entries'
uci commit adblock.@source[-1]
uci add adblock source
uci set adblock.@source[-1]=source
uci rename adblock.@source[-1]=malvertising
uci set adblock.@source[-1].enabled='1'
uci set adblock.@source[-1].adb_src='https://s3.amazonaws.com/lists.disconnect.me/simple_malvertising.txt'
uci set adblock.@source[-1].adb_src_rset='\$1 ~/^([A-Za-z0-9_-]+\.){1,}[A-Za-z]+/{print tolower(\$1)}'
uci set adblock.@source[-1].adb_src_desc='mozilla driven blocklist, numerous updates on the same day, approx. 6.500 entries'
uci commit adblock.@source[-1]
service adblock enable || true
uci import openvpn <<EOF
EOF
uci set openvpn.ffvpn=openvpn
uci set openvpn.ffvpn.enabled='0'
uci set openvpn.ffvpn.client='1'
uci set openvpn.ffvpn.nobind='1'
uci set openvpn.ffvpn.proto='udp'
uci set openvpn.ffvpn.dev='ffvpn'
uci set openvpn.ffvpn.dev_type='tun'
uci set openvpn.ffvpn.persist_key='1'
uci set openvpn.ffvpn.keepalive='10 60'
uci set openvpn.ffvpn.compress='lzo'
uci set openvpn.ffvpn.script_security='2'
uci set openvpn.ffvpn.cipher='none'
uci set openvpn.ffvpn.mute_replay_warnings='1'
uci add_list openvpn.ffvpn.remote='vpn03.berlin.freifunk.net 1194 udp'
uci add_list openvpn.ffvpn.remote='vpn03-backup.berlin.freifunk.net 1194 udp'
uci set openvpn.ffvpn.ns_cert_type='server'
uci set openvpn.ffvpn.ca='/etc/openvpn/freifunk-ca.crt'
uci set openvpn.ffvpn.cert='/etc/openvpn/freifunk_client.crt'
uci set openvpn.ffvpn.key='/etc/openvpn/freifunk_client.key'
uci set openvpn.ffvpn.up='/etc/openvpn/up.sh'
uci set openvpn.ffvpn.route_nopull='1'
uci commit openvpn.ffvpn
if [ ! -d "/etc/openvpn" ]; then
mkdir /etc/openvpn
fi
cat <<'EOF' > /etc/openvpn/up.sh
#!/bin/sh
set -x
sleep 10
if [ `ip route show table 100 | grep "default via 172.31.240.1 dev ffvpn" | wc -l` -lt 1 ]; then
ip route add default via 172.31.240.1 table 100
fi
if [ `ip route show table 100 | grep "10.7.12.0/22 dev br-notrust" | wc -l` -lt 2 ]; then
ip route add 10.7.11.0/24 dev br-trusted table 100
ip route add 10.7.12.0/22 dev br-notrust table 100
fi
if [ `ip route show table 100 | grep "172.31.240.0/20 dev ffvpn" | wc -l` -lt 1 ]; then
ip route add 172.31.240.0/20 dev ffvpn table 100
fi
if [ `ip rule | grep "172.31.240.0/20 lookup 100" | wc -l` -lt 1 ]; then
ip rule add from 172.31.240.0/20 table 100
fi
if [ `ip rule | grep "10.7.12.0/22 lookup 100" | wc -l` -lt 1 ]; then
ip rule add from 10.7.12.0/22 table 100
fi
EOF
chmod u+x /etc/openvpn/up.sh
cat <<'EOF' > /etc/openvpn/freifunk-ca.crt
${freifunk_ca_crt}
EOF
cat <<'EOF' > /etc/openvpn/freifunk_client.crt
${freifunk_client_crt}
EOF
cat <<'EOF' > /etc/openvpn/freifunk_client.key
${freifunk_client_key}
EOF
cat <<'EOF' > /etc/openvpn/imagivpn.key
${imagivpn_key}
EOF
cat <<'EOF' > /etc/openvpn/dh2048.pem
${dh2048_pem}
EOF
service openvpn enable || true
uci import https_dns_proxy <<EOF
EOF
uci set https_dns_proxy.dns="https_dns_proxy"
uci set https_dns_proxy.dns.listen_addr="127.0.0.1"
uci set https_dns_proxy.dns.listen_port="5053"
uci set https_dns_proxy.dns.user="nobody"
uci set https_dns_proxy.dns.group="nogroup"
uci set https_dns_proxy.dns.url_prefix="https://cloudflare-dns.com/dns-query?ct=application/dns-json&"
uci commit https_dns_proxy
service https_dns_proxy enable || true
uci import firewall <<EOF
EOF
uci add firewall defaults
uci set firewall.@defaults[-1]=defaults
uci set firewall.@defaults[-1].input='REJECT'
uci set firewall.@defaults[-1].output='REJECT'
uci set firewall.@defaults[-1].forward='REJECT'
uci set firewall.@defaults[-1].flow_offloading=0 # currently broken
uci set firewall.@defaults[-1].flow_offloading_hw=0 # currently broken
uci set firewall.@defaults[-1].drop_invalid=1
uci commit firewall.@defaults[-1]
# A zone section groups one or more interfaces and serves as a source or destination for forwardings,
# rules and redirects. Masquerading (NAT) of outgoing traffic is controlled on a per-zone basis.
# Note that masquerading is defined on the outgoing interface.
# INPUT rules for a zone describe what happens to traffic trying to reach the router itself through an interface in that zone.
# OUTPUT rules for a zone describe what happens to traffic originating from the router itself going through an interface in that zone.
# FORWARD rules for a zone describe what happens to traffic passing between different interfaces in that zone.
uci add firewall zone
uci set firewall.@zone[-1]=zone
uci set firewall.@zone[-1].name='trusted'
uci add_list firewall.@zone[-1].network='trusted'
uci add_list firewall.@zone[-1].network='wg0'
uci set firewall.@zone[-1].input='DROP'
uci set firewall.@zone[-1].output='ACCEPT'
uci set firewall.@zone[-1].forward='ACCEPT'
uci set firewall.@zone[-1].log='1'
uci set firewall.@zone[-1].mtu_fix='1'
uci set firewall.@zone[-1].conntrack='1'
uci commit firewall.@zone[-1]
uci add firewall zone
uci set firewall.@zone[-1]=zone
uci set firewall.@zone[-1].name='notrust'
uci add_list firewall.@zone[-1].network='notrust'
uci set firewall.@zone[-1].input='DROP'
uci set firewall.@zone[-1].device='tnl_+'
uci set firewall.@zone[-1].output='ACCEPT'
uci set firewall.@zone[-1].forward='ACCEPT'
uci set firewall.@zone[-1].masq='1'
uci set firewall.@zone[-1].log='1'
uci set firewall.@zone[-1].conntrack='1'
uci commit firewall.@zone[-1]
uci add firewall zone
uci set firewall.@zone[-1]=zone
uci set firewall.@zone[-1].name='iot'
uci add_list firewall.@zone[-1].network='iot'
uci set firewall.@zone[-1].input='DROP'
uci set firewall.@zone[-1].output='DROP'
uci set firewall.@zone[-1].forward='DROP'
uci set firewall.@zone[-1].log='1'
uci set firewall.@zone[-1].conntrack='1'
uci commit firewall.@zone[-1]
uci add firewall zone
uci set firewall.@zone[-1]=zone
uci set firewall.@zone[-1].name='wan_trusted'
uci add_list firewall.@zone[-1].network='pyur4'
uci add_list firewall.@zone[-1].network='pyur6'
uci add_list firewall.@zone[-1].network='henet'
uci add_list firewall.@zone[-1].network='cable'
uci set firewall.@zone[-1].masq='1'
uci set firewall.@zone[-1].input='DROP'
uci set firewall.@zone[-1].output='ACCEPT'
uci set firewall.@zone[-1].forward='DROP'
uci set firewall.@zone[-1].log='1'
uci set firewall.@zone[-1].conntrack='1'
uci commit firewall.@zone[-1]
uci add firewall zone
uci set firewall.@zone[-1]=zone
uci set firewall.@zone[-1].name='ffuplink'
uci add_list firewall.@zone[-1].network='ffuplink'
uci set firewall.@zone[-1].masq='1'
uci set firewall.@zone[-1].input='DROP'
uci set firewall.@zone[-1].output='ACCEPT'
uci set firewall.@zone[-1].forward='DROP'
uci set firewall.@zone[-1].log='1'
uci set firewall.@zone[-1].conntrack='1'
uci commit firewall.@zone[-1]
uci add firewall forwarding
uci set firewall.@forwarding[-1]=forwarding
uci set firewall.@forwarding[-1].src='ffuplink'
uci set firewall.@forwarding[-1].dest='ffuplink'
uci commit firewall.@forwarding[-1]
uci add firewall zone
uci set firewall.@zone[-1]=zone
uci set firewall.@zone[-1].name='wan_notrust'
uci add_list firewall.@zone[-1].network='ffvpn'
uci set firewall.@zone[-1].masq='1'
uci set firewall.@zone[-1].input='DROP'
uci set firewall.@zone[-1].output='ACCEPT'
uci set firewall.@zone[-1].forward='DROP'
uci set firewall.@zone[-1].log='1'
uci set firewall.@zone[-1].conntrack='1'
uci commit firewall.@zone[-1]
uci add firewall forwarding
uci set firewall.@forwarding[-1]=forwarding
uci set firewall.@forwarding[-1].src='wan_trusted'
uci set firewall.@forwarding[-1].dest='wan_trusted'
uci commit firewall.@forwarding[-1]
# Port forwardings (DNAT) are defined by redirect sections.
# All incoming traffic on the specified source zone which matches the given rules will be directed to the specified internal host.
# Redirects are also commonly known as “port forwarding”, and “virtual servers”.
# Port ranges are specified as start:stop, for instance 6666:6670. This is similar to the iptables syntax.
uci add firewall redirect
uci set firewall.@redirect[-1]=redirect
uci set firewall.@redirect[-1].name='ssh from wan to bunker'
uci set firewall.@redirect[-1].src='wan_trusted'
uci set firewall.@redirect[-1].src_dport='23'
uci set firewall.@redirect[-1].dest='trusted'
uci set firewall.@redirect[-1].dest_ip='10.7.11.1'
uci set firewall.@redirect[-1].dest_port='22'
uci set firewall.@redirect[-1].proto='tcp'
uci set firewall.@redirect[-1].target='DNAT'
uci set firewall.@redirect[-1].reflection=1
uci commit firewall.@redirect[-1]
#uci add firewall redirect
#uci set firewall.@redirect[-1]=redirect
#uci set firewall.@redirect[-1].target='DNAT'
#uci set firewall.@redirect[-1].name='capture dns from trusted'
#uci set firewall.@redirect[-1].src='trusted'
#uci set firewall.@redirect[-1].proto='tcpudp'
#uci set firewall.@redirect[-1].src_dport='53'
#uci set firewall.@redirect[-1].proto='tcpudp'
#uci set firewall.@redirect[-1].dest='trusted'
#uci set firewall.@redirect[-1].dest_ip='10.7.11.5'
#uci set firewall.@redirect[-1].dest_port='53'
#uci commit firewall.@redirect[-1]
uci add firewall redirect
uci set firewall.@redirect[-1]=redirect
uci set firewall.@redirect[-1].name='80 on bunker'
uci set firewall.@redirect[-1].src='wan_trusted'
uci set firewall.@redirect[-1].src_dport='80'
uci set firewall.@redirect[-1].dest='trusted'
uci set firewall.@redirect[-1].dest_ip='10.7.11.1'
uci set firewall.@redirect[-1].dest_port='80'
uci set firewall.@redirect[-1].proto='tcp'
uci set firewall.@redirect[-1].target='DNAT'
uci set firewall.@redirect[-1].reflection=1
uci commit firewall.@redirect[-1]
uci add firewall redirect
uci set firewall.@redirect[-1]=redirect
uci set firewall.@redirect[-1].name='443 on bunker'
uci set firewall.@redirect[-1].src='wan_trusted'
uci set firewall.@redirect[-1].dest='trusted'
uci set firewall.@redirect[-1].proto='tcp'
uci set firewall.@redirect[-1].src_dport='443'
uci set firewall.@redirect[-1].dest_ip='10.7.11.1'
uci set firewall.@redirect[-1].dest_port='443'
uci set firewall.@redirect[-1].target='DNAT'
uci set firewall.@redirect[-1].reflection=1
uci commit firewall.@redirect[-1]
uci add firewall redirect
uci set firewall.@redirect[-1]=redirect
uci set firewall.@redirect[-1].target='DNAT'
uci set firewall.@redirect[-1].name='443 on bunker from ff users'
uci set firewall.@redirect[-1].src='wan_notrust'
uci set firewall.@redirect[-1].dest='wan_trusted'
uci set firewall.@redirect[-1].proto='tcp'
uci set firewall.@redirect[-1].src_dport='443'
uci set firewall.@redirect[-1].dest_ip='10.7.11.1'
uci set firewall.@redirect[-1].dest_port='443'
uci commit firewall.@redirect[-1]
# fixme
uci add firewall redirect
uci set firewall.@redirect[-1]=redirect
uci set firewall.@redirect[-1].name='logs from notrust'
uci set firewall.@redirect[-1].src='notrust'
uci set firewall.@redirect[-1].src_dport='514'
uci set firewall.@redirect[-1].dest='trusted'
uci set firewall.@redirect[-1].dest_ip='10.7.11.1'
uci set firewall.@redirect[-1].dest_port='514'
uci set firewall.@redirect[-1].proto='tcp'
uci set firewall.@redirect[-1].target='DNAT'
uci commit firewall.@redirect[-1]
uci add firewall redirect
uci set firewall.@redirect[-1].src='wan_trusted'
uci set firewall.@redirect[-1].name='logs from cable modem'
uci set firewall.@redirect[-1].src_ip='192.168.100.1'
uci set firewall.@redirect[-1].target='DNAT'
uci set firewall.@redirect[-1].dest='trusted'
uci set firewall.@redirect[-1].dest_ip='10.7.11.1'
uci set firewall.@redirect[-1].src_dport='514'
uci set firewall.@redirect[-1].src_dip='192.168.100.5'
uci commit firewall.@redirect[-1]
uci add firewall redirect
uci set firewall.@redirect[-1]=redirect
uci set firewall.@redirect[-1].target='DNAT'
uci set firewall.@redirect[-1].name='plex on bunker'
uci set firewall.@redirect[-1].src='wan_trusted'
uci set firewall.@redirect[-1].dest='trusted'
uci set firewall.@redirect[-1].proto='tcp'
uci set firewall.@redirect[-1].src_dport='32400'
uci set firewall.@redirect[-1].dest_ip='10.7.11.1'
uci set firewall.@redirect[-1].dest_port='32400'
uci set firewall.@redirect[-1].reflection=1
uci commit firewall.@redirect[-1]
uci add firewall redirect
uci set firewall.@redirect[-1]=redirect
uci set firewall.@redirect[-1].target='DNAT'
uci set firewall.@redirect[-1].name='plex on nvidia shield'
uci set firewall.@redirect[-1].src='wan_trusted'
uci set firewall.@redirect[-1].dest='trusted'
uci set firewall.@redirect[-1].proto='tcp'
uci set firewall.@redirect[-1].src_dport='32401'
uci set firewall.@redirect[-1].dest_ip='10.7.11.51'
uci set firewall.@redirect[-1].dest_port='32400'
uci set firewall.@redirect[-1].reflection=1
uci commit firewall.@redirect[-1]
# fix to stop vpn traffic leaving and entering home network
uci add firewall redirect
uci set firewall.@redirect[-1]=redirect
uci set firewall.@redirect[-1].target='DNAT'
uci set firewall.@redirect[-1].name='wireguard'
uci set firewall.@redirect[-1].src='trusted'
uci set firewall.@redirect[-1].dest='wan_trusted'
uci set firewall.@redirect[-1].proto='udp'
uci set firewall.@redirect[-1].src_dport='12321'
uci set firewall.@redirect[-1].dest_ip='10.7.11.5'
uci set firewall.@redirect[-1].dest_port='12321'
uci set firewall.@redirect[-1].reflection=1
uci commit firewall.@redirect[-1]
# Rules
# Sections of the type rule can be used to define basic accept or reject rules to allow or restrict access to specific ports or hosts.
# If src and dest are given, the rule matches forwarded traffic
# If only src is given, the rule matches incoming traffic
# If only dest is given, the rule matches outgoing traffic
# If neither src nor dest are given, the rule defaults to an outgoing traffic rule
###############################################################################
# never lock ourselves out
###############################################################################
uci add firewall rule
uci set firewall.@rule[-1]=rule
uci set firewall.@rule[-1].name='ssh to router'
uci set firewall.@rule[-1].src='*'
uci set firewall.@rule[-1].dest_port='22'
uci set firewall.@rule[-1].proto='tcp'
uci set firewall.@rule[-1].family='any'
uci set firewall.@rule[-1].target='ACCEPT'
uci commit firewall.@rule[-1]
uci add firewall rule
uci set firewall.@rule[-1]=rule
uci set firewall.@rule[-1].name='Allow-Ping'
uci set firewall.@rule[-1].src='*'
uci set firewall.@rule[-1].family='any'
uci set firewall.@rule[-1].proto='icmp'
uci set firewall.@rule[-1].icmp_type='echo-request'
uci set firewall.@rule[-1].target='ACCEPT'
uci commit firewall.@rule[-1]
uci add firewall rule
uci set firewall.@rule[-1]=rule
uci set firewall.@rule[-1].name='wireguard'
uci set firewall.@rule[-1].enabled='1'
uci set firewall.@rule[-1].src='*'
uci set firewall.@rule[-1].proto='udp'
uci set firewall.@rule[-1].dest_port='12321'
uci set firewall.@rule[-1].target='ACCEPT'
uci commit firewall.@rule[-1]
###############################################################################
# WAN specific rules
###############################################################################
uci add firewall rule
uci set firewall.@rule[-1]=rule
uci set firewall.@rule[-1].name='WAN IPv6 input from WAN'
uci set firewall.@rule[-1].src='wan_trusted'
uci set firewall.@rule[-1].proto='icmp'
uci add_list firewall.@rule[-1].icmp_type='echo-request'
uci add_list firewall.@rule[-1].icmp_type='echo-reply'
uci add_list firewall.@rule[-1].icmp_type='destination-unreachable'
uci add_list firewall.@rule[-1].icmp_type='packet-too-big'
uci add_list firewall.@rule[-1].icmp_type='time-exceeded'
uci add_list firewall.@rule[-1].icmp_type='bad-header'
uci add_list firewall.@rule[-1].icmp_type='unknown-header-type'
uci add_list firewall.@rule[-1].icmp_type='router-solicitation'
uci add_list firewall.@rule[-1].icmp_type='neighbour-solicitation'
uci add_list firewall.@rule[-1].icmp_type='router-advertisement'
uci add_list firewall.@rule[-1].icmp_type='neighbour-advertisement'
uci set firewall.@rule[-1].limit='1000/sec'
uci set firewall.@rule[-1].family='ipv6'
uci set firewall.@rule[-1].target='ACCEPT'
uci commit firewall.@rule[-1]
uci add firewall rule
uci set firewall.@rule[-1]=rule
uci set firewall.@rule[-1].name='WAN Forward ICMPv6 from wan to lan'
uci set firewall.@rule[-1].src='wan_trusted'
uci set firewall.@rule[-1].dest='*'
uci set firewall.@rule[-1].proto='icmp'
uci add_list firewall.@rule[-1].icmp_type='echo-request'
uci add_list firewall.@rule[-1].icmp_type='echo-reply'
uci add_list firewall.@rule[-1].icmp_type='destination-unreachable'
uci add_list firewall.@rule[-1].icmp_type='packet-too-big'
uci add_list firewall.@rule[-1].icmp_type='time-exceeded'
uci add_list firewall.@rule[-1].icmp_type='bad-header'
uci add_list firewall.@rule[-1].icmp_type='unknown-header-type'
uci set firewall.@rule[-1].limit='1000/sec'
uci set firewall.@rule[-1].family='ipv6'
uci set firewall.@rule[-1].target='ACCEPT'
uci commit firewall.@rule[-1]
uci add firewall rule
uci set firewall.@rule[-1]=rule
uci set firewall.@rule[-1].name='WAN Allow-ICMPv6-LAN-output'
uci set firewall.@rule[-1].src='*'
uci set firewall.@rule[-1].dest='wan_trusted'
uci set firewall.@rule[-1].proto='icmp'
uci add_list firewall.@rule[-1].icmp_type='echo-request'