summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYour Name <you@example.com>2026-02-07 19:58:55 +0800
committerYour Name <you@example.com>2026-02-07 19:58:55 +0800
commitd1cebc658174a16014c2a3847bdf55bb3553b7fb (patch)
tree843abd31aabf15bdf9c78314c69922a5df586531
parent7bd52ea1ae10870cc2ff8aa5c237679c30ffda72 (diff)
more robust for ssh floods
-rw-r--r--docs (renamed from README)3
-rw-r--r--sshd_config4
-rwxr-xr-xstart_container.sh2
3 files changed, 9 insertions, 0 deletions
diff --git a/README b/docs
index c71655b..89d3373 100644
--- a/README
+++ b/docs
@@ -55,5 +55,8 @@ Cleanup:
55Logs: 55Logs:
56 podman logs -f cgit 56 podman logs -f cgit
57 57
58Processes:
59 podman exec cgit ps aux
60
58Shell: 61Shell:
59 podman exec -it cgit sh 62 podman exec -it cgit sh
diff --git a/sshd_config b/sshd_config
index ab4c469..5d31e36 100644
--- a/sshd_config
+++ b/sshd_config
@@ -3,4 +3,8 @@ PermitRootLogin prohibit-password
3PasswordAuthentication no 3PasswordAuthentication no
4PubkeyAuthentication yes 4PubkeyAuthentication yes
5AuthorizedKeysFile /git/.ssh/authorized_keys 5AuthorizedKeysFile /git/.ssh/authorized_keys
6# Max 3 concurrent unauthenticated connections, drop 50% above that, hard cap at 10
7MaxStartups 3:50:10
8# Kill unauthenticated connections after 15 seconds
9LoginGraceTime 15
6Subsystem sftp /usr/lib/ssh/sftp-server 10Subsystem sftp /usr/lib/ssh/sftp-server
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
42sleep 2 43sleep 2
44# Get the container's network interface name (e.g. eth0)
43IFACE=$(podman exec ${CONTAINER_NAME} sh -c "ip -o link | grep -v lo | head -1 | cut -d: -f2 | tr -d ' ' | cut -d@ -f1") 45IFACE=$(podman exec ${CONTAINER_NAME} sh -c "ip -o link | grep -v lo | head -1 | cut -d: -f2 | tr -d ' ' | cut -d@ -f1")
44podman exec ${CONTAINER_NAME} ip addr add ${PUBLIC_IP}/32 dev ${IFACE} 46podman exec ${CONTAINER_NAME} ip addr add ${PUBLIC_IP}/32 dev ${IFACE}
45ip route add ${PUBLIC_IP}/32 via ${PRIVATE_IP} 47ip route add ${PUBLIC_IP}/32 via ${PRIVATE_IP}