Initial commit

This commit is contained in:
Benjamin Renard 2023-01-07 14:30:29 +01:00
commit cffaa5acc0
2 changed files with 51 additions and 0 deletions

11
Dockerfile Normal file
View file

@ -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

40
entrypoint.sh Normal file
View file

@ -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