v1
This commit is contained in:
commit
8d4915543e
132 files changed
+20628
No files matched your search
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
# Prepares host keys and the test users, starts a small HTTP server for the
|
||||
# tunnel tests (reachable only on the target itself), then runs sshd.
|
||||
set -eu
|
||||
|
||||
[ -f /etc/ssh/ssh_host_ed25519_key ] || ssh-keygen -q -t ed25519 -N '' -f /etc/ssh/ssh_host_ed25519_key
|
||||
|
||||
for user in ops admin; do
|
||||
home="/home/$user"
|
||||
mkdir -p "$home/.ssh"
|
||||
cp /keys/authorized_keys "$home/.ssh/authorized_keys"
|
||||
chown -R "$user:$user" "$home/.ssh"
|
||||
chmod 700 "$home/.ssh"
|
||||
chmod 600 "$home/.ssh/authorized_keys"
|
||||
done
|
||||
|
||||
mkdir -p /srv/www
|
||||
echo "hello from $(hostname)" > /srv/www/index.html
|
||||
python3 -m http.server 8081 --bind 127.0.0.1 --directory /srv/www >/dev/null 2>&1 &
|
||||
|
||||
exec /usr/sbin/sshd -D -e
|
||||
@@ -0,0 +1,18 @@
|
||||
# Test targets accept the generated test key only. Port 2222 tests ssh.default_port.
|
||||
Port 22
|
||||
Port 2222
|
||||
ListenAddress 0.0.0.0
|
||||
ListenAddress ::
|
||||
HostKey /etc/ssh/ssh_host_ed25519_key
|
||||
PermitRootLogin no
|
||||
PasswordAuthentication no
|
||||
KbdInteractiveAuthentication no
|
||||
PubkeyAuthentication yes
|
||||
AuthorizedKeysFile .ssh/authorized_keys
|
||||
AllowTcpForwarding yes
|
||||
AllowAgentForwarding yes
|
||||
GatewayPorts no
|
||||
PermitTunnel no
|
||||
X11Forwarding no
|
||||
PrintMotd no
|
||||
Subsystem sftp /usr/lib/ssh/sftp-server
|
||||
@@ -0,0 +1,16 @@
|
||||
# SSH target for the netssh test environment: every NetBox host, the bastion,
|
||||
# and the static host run this image with a different hostname.
|
||||
FROM alpine:3.24
|
||||
|
||||
# Alpine locks new accounts with "!"; sshd refuses key logins for locked
|
||||
# accounts, so the password field is set to "*" (no password, not locked).
|
||||
RUN apk add --no-cache openssh-server openssh-sftp-server python3 \
|
||||
&& for user in ops admin; do \
|
||||
adduser -D -s /bin/sh "$user" && sed -i "s/^$user:!/$user:*/" /etc/shadow; \
|
||||
done
|
||||
|
||||
COPY testenv/targets/sshd_config /etc/ssh/sshd_config
|
||||
COPY testenv/targets/entrypoint.sh /entrypoint.sh
|
||||
|
||||
EXPOSE 22 2222
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
Reference in new issue
Block a user