Split run.sh and add git retrival

This patch modularize run.sh, adding two new helper scripts and
make it possible to specify a git repository for ssh keys via a
new env variable `BORG_SSHKEYS_REPO`.

the modularization add two new files :
- `env.sh` : define a few envriroment variables
- `create-client-dirs.sh`  : update and create user directories and
  re-create authorized_keys

We also add a new script `update-ssh-keys.sh` to be called regurlarly
in a cron job to check if the git repository is up-to-date and
eventually adding/removing users.
This commit is contained in:
Pietro 2020-03-23 12:38:34 +01:00
parent ac797c90f6
commit 0108fcf653
No known key found for this signature in database
GPG key ID: 375CEF476926787B
5 changed files with 118 additions and 38 deletions

View file

@ -13,7 +13,7 @@ VOLUME /backup
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get -y --no-install-recommends install \
borgbackup openssh-server && apt-get clean && \
borgbackup openssh-server git ca-certificates && apt-get clean && \
useradd -s /bin/bash -m -U borg && \
mkdir /home/borg/.ssh && \
chmod 700 /home/borg/.ssh && \
@ -24,6 +24,9 @@ RUN apt-get update && apt-get -y --no-install-recommends install \
COPY ./data/run.sh /run.sh
COPY ./data/sshd_config /etc/ssh/sshd_config
COPY ./data/update-ssh-keys.sh /usr/local/bin/
COPY ./data/create-client-dirs.sh /usr/local/bin/
COPY ./data/env.sh /usr/local/bin/env.sh
ENTRYPOINT /run.sh