1
0
This commit is contained in:
michael 2023-12-14 14:35:02 +13:00
commit 6ef2a1c876
10 changed files with 108 additions and 0 deletions

37
Dockerfile Normal file
View File

@ -0,0 +1,37 @@
FROM ubuntu:latest
ENV DEBIAN_FRONTEND=noninteractive
# Install packages
RUN apt update && \
apt install --no-install-recommends -y \
nano \
openssh-server \
openssh-client \
rsync \
sudo && \
rm -rf /var/lib/apt/lists/*
# User setup
RUN useradd -m -d /home/user -s /bin/bash -U -u 1000 user && \
mkdir /home/user/.ssh && \
chown -R user:user /home/user/.ssh && \
mkdir /sftp && \
chown root:root /sftp && \
chmod 755 /sftp
RUN echo 'user:password' | chpasswd
COPY authorized_keys /home/user/.ssh/
COPY sshd_config ssh_host_* /etc/ssh/
RUN chown user:user /home/user/.ssh/authorized_keys && \
chmod 644 /home/user/.ssh/authorized_keys && \
chown root:root /etc/ssh/* && \
chmod 644 /etc/ssh/sshd_config && \
chmod 600 /etc/ssh/ssh_host_ed25519_key && \
chmod 644 /etc/ssh/ssh_host_ed25519_key.pub && \
mkdir /run/sshd
EXPOSE 22
CMD ["/usr/sbin/sshd","-D","-e"]

1
authorized_keys Normal file
View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE26RPGDs9sn0Sf99pH87Eq7ipDJ6tI5ojx0NfdhEr2B

5
build.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
docker build -t code.balsillie.net/containers/sftp:latest -t quay.io/balsillie/sftp:latest .
docker push code.balsillie.net/containers/sftp:latest
docker push quay.io/balsillie/sftp:latest

7
id_ed25519 Normal file
View File

@ -0,0 +1,7 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACBNukTxg7PbJ9En/faR/OxKu4qQyerSOaI8dDX3YRK9gQAAAJglASzhJQEs
4QAAAAtzc2gtZWQyNTUxOQAAACBNukTxg7PbJ9En/faR/OxKu4qQyerSOaI8dDX3YRK9gQ
AAAEBaA+9x3FzHUjmoj6Smm0LCY4bC4RVRe0PoPuPUlW4EcU26RPGDs9sn0Sf99pH87Eq7
ipDJ6tI5ojx0NfdhEr2BAAAAD21pY2hhZWxAbGF0NTQyMAECAwQFBg==
-----END OPENSSH PRIVATE KEY-----

1
id_ed25519.pub Normal file
View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE26RPGDs9sn0Sf99pH87Eq7ipDJ6tI5ojx0NfdhEr2B

7
ssh_host_ed25519_key Normal file
View File

@ -0,0 +1,7 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACCXh5j4aROx8hfr+oZpyya27uGfgS8ZendpPfDW0SN9IQAAAJjZJLWm2SS1
pgAAAAtzc2gtZWQyNTUxOQAAACCXh5j4aROx8hfr+oZpyya27uGfgS8ZendpPfDW0SN9IQ
AAAEAOyT0w3/3vSEA0s3yA18H7hQM9IAVhn6oIZYpnGaHlf5eHmPhpE7HyF+v6hmnLJrbu
4Z+BLxl6d2k98NbRI30hAAAAD21pY2hhZWxAbGF0NTQyMAECAwQFBg==
-----END OPENSSH PRIVATE KEY-----

1
ssh_host_ed25519_key.pub Normal file
View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJeHmPhpE7HyF+v6hmnLJrbu4Z+BLxl6d2k98NbRI30h

27
ssh_host_rsa_key Normal file
View File

@ -0,0 +1,27 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdzc2gtcn
NhAAAAAwEAAQAAAQEA0R/rRxwTSQPTNuaEVulojiT6g63B4CtCwiyc/tPOJQoVwzzvKxF/
2B2+eaLlY8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uwHNmaJyqET4C25YWXZsTeT4nf4n8p3O1wQwRSnT9biplheHxK
QRwA9cE8VO6Id1+XwFONM59D0Ly/gvXq3mvZZQEF2xnGIlEyE/if14qya3BvRL16uh1J3G
TSAgVEjxDzAAAAgQD8c8eNIaCENCpMR33JBEh92WvlTnT0YzSlX1+g0YcfnEjIviH0yGvO
jCNo0avrqhvebqDiEMe0HBged0/Obq6kvMMjtTtC4dOZmC3GyBnDq/xse1pHUMtOId2X0C
ZjeV7W4mdMIu3CJ4PLoBPmM6Z4oEf7CbpkGUb5Zozm0GoMpQAAAIEA1BBDugozhiic5wG6
bOSyENrnLPbcFo8Jpj/TphCSreB8qxSPf+Z8vTutjrQdZbg+Nbxz+n9JVblvveywqm9H7q
+gv/ZKusjEcT5pqwxZqRUQJhSpmobshqTXALZDHOBB477Cfyk7Hh8TqyR7DrIPNjGLbGI2
hcMSys/gJKb+qm0AAAAPbWljaGFlbEBsYXQ1NDIwAQIDBA==
-----END OPENSSH PRIVATE KEY-----

1
ssh_host_rsa_key.pub Normal file
View File

@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDRH+tHHBNJA9M25oRW6WiOJPqDrcHgK0LCLJz+084lChXDPO8rEX/YHb55ouVjwqbYr6AXx9h/kF9ZpKzYOHncSfpASIkRhMFNxsWM6pqCJTnRor9a7T+iYWfl/k3aM/l2d1ouoJdFkAiaihLoiOUNrwwwAPTEMLk8+UG955dCJrEw+nH2jkcrrUEYrtoaTMyAT2nBnx4h/xUQ5M6E+Ba94iYSc/HcRv2Vk63GxXmRRCB9jJOKEt/2XOl7iBMOufljuTlNRuwH2afJPGG8r18usbBr5vPKsiRRjVVQBLdGTPNaLqhcRMKM1pSJq8JnWmUuLj/XmydlGkfH+UyzQvRB michael@lat5420

21
sshd_config Normal file
View File

@ -0,0 +1,21 @@
Port 22
AddressFamily any
ListenAddress 0.0.0.0
ListenAddress ::
HostKey /etc/ssh/ssh_host_ed25519_key
HostKey /etc/ssh/ssh_host_rsa_key
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication yes
KbdInteractiveAuthentication no
UsePAM yes
PrintMotd no
Subsystem sftp internal-sftp
Match Group user
ChrootDirectory /sftp
PermitTunnel no
AllowAgentForwarding no
AllowTCPForwarding no
X11Forwarding no
ForceCommand internal-sftp