commit cffaa5acc0ad59cd9834d7a817cf11b741249413 Author: Benjamin Renard Date: Sat Jan 7 14:30:29 2023 +0100 Initial commit diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b3c0007 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM debian:11 +# Update/upgrade +RUN apt-get update +RUN apt-get upgrade -y +RUN apt-get install --no-install-recommends --yes rsyslog openvpn ssh less vim iputils-ping net-tools +RUN mkdir /root/.ssh +RUN chmod 700 /root/.ssh +RUN touch /root/.ssh/authorized_keys +COPY entrypoint.sh /usr/local/sbin/entrypoint.sh +RUN chmod 755 /usr/local/sbin/entrypoint.sh +ENTRYPOINT /usr/local/sbin/entrypoint.sh diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..ebeffff --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,40 @@ +#!/bin/bash -e + +echo "Start rsyslog service..." +service rsyslog start +echo done. + +if [ -d /srv/ssh ] +then + if [ -n "$( ls /srv/ssh/*.conf 2> /dev/null )" ] + then + echo "Install custom SSH configuration files..." + cp /srv/ssh/*.conf /etc/ssh/sshd_config.d/ + echo done. + else + echo "No custom SSH configuration files found. Put it in /srv/ssh if need (with .conf extension)." + fi + + if [ -e /srv/ssh/authorized_keys ] + then + echo "Install SSH authorized keys (from /srv/ssh/authorized_keys file)" + cat /srv/ssh/authorized_keys > /root/.ssh/authorized_keys + else + echo "No SSH authorized keys to install. Put it in /srv/ssh/authorized_keys file." + fi + + echo "Start SSH service..." + service ssh start + echo done. +fi + +if [ -d /srv/openvpn ] +then + cp /srv/openvpn/* /etc/openvpn + service openvpn start +else + echo "OpenVPN configuration directory not mount (/srv/openvpn)" +fi + +echo "Run BASH shell" +bash -l