diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..dfde774 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,10 @@ +build: + image: docker:latest + services: + - docker:dind + stage: build + script: + - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY + - docker build --pull --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA . + - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME + - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA diff --git a/Dockerfile b/Dockerfile index 58504c6..13c541c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,38 @@ -FROM quay.io/thallian/confd-env:latest +#FROM alpine:latest as builder -ENV PROFTP_VERSION v1.3.6 +#ENV PROFTP_VERSION v1.3.6 -RUN addgroup -g 2222 proftp -RUN adduser -h /var/lib/proftp -u 2222 -D -G proftp proftp +#ADD /rootfs / + +#RUN apk add --no-cache libressl openssh-client tar gcc make g++ openldap-dev zlib-dev file +#RUN mkdir /tmp/proftpd +#RUN wget -qO- https://github.com/proftpd/proftpd/archive/$PROFTP_VERSION.tar.gz | tar -xz -C /tmp/proftpd --strip 1 + +#WORKDIR /tmp/proftpd + +#RUN ./configure --with-modules=mod_ldap:mod_sftp --disable-wtmp +#RUN patch -p1 -i /musl_mempcpy.patch +#RUN make && make install + +FROM registry.gitlab.com/thallian/docker-confd-env:master + +#COPY --from=builder /usr/local/sbin/proftpd /usr/sbin/proftpd +#COPY --from=builder /usr/local/lib/proftpd /usr/lib/proftpd + +RUN apk add --no-cache libressl openssh-client openldap zlib +RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \ + proftpd proftpd-mod_ldap proftpd-mod_sftp + +RUN addgroup -g 2222 access +RUN addgroup proftpd access + +RUN rm /etc/proftpd/dhparams.pem +RUN mkdir /etc/proftpd/keys/ ADD /rootfs / -RUN apk add --no-cache libressl openssh-client openldap tar gcc make g++ openldap-dev zlib zlib-dev file - -RUN mkdir /tmp/proftpd -RUN wget -qO- https://github.com/proftpd/proftpd/archive/$PROFTP_VERSION.tar.gz | tar -xz -C /tmp/proftpd --strip 1 - -WORKDIR /tmp/proftpd -RUN ./configure --with-modules=mod_ldap:mod_sftp --disable-wtmp -RUN patch -p1 -i /musl_mempcpy.patch -RUN make && make install - -RUN rm -r /tmp/proftpd -RUN rm /musl_mempcpy.patch WORKDIR / -RUN apk del tar gcc make g++ openldap-dev zlib-dev file - -VOLUME /var/lib/proftp/keys /var/lib/proftp/data +VOLUME /etc/proftpd/keys /var/lib/ftp/data EXPOSE 22 diff --git a/rootfs/etc/confd/conf.d/proftpd.conf.toml b/rootfs/etc/confd/conf.d/proftpd.conf.toml index e9ac655..edb1303 100644 --- a/rootfs/etc/confd/conf.d/proftpd.conf.toml +++ b/rootfs/etc/confd/conf.d/proftpd.conf.toml @@ -1,3 +1,3 @@ [template] src = "proftpd.conf.tmpl" -dest = "/usr/local/etc/proftpd.conf" +dest = "/etc/proftpd/proftpd.conf" diff --git a/rootfs/etc/confd/templates/proftpd.conf.tmpl b/rootfs/etc/confd/templates/proftpd.conf.tmpl index 0d9fa01..2d2e9ea 100644 --- a/rootfs/etc/confd/templates/proftpd.conf.tmpl +++ b/rootfs/etc/confd/templates/proftpd.conf.tmpl @@ -5,10 +5,10 @@ Port 22 UseIPv6 off Umask 006 007 MaxInstances 30 -User proftp -Group proftp -DefaultRoot /var/lib/proftp/data -DefaultChdir /var/lib/proftp/data +User proftpd +Group proftpd +DefaultRoot /var/lib/ftp/data +DefaultChdir /var/lib/ftp/data AllowOverwrite on RequireValidShell off @@ -19,8 +19,8 @@ RequireValidShell off SFTPEngine on SFTPAuthMethods password - SFTPDHParamFile /var/lib/proftp/keys/dhparams.pem - SFTPHostKey /var/lib/proftp/keys/ssh_rsa_key + SFTPDHParamFile /etc/proftpd/keys/dhparams.pem + SFTPHostKey /etc/proftpd/keys/ssh_rsa_key @@ -39,6 +39,6 @@ RequireValidShell off LDAPForceDefaultUID on LDAPForceDefaultGID on LDAPGenerateHomedir on - LDAPGenerateHomedirPrefix /var/lib/proftp/data + LDAPGenerateHomedirPrefix /var/lib/ftp/data LDAPForceGeneratedHomedir on diff --git a/rootfs/etc/cont-init.d/02-dhparam b/rootfs/etc/cont-init.d/02-dhparam index 900dea2..9d4e7b5 100644 --- a/rootfs/etc/cont-init.d/02-dhparam +++ b/rootfs/etc/cont-init.d/02-dhparam @@ -1,5 +1,5 @@ #!/usr/bin/with-contenv sh -if [ ! -f /var/lib/proftp/keys/dhparams.pem ]; then - openssl dhparam -outform PEM -5 nbits >> /var/lib/proftp/keys/dhparams.pem +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/03-ssh-keys b/rootfs/etc/cont-init.d/03-ssh-keys index 0042a07..20abf54 100644 --- a/rootfs/etc/cont-init.d/03-ssh-keys +++ b/rootfs/etc/cont-init.d/03-ssh-keys @@ -1,5 +1,5 @@ #!/usr/bin/with-contenv sh -if [ ! -f /var/lib/proftp/keys/ssh_rsa_key ]; then - ssh-keygen -b 2048 -t rsa -f /var/lib/proftp/keys/ssh_rsa_key -q -N "" +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