Skip to content

Commit 7fc7f12

Browse files
committed
bob-l2: adjust firewall rules to include metadata IPs
1 parent 4d57d9c commit 7fc7f12

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ accept_dst_port $CHAIN_ALWAYS_IN tcp $SSH_CONTROL_PORT "SSH control port"
2525
accept_dst_port $CHAIN_ALWAYS_IN udp $SEARCHER_INPUT_PORT "Searcher input channel"
2626

2727
# We drive op-geth in the searcher container from external op-node
28-
# TODO: parametrize op-node IP range
29-
accept_src_ip_dst_port $CHAIN_ALWAYS_IN tcp "10.0.0.0/8" $ENGINE_API_PORT "Engine API"
28+
accept_src_ip_dst_port $CHAIN_ALWAYS_IN tcp "$METADATA_BOB_L2_OP_NODE_CIDR" $ENGINE_API_PORT "Engine API"
3029

3130
# CVM reverse-proxy serves server attestation
3231
# Also forwards request to ssh pubkey server on localhost:5001,
@@ -41,7 +40,7 @@ accept_dst_port $CHAIN_ALWAYS_IN tcp $CVM_REVERSE_PROXY_PORT "CVM reverse-proxy"
4140
# See also init-container.sh
4241
accept_dst_port $CHAIN_ALWAYS_OUT udp $NTP_PORT "NTP"
4342

44-
# TODO: simulator bundle endpoint will be here, parameterized
43+
accept_dst_ip_port $CHAIN_ALWAYS_OUT tcp "$METADATA_BOB_L2_BACKRUNS_IP" $HTTP_PORT "bundle"
4544

4645
###########################################################################
4746
# (3) MAINTENANCE_IN: Inbound rules for Maintenance Mode
@@ -57,6 +56,9 @@ accept_dst_port $CHAIN_MAINTENANCE_IN udp $OP_GETH_P2P_PORT "op-geth P2P (UDP)"
5756
# (4) MAINTENANCE_OUT: Outbound rules for Maintenance Mode
5857
###########################################################################
5958

59+
# Block tx endpoint during maintenance
60+
drop_dst_ip $CHAIN_MAINTENANCE_OUT "$METADATA_BOB_L2_TX_STREAM_IP" "tx stream (DROP before accept-all rules)"
61+
6062
accept_dst_port $CHAIN_MAINTENANCE_OUT udp $DNS_PORT "DNS (UDP)"
6163
accept_dst_port $CHAIN_MAINTENANCE_OUT tcp $DNS_PORT "DNS (TCP)"
6264

@@ -76,6 +78,4 @@ accept_dst_port $CHAIN_MAINTENANCE_OUT udp $OP_GETH_P2P_PORT "op-geth P2P (UDP)"
7678
# (6) PRODUCTION_OUT: Outbound rules for Production Mode
7779
###########################################################################
7880

79-
# None at the moment
80-
81-
# TODO: simulator tx stream websocket will be here, parameterized
81+
accept_dst_ip_port $CHAIN_PRODUCTION_OUT tcp "$METADATA_BOB_L2_TX_STREAM_IP" $HTTP_PORT "tx stream"
Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
# This script is sourced from init-container.sh and contains image-specific stuff
22
# See also: bob-common/mkosi.extra/usr/bin/init-container.sh
33

4-
echo "Injecting static hosts into searcher container..."
5-
exec_in_container '
4+
exec_in_container "
65
cat <<EOF >> /etc/hosts
7-
EOF'
6+
$METADATA_BOB_L2_TX_STREAM_IP tx-stream.internal
7+
$METADATA_BOB_L2_BACKRUNS_IP backruns.internal
8+
EOF"
9+
10+
# Copy metadata into the container for transparency
11+
#
12+
# This might be implemented as bind read-only mount in the future,
13+
# but customizing container startup per bob-l2 is too complex for now
14+
15+
metadata=$(cat /etc/metadata.env)
16+
exec_in_container "
17+
cat <<EOF >> /etc/metadata.env
18+
$metadata
19+
EOF"

0 commit comments

Comments
 (0)