@@ -41,7 +41,7 @@ su -s /bin/sh searcher -c "cd ~ && podman run -d \
4141 while true; do /usr/sbin/sshd -D -e; sleep 5; done'"
4242
4343# Attempt a quick check that the container is running
44- for i in 1 2 3 4 5 ; do
44+ for i in $( seq 1 5 ) ; do
4545 status=$( su -s /bin/sh - searcher -c " podman inspect --format '{{.State.Status}}' $NAME 2>/dev/null || true" )
4646 if [ " $status " = " running" ]; then
4747 break
@@ -63,24 +63,25 @@ if [ -z "$pid" ] || [ "$pid" = "0" ]; then
6363fi
6464
6565echo " Applying iptables rules in $NAME (PID: $pid ) network namespace..."
66+ ns_iptables () { nsenter --target " $pid " --net iptables " $@ " }
6667
67- # Enter network namespace and apply DROP rules on port 9000 TCP/UDP
68- nsenter --target " $pid " --net iptables -A OUTPUT -p tcp --dport 9000 -j DROP
69- nsenter --target " $pid " --net iptables -A OUTPUT -p udp --dport 9000 -j DROP
68+ ns_iptables -A OUTPUT -d 169.254.169.254 -j DROP
7069
71- # Enter network namespace and apply DROP rule on port 123 UDP
72- nsenter --target " $pid " --net iptables - A OUTPUT -p udp --dport 123 -j DROP
70+ ns_iptables -A OUTPUT -p tcp --dport 9000 -j DROP
71+ ns_iptables - A OUTPUT -p udp --dport 9000 -j DROP
7372
74- # Drop outbound traffic from SEARCHER_INPUT_CHANNEL
75- nsenter --target " $pid " --net iptables -A OUTPUT -p udp --sport $SEARCHER_INPUT_CHANNEL -j DROP
76- nsenter --target " $pid " --net iptables -A OUTPUT -p tcp --sport $SEARCHER_INPUT_CHANNEL -j DROP
73+ ns_iptables -A OUTPUT -p udp --dport 123 -j DROP
7774
78- echo " Injecting static hosts into $NAME ..."
75+ ns_iptables -A OUTPUT -p udp --sport $SEARCHER_INPUT_CHANNEL -j DROP
76+ ns_iptables -A OUTPUT -p tcp --sport $SEARCHER_INPUT_CHANNEL -j DROP
7977
80- su -s /bin/sh searcher -c " podman exec $NAME /bin/sh -c '
81- echo \" 3.149.14.12 tx.tee-searcher.flashbots.net\" >> /etc/hosts &&
82- echo \" 3.136.107.142 tx.tee-searcher.flashbots.net\" >> /etc/hosts &&
83- echo \" 18.221.59.61 backruns.tee-searcher.flashbots.net\" >> /etc/hosts &&
84- echo \" 3.15.88.156 backruns.tee-searcher.flashbots.net\" >> /etc/hosts &&
85- echo \" 52.207.17.217 fbtee.titanbuilder.xyz\" >> /etc/hosts
86- '"
78+ # Helper, only used in sourced script below
79+ exec_in_container () {
80+ su -s /bin/sh searcher -c " podman exec $NAME /bin/sh -c '$1 '"
81+ }
82+
83+ # Run extra commands which are customized per image,
84+ # see bob*/mkosi.extra/etc/searcher-container-init-extra
85+ #
86+ # `source` is not supported in dash
87+ . /etc/searcher-container-init-extra
0 commit comments