commit 3b22c1a5d72b520e92354ccb2b27501c229a7570 Author: Git Commiter for 96-fromsofia.net <2a9-7cc@96-fromsofia.net> Date: Mon Feb 27 01:06:39 2023 +0000 First commit diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0374569 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +# Select base image and install your packages +FROM ubi9:latest +RUN yum install -y git openssh-server +RUN ssh-keygen -A + +# Setup the git user and create the git repo mount target +RUN useradd -s `which git-shell` -u 3091 git +RUN mkdir -p /srv/git + +# Add your public key for passwordless ssh authentication with git interactions +RUN mkdir /home/git/.ssh && chmod 700 /home/git/.ssh +ADD ./ssh-key.pub /home/git/.ssh/authorized_keys +RUN chmod 600 /home/git/.ssh/authorized_keys && chown git:git -R /home/git/.ssh + +# Secure git-shell against: CVE-2017-8386 +RUN sed -i '1s/^/no-pty /g' /home/git/.ssh/authorized_keys + +# Expose port 22 and run the ssh daemon +EXPOSE 22 +CMD ["/usr/sbin/sshd","-D"] diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..8f3f03b --- /dev/null +++ b/README.txt @@ -0,0 +1,9 @@ +This Dockerfile is intended to sping up an SSH server with git installed to server as a git server. + +The process of using and setting up this solution has been detailed in the below article: +https://96-fromsofia.net/articles/git-to-ecs/ + +To build the container: +$ podman build -t git-server . + +If you have any question regarding this build you can email me at: 2a9-7cc@96-fromsofia.net diff --git a/ssh-key.pub b/ssh-key.pub new file mode 100644 index 0000000..e69de29