25.3.2026 V2

This commit is contained in:
2026-03-25 10:10:09 +01:00
parent f8a78c0ead
commit 9c8606ef11
18 changed files with 96 additions and 1 deletions

View File

@@ -0,0 +1,13 @@
services:
sshd:
build:
context: ./sshd
container_name: sshd-container
restart: unless-stopped
ports:
- "2222:22"
volumes:
- ./keys/authorized_keys:/home/docker/.ssh/authorized_keys:ro
- ./keys/host_keys:/etc/ssh/host_keys
- ./data:/data
command: ["/usr/sbin/sshd","-D","-e"]

View File

@@ -0,0 +1,29 @@
#!/bin/bash
set -e
KEY_DIR="./keys"
HOST_KEY_DIR="$KEY_DIR/host_keys"
mkdir -p "$HOST_KEY_DIR"
echo "Generating RSA host key..."
ssh-keygen \
-t rsa \
-b 4096 \
-f "$HOST_KEY_DIR/ssh_host_rsa_key" \
-N ""
echo "Generating RSA client key..."
ssh-keygen \
-t rsa \
-b 4096 \
-f "$KEY_DIR/client_rsa" \
-N ""
echo "Creating authorized_keys..."
cp "$KEY_DIR/client_rsa.pub" "$KEY_DIR/authorized_keys"
chmod 700 "$KEY_DIR"
chmod 600 "$KEY_DIR/client_rsa"
chmod 644 "$KEY_DIR/client_rsa.pub"
chmod 600 "$KEY_DIR/authorized_keys"
chmod 600 "$HOST_KEY_DIR/ssh_host_rsa_key"
echo
echo "RSA keys generated successfully."
echo
echo "Client private key:"
echo "$KEY_DIR/client_rsa"

View File

View File