summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Dockerfile6
-rw-r--r--init17
-rw-r--r--ssh.conf20
3 files changed, 43 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..618f09f
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,6 @@
+FROM alpine
+RUN apk add --no-cache openssh-server fish
+COPY ssh.conf /etc/ssh/sshd_config.d/
+COPY ./etc/ssh/ /etc/ssh/
+#ENTRYPOINT ["/usr/sbin/sshd", "-D", "-e"]
+ENTRYPOINT ["fish"]
diff --git a/init b/init
new file mode 100644
index 0000000..db06b55
--- /dev/null
+++ b/init
@@ -0,0 +1,17 @@
+#!/usr/sbin/env fish
+
+argparse 'u/users+' 'r/repos+' -- $argv
+
+# create users and copy keys in correct location, set permissions
+for user in $_flag_u
+ echo "Setting up user: $user"
+ set -l HOME="/home/$user"
+ adduser --home $HOME --disabled-password "$user"
+ mkdir "$HOME/.ssh"
+ cp "/srv/keys/$user" "$HOME/.ssh"
+ chown -R $user "$HOME"
+ chmod 700 "$HOME"
+end
+
+# run ssh daemon
+/usr/sbin/sshd -D -e
diff --git a/ssh.conf b/ssh.conf
new file mode 100644
index 0000000..bc96c2f
--- /dev/null
+++ b/ssh.conf
@@ -0,0 +1,20 @@
+PermitRootLogin no
+PasswordAuthentication no
+
+HostKey /etc/ssh/ssh_host_rsa_key
+HostKey /etc/ssh/ssh_host_ecdsa_key
+HostKey /etc/ssh/ssh_host_ed25519_key
+
+# Logging
+SyslogFacility AUTH
+LogLevel INFO
+
+#PermitTTY yes
+#AllowAgentForwarding yes
+
+# Example of overriding settings on a per-user basis
+#Match User anoncvs
+# X11Forwarding no
+# AllowTcpForwarding no
+# PermitTTY no
+# ForceCommand cvs server