|
| 1 | +# This script is sourced from firewall script and contains image-specific rules |
| 2 | +# See also: bob-common/mkosi.extra/usr/bin/init-firewall.sh |
| 3 | + |
| 4 | +# Image-specific ports |
| 5 | +SSH_CONTROL_PORT=22 |
| 6 | +SSH_DATA_PORT=10022 |
| 7 | +SSH_REGISTER_PORT=8080 |
| 8 | +CVM_REVERSE_PROXY_PORT=8745 |
| 9 | +SEARCHER_INPUT_PORT=27017 |
| 10 | + |
| 11 | +# Well-known ports |
| 12 | +DNS_PORT=53 |
| 13 | +HTTP_PORT=80 |
| 14 | +HTTPS_PORT=443 |
| 15 | +NTP_PORT=123 |
| 16 | +OP_NODE_P2P_PORT=9222 |
| 17 | +OP_GETH_P2P_PORT=30303 |
| 18 | +ENGINE_API_PORT=8651 |
| 19 | + |
| 20 | +########################################################################### |
| 21 | +# (1) ALWAYS_IN: Inbound rules that are always applied |
| 22 | +########################################################################### |
| 23 | + |
| 24 | +accept_dst_port $CHAIN_ALWAYS_IN tcp $SSH_CONTROL_PORT "SSH control port" |
| 25 | +accept_dst_port $CHAIN_ALWAYS_IN udp $SEARCHER_INPUT_PORT "Searcher input channel" |
| 26 | + |
| 27 | +# We drive op-geth in the searcher container from external op-node |
| 28 | +accept_src_ip_dst_port $CHAIN_ALWAYS_IN tcp "$METADATA_BOB_L2_OP_NODE_CIDR" $ENGINE_API_PORT "Engine API" |
| 29 | + |
| 30 | +# CVM reverse-proxy serves server attestation |
| 31 | +# Also forwards request to ssh pubkey server on localhost:5001, |
| 32 | +# which serves searcher-container openssh server pubkey |
| 33 | +accept_dst_port $CHAIN_ALWAYS_IN tcp $CVM_REVERSE_PROXY_PORT "CVM reverse-proxy" |
| 34 | + |
| 35 | +########################################################################### |
| 36 | +# (2) ALWAYS_OUT: Outbound rules that are always applied |
| 37 | +########################################################################### |
| 38 | + |
| 39 | +# Note: this is accessible only from host, searcher netns has DROP on those |
| 40 | +# See also init-container.sh |
| 41 | +accept_dst_port $CHAIN_ALWAYS_OUT udp $NTP_PORT "NTP" |
| 42 | + |
| 43 | +accept_dst_ip_port $CHAIN_ALWAYS_OUT tcp "$METADATA_BOB_L2_BACKRUNS_IP" $HTTP_PORT "bundle" |
| 44 | + |
| 45 | +########################################################################### |
| 46 | +# (3) MAINTENANCE_IN: Inbound rules for Maintenance Mode |
| 47 | +########################################################################### |
| 48 | + |
| 49 | +accept_dst_port $CHAIN_MAINTENANCE_IN tcp $SSH_DATA_PORT "SSH data plane" |
| 50 | +accept_dst_port $CHAIN_MAINTENANCE_IN tcp $SSH_REGISTER_PORT "SSH register service" |
| 51 | + |
| 52 | +accept_dst_port $CHAIN_MAINTENANCE_IN tcp $OP_GETH_P2P_PORT "op-geth P2P (TCP)" |
| 53 | +accept_dst_port $CHAIN_MAINTENANCE_IN udp $OP_GETH_P2P_PORT "op-geth P2P (UDP)" |
| 54 | + |
| 55 | +########################################################################### |
| 56 | +# (4) MAINTENANCE_OUT: Outbound rules for Maintenance Mode |
| 57 | +########################################################################### |
| 58 | + |
| 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 | + |
| 62 | +accept_dst_port $CHAIN_MAINTENANCE_OUT udp $DNS_PORT "DNS (UDP)" |
| 63 | +accept_dst_port $CHAIN_MAINTENANCE_OUT tcp $DNS_PORT "DNS (TCP)" |
| 64 | + |
| 65 | +accept_dst_port $CHAIN_MAINTENANCE_OUT tcp $HTTP_PORT "HTTP" |
| 66 | +accept_dst_port $CHAIN_MAINTENANCE_OUT tcp $HTTPS_PORT "HTTPS" |
| 67 | + |
| 68 | +accept_dst_port $CHAIN_MAINTENANCE_OUT tcp $OP_GETH_P2P_PORT "op-geth P2P (TCP)" |
| 69 | +accept_dst_port $CHAIN_MAINTENANCE_OUT udp $OP_GETH_P2P_PORT "op-geth P2P (UDP)" |
| 70 | + |
| 71 | +########################################################################### |
| 72 | +# (5) PRODUCTION_IN: Inbound rules for Production Mode |
| 73 | +########################################################################### |
| 74 | + |
| 75 | +# None at the moment |
| 76 | + |
| 77 | +########################################################################### |
| 78 | +# (6) PRODUCTION_OUT: Outbound rules for Production Mode |
| 79 | +########################################################################### |
| 80 | + |
| 81 | +accept_dst_ip_port $CHAIN_PRODUCTION_OUT tcp "$METADATA_BOB_L2_TX_STREAM_IP" $HTTP_PORT "tx stream" |
0 commit comments