Skip to content

Commit ba5911f

Browse files
committed
bob-common: add helper iptables func drop_dst_ip
1 parent bbbd47d commit ba5911f

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

bob-common/mkosi.extra/usr/bin/init-firewall.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,14 @@ accept_dst_ip_port() {
124124
-m comment --comment "$comment"
125125
}
126126

127+
drop_dst_ip() {
128+
chain="$1"
129+
ip="$2"
130+
comment="$3"
131+
132+
iptables -A "$chain" -d "$ip" -j DROP \
133+
-m comment --comment "$comment"
134+
}
127135

128136
###########################################################################
129137
# (5) Load firewall rules in {MAINTENANCE,PRODUCTION}_{IN,OUT} chains.

bob-l1/mkosi.extra/etc/firewall-config

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,7 @@ accept_dst_port $CHAIN_MAINTENANCE_IN udp $EL_P2P_PORT "EL P2P (UDP)"
8484
###########################################################################
8585

8686
# Block Flashbots protect tx endpoints during maintenance
87-
iptables -A $CHAIN_MAINTENANCE_OUT \
88-
-d $FLASHBOTS_TX_STREAM_1,$FLASHBOTS_TX_STREAM_2 -j DROP \
89-
-m comment --comment "Flashbots Protect (DROP before accept-all 443)"
87+
drop_dst_ip $CHAIN_MAINTENANCE_OUT $FLASHBOTS_TX_STREAM_1,$FLASHBOTS_TX_STREAM_2 "Flashbots Protect (DROP before accept-all rules)"
9088

9189
accept_dst_port $CHAIN_MAINTENANCE_OUT udp $DNS_PORT "DNS (UDP)"
9290
accept_dst_port $CHAIN_MAINTENANCE_OUT tcp $DNS_PORT "DNS (TCP)"

0 commit comments

Comments
 (0)