Skip to content

Commit 9822e05

Browse files
committed
add config option to enable the firewall log
1 parent 782aa99 commit 9822e05

File tree

5 files changed

+24
-8
lines changed

5 files changed

+24
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
`current version:` ![calver](https://img.shields.io/github/v/release/freifunk-dresden/ffdd-server?include_prereleases)
33

44
## version 1.5.0rc3
5-
- switch to new sysinfo.json version that combines network statistics and makes it interface independent
5+
- switch to new sysinfo.json version 18 that combines network statistics and makes it interface independent
6+
- add config option to enable the firewall log
67

78
## version 1.5.0rc2
89
- remove support for debian 10

salt/freifunk/base/iptables/etc/init.d/S41firewall

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ WAN_DEV="$(uci -qX get ffdd.sys.ifname)"
1919
# see S53batman for more info.
2020
FFGW_IF='ffgw'
2121

22+
eval "$(ddmesh-ipcalc.sh -n "$(uci -qX get ffdd.sys.ddmesh_node)")"
2223

24+
LOG="$(uci -qX get ffdd.sys.firewall_log)"
2325

24-
eval "$(ddmesh-ipcalc.sh -n "$(uci -qX get ffdd.sys.ddmesh_node)")"
2526

2627
# iptables command
2728
IPT="$(command -v iptables)"
@@ -50,7 +51,7 @@ if [ "$1" = "start" ]; then
5051

5152
#masquerade all to vpn tunnel: rules are set by openvpn/wireguard scripts
5253

53-
# allow local internet
54+
# allow local internet
5455
if [ "$(uci -qX get ffdd.sys.announce_gateway)" = "1" ]; then
5556
$IPT -w -t nat -A POSTROUTING -o ${WAN_DEV} -j MASQUERADE
5657
fi
@@ -118,7 +119,9 @@ if [ "$1" = "start" ]; then
118119
#drop packages before logging
119120
$IPT -w -A INPUT -i "$WAN_DEV" -p udp --dport 137 -j DROP
120121

121-
$IPT -w -A INPUT -j LOG --log-prefix "DROP IPv4 INPUT: "
122+
if [ "$LOG" = '1' ]; then
123+
$IPT -w -A INPUT -j LOG --log-prefix "DROP IPv4 INPUT: "
124+
fi
122125
$IPT -w -A INPUT -j DROP
123126

124127
#----- setup FORWARD rules -----
@@ -157,13 +160,15 @@ if [ "$1" = "start" ]; then
157160
$IPT -w -A FORWARD -i ${FFGW_IF} ! -s ${_ddmesh_meshnet} -j DROP
158161
$IPT -w -A FORWARD -i ${FFGW_IF} -o vpn+ -j ACCEPT
159162

160-
# allow local internet
163+
# allow local internet
161164
if [ "$(uci -qX get ffdd.sys.announce_gateway)" = "1" ]; then
162165
$IPT -w -A FORWARD -i ${FFGW_IF} -o ${WAN_DEV} -j ACCEPT
163166
fi
164167

165168
#block any other
166-
$IPT -w -A FORWARD -j LOG --log-prefix "DROP IPv4 FORWARD: "
169+
if [ "$LOG" = '1' ]; then
170+
$IPT -w -A FORWARD -j LOG --log-prefix "DROP IPv4 FORWARD: "
171+
fi
167172
$IPT -w -A FORWARD -j DROP
168173

169174
#----- setup OUTPUT rules -----

salt/freifunk/base/iptables/etc/init.d/S42firewall6

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ WAN_DEV="$(uci -qX get ffdd.sys.ifname)"
1616

1717
eval "$(ddmesh-ipcalc.sh -n $(uci -qX get ffdd.sys.ddmesh_node))"
1818

19+
LOG="$(uci -qX get ffdd.sys.firewall_log)"
20+
1921

2022
if [ "$1" = "start" ]; then
2123

@@ -99,7 +101,9 @@ if [ "$1" = "start" ]; then
99101
ip6tables -w -A INPUT -i "$BACKBONE_DEV" -p 4 -j ACCEPT
100102
ip6tables -w -A INPUT -i "$BACKBONE_DEV" -p 41 -j ACCEPT
101103

102-
ip6tables -w -A INPUT -j LOG --log-prefix "DROP IPv6 INPUT: "
104+
if [ "$LOG" = '1' ]; then
105+
ip6tables -w -A INPUT -j LOG --log-prefix "DROP IPv6 INPUT: "
106+
fi
103107
ip6tables -w -A INPUT -j DROP
104108

105109

@@ -119,7 +123,9 @@ if [ "$1" = "start" ]; then
119123
ip6tables -w -A FORWARD -i bmx+ -o vpn+ -j ACCEPT
120124

121125
#block any other
122-
ip6tables -w -A FORWARD -j LOG --log-prefix "DROP IPv6 FORWARD: "
126+
if [ "$LOG" = '1' ]; then
127+
ip6tables -w -A FORWARD -j LOG --log-prefix "DROP IPv6 FORWARD: "
128+
fi
123129
ip6tables -w -A FORWARD -j DROP
124130

125131
#----- setup OUTPUT rules -----

salt/freifunk/base/uci/etc/config/ffdd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ config 'ffdd' 'sys'
7474
# so that any other may use it in for instance in maps or hotspot lists (leipzig does uses this)
7575
option 'group_id' '0'
7676

77+
# firewall log enabled (1) or disabled (0)
78+
option 'firewall_log' '0'
79+
7780
config fastd 'fastd'
7881
# this is the secret key which is used to decrypt secured backbone connection
7982
# the corresponding public key should be given to the peers, so those can encrpyt/connect to this server

salt/freifunk/base/uci/usr/local/bin/uci_check_config_options.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
test -n "$(uci -qX get ffdd.sys.ddmesh_disable_gateway)" && uci -q delete ffdd.sys.ddmesh_disable_gateway
1515
test -z "$(uci -qX get ffdd.sys.announce_gateway)" && uci -q set ffdd.sys.announce_gateway=0
1616
test -z "$(uci -qX get ffdd.sys.group_id)" && uci -q set ffdd.sys.group_id=0
17+
test -z "$(uci -qX get ffdd.sys.firewall_log)" && uci -q set ffdd.sys.firewall_log=0
1718

1819

1920
## ffdd.wireguard

0 commit comments

Comments
 (0)