From ce0042117c0fd9036ebab44b8b7adfd2ec9c4a58 Mon Sep 17 00:00:00 2001 From: Raine Date: Mon, 30 Oct 2023 01:53:54 +0100 Subject: [PATCH] fix: git docker shim --- servers/apoc/setup.d/{10-apply-skel.sh => 00-apply-skel.sh} | 0 servers/apoc/setup.d/{00-setup-git.sh => 10-setup-git.sh} | 1 + servers/apoc/skel/etc/ssh/sshd_config.d/git.conf | 2 +- servers/apoc/skel/home/git/docker-shell | 2 +- 4 files changed, 3 insertions(+), 2 deletions(-) rename servers/apoc/setup.d/{10-apply-skel.sh => 00-apply-skel.sh} (100%) rename servers/apoc/setup.d/{00-setup-git.sh => 10-setup-git.sh} (77%) diff --git a/servers/apoc/setup.d/10-apply-skel.sh b/servers/apoc/setup.d/00-apply-skel.sh similarity index 100% rename from servers/apoc/setup.d/10-apply-skel.sh rename to servers/apoc/setup.d/00-apply-skel.sh diff --git a/servers/apoc/setup.d/00-setup-git.sh b/servers/apoc/setup.d/10-setup-git.sh similarity index 77% rename from servers/apoc/setup.d/00-setup-git.sh rename to servers/apoc/setup.d/10-setup-git.sh index 5cfc7ba..4f7e637 100755 --- a/servers/apoc/setup.d/00-setup-git.sh +++ b/servers/apoc/setup.d/10-setup-git.sh @@ -4,4 +4,5 @@ if ! getent passwd git &>/dev/null; then echo "creating git user..." useradd -m git usermod git -aG docker + chsh -s /home/git/docker-shell git fi diff --git a/servers/apoc/skel/etc/ssh/sshd_config.d/git.conf b/servers/apoc/skel/etc/ssh/sshd_config.d/git.conf index 17ac506..8d387b8 100644 --- a/servers/apoc/skel/etc/ssh/sshd_config.d/git.conf +++ b/servers/apoc/skel/etc/ssh/sshd_config.d/git.conf @@ -1,3 +1,3 @@ Match User git AuthorizedKeysCommandUser git - AuthorizedKeysCommand /usr/bin/docker exec -i git /usr/local/bin/gitea keys -c /data/gitea/conf/app.ini -e git -u %u -t %t -k %k \ No newline at end of file + AuthorizedKeysCommand /usr/bin/docker exec -iu git git /usr/local/bin/gitea keys -c /data/gitea/conf/app.ini -e git -u %u -t %t -k %k \ No newline at end of file diff --git a/servers/apoc/skel/home/git/docker-shell b/servers/apoc/skel/home/git/docker-shell index 74d4fff..349dfff 100644 --- a/servers/apoc/skel/home/git/docker-shell +++ b/servers/apoc/skel/home/git/docker-shell @@ -1,2 +1,2 @@ #!/bin/sh -/usr/bin/docker exec -i --env SSH_ORIGINAL_COMMAND="$SSH_ORIGINAL_COMMAND" gitea sh "$@" \ No newline at end of file +/usr/bin/docker exec -iu git --env SSH_ORIGINAL_COMMAND="$SSH_ORIGINAL_COMMAND" git sh "$@" \ No newline at end of file