diff options
| author | Your Name <you@example.com> | 2026-02-07 19:58:55 +0800 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-02-07 19:58:55 +0800 |
| commit | d1cebc658174a16014c2a3847bdf55bb3553b7fb (patch) | |
| tree | 843abd31aabf15bdf9c78314c69922a5df586531 /start_container.sh | |
| parent | 7bd52ea1ae10870cc2ff8aa5c237679c30ffda72 (diff) | |
more robust for ssh floods
Diffstat (limited to 'start_container.sh')
| -rwxr-xr-x | start_container.sh | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/start_container.sh b/start_container.sh index 25fcb10..2299390 100755 --- a/start_container.sh +++ b/start_container.sh | |||
| @@ -33,6 +33,7 @@ podman run -d \ | |||
| 33 | --network ${NETWORK} \ | 33 | --network ${NETWORK} \ |
| 34 | --ip ${PRIVATE_IP} \ | 34 | --ip ${PRIVATE_IP} \ |
| 35 | --cap-add=NET_ADMIN \ | 35 | --cap-add=NET_ADMIN \ |
| 36 | --pids-limit=100 \ | ||
| 36 | --env-file "$(dirname "$0")/config.env" \ | 37 | --env-file "$(dirname "$0")/config.env" \ |
| 37 | -v ${CONTAINER_NAME}_data:/data \ | 38 | -v ${CONTAINER_NAME}_data:/data \ |
| 38 | -v /git:/git \ | 39 | -v /git:/git \ |
| @@ -40,6 +41,7 @@ podman run -d \ | |||
| 40 | 41 | ||
| 41 | # Setup public IP | 42 | # Setup public IP |
| 42 | sleep 2 | 43 | sleep 2 |
| 44 | # Get the container's network interface name (e.g. eth0) | ||
| 43 | IFACE=$(podman exec ${CONTAINER_NAME} sh -c "ip -o link | grep -v lo | head -1 | cut -d: -f2 | tr -d ' ' | cut -d@ -f1") | 45 | IFACE=$(podman exec ${CONTAINER_NAME} sh -c "ip -o link | grep -v lo | head -1 | cut -d: -f2 | tr -d ' ' | cut -d@ -f1") |
| 44 | podman exec ${CONTAINER_NAME} ip addr add ${PUBLIC_IP}/32 dev ${IFACE} | 46 | podman exec ${CONTAINER_NAME} ip addr add ${PUBLIC_IP}/32 dev ${IFACE} |
| 45 | ip route add ${PUBLIC_IP}/32 via ${PRIVATE_IP} | 47 | ip route add ${PUBLIC_IP}/32 via ${PRIVATE_IP} |
