From 98dc1fb1a5e6c427fa563e99578977f39a37f757 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Tue, 28 Sep 2021 15:55:15 +0200 Subject: [PATCH] prepare for k3s --- Dockerfile | 4 ++-- README.md | 17 +++++++++++++++-- rootfs/etc/confd/templates/proftpd.conf.tmpl | 4 ++-- rootfs/etc/cont-init.d/02-dhparam | 5 ----- .../{04-static-user => 02-static-user} | 0 rootfs/etc/cont-init.d/03-ssh-keys | 5 ----- 6 files changed, 19 insertions(+), 16 deletions(-) delete mode 100644 rootfs/etc/cont-init.d/02-dhparam rename rootfs/etc/cont-init.d/{04-static-user => 02-static-user} (100%) delete mode 100644 rootfs/etc/cont-init.d/03-ssh-keys diff --git a/Dockerfile b/Dockerfile index 9100c89..992fc06 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,6 +20,6 @@ ADD /rootfs / WORKDIR / -VOLUME /etc/proftpd/keys /var/lib/ftp/data +VOLUME /var/lib/ftp/data -EXPOSE 22 +EXPOSE 2222 diff --git a/README.md b/README.md index 7d6f401..4179f23 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,19 @@ File access with [ProFTPD](http://www.proftpd.org/) over sftp and a static user/ # Volumes - `/var/lib/ftp/data`: root directory for files -- `/etc/proftpd/keys`: ssh key files + +# Files +## /etc/proftpd/keys/dhparams.pem +``` +openssl dhparam -outform PEM -5 + +``` + +## /etc/proftpd/keys/ssh_key +``` +ssh-keygen -b 2048 -t ed25519 -q -N "" -f ./ssh +cat ./ssh +``` # Environment Variables ## SERVER_NAME @@ -25,5 +37,6 @@ Uid for the static user. ## STATIC_GID Gid for the static user. + # Ports -- 22 +- 2222 diff --git a/rootfs/etc/confd/templates/proftpd.conf.tmpl b/rootfs/etc/confd/templates/proftpd.conf.tmpl index f59eafb..4b2a955 100644 --- a/rootfs/etc/confd/templates/proftpd.conf.tmpl +++ b/rootfs/etc/confd/templates/proftpd.conf.tmpl @@ -3,7 +3,7 @@ Include /etc/proftpd/modules.d/*.conf ServerName "{{getenv "SERVER_NAME"}}" ServerType standalone DefaultServer on -Port 22 +Port 2222 UseIPv6 off Umask {{ getenv "UMASK" "006 007" }} MaxInstances 30 @@ -27,6 +27,6 @@ AuthUserFile /etc/proftpd/passwd SFTPEngine on SFTPAuthMethods password SFTPDHParamFile /etc/proftpd/keys/dhparams.pem - SFTPHostKey /etc/proftpd/keys/ssh_rsa_key + SFTPHostKey /etc/proftpd/keys/ssh_key SFTPOptions IgnoreSCPUploadPerms IgnoreSFTPUploadPerms diff --git a/rootfs/etc/cont-init.d/02-dhparam b/rootfs/etc/cont-init.d/02-dhparam deleted file mode 100644 index 9d4e7b5..0000000 --- a/rootfs/etc/cont-init.d/02-dhparam +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/with-contenv sh - -if [ ! -f /etc/proftpd/keys/dhparams.pem ]; then - openssl dhparam -outform PEM -5 nbits >> /etc/proftpd/keys/dhparams.pem -fi diff --git a/rootfs/etc/cont-init.d/04-static-user b/rootfs/etc/cont-init.d/02-static-user similarity index 100% rename from rootfs/etc/cont-init.d/04-static-user rename to rootfs/etc/cont-init.d/02-static-user diff --git a/rootfs/etc/cont-init.d/03-ssh-keys b/rootfs/etc/cont-init.d/03-ssh-keys deleted file mode 100644 index 20abf54..0000000 --- a/rootfs/etc/cont-init.d/03-ssh-keys +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/with-contenv sh - -if [ ! -f /etc/proftpd/keys/ssh_rsa_key ]; then - ssh-keygen -b 2048 -t rsa -f /etc/proftpd/keys/ssh_rsa_key -q -N "" -fi