diff options
| -rw-r--r-- | Dockerfile | 1 | ||||
| -rw-r--r-- | Jenkinsfile | 2 | ||||
| -rw-r--r-- | docker-compose.yml | 3 | ||||
| -rwxr-xr-x | src/init | 7 |
4 files changed, 8 insertions, 5 deletions
@@ -3,6 +3,7 @@ RUN apk add --no-cache openssh-server fish git sudo # default uid for git user who has access to all repos ENV GIT_UID=1000 +ENV GIT_GID=1000 # Modified ssh conf with disabled root login and no password authentication COPY src/ssh.conf /etc/ssh/sshd_config.d/ diff --git a/Jenkinsfile b/Jenkinsfile index 3392df7..bf454a0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,7 +37,7 @@ pipeline { env.GIT_SHA = sh(script: "git rev-parse --short HEAD", returnStdout: true).trim() // compose image name + tags - env.GROUP_ID = "com.it-jaros.git" + env.GROUP_ID = "com.it-jaros.git" env.IMAGE_NAME = "${REGISTRY}/${GROUP_ID}" echo "sha=${env.GIT_SHA}" echo "image=${env.IMAGE_NAME}" diff --git a/docker-compose.yml b/docker-compose.yml index 53b9bd6..67638bd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,7 +9,8 @@ services: restart: no environment: # Note: Variable names cannot have - inside but the values can! - - GIT_UID=1000 # uid of the user that has access to all repos + - GIT_UID=1000 # uid/gid of the user that has access to all repos + - GIT_GID=1000 # Users in form of USER_<some chars>=<username>:<ssh-key> - USER_user1=user1:ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPsl91WPAT8aWwZ6y5WAfXU9PoHzxJ3YG9uFgSmlGQr2HwV+gL/XaTBJ4Brj+pa+R7tfYEBMi+7Navx/ZsEmr9E= mj@xps15 - USER_user2=user2:ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPsl91WPAT8aWwZ6y5WAfXU9PoHzxJ3YG9uFgSmlGQr2HwV+gL/XaTBJ4Brj+pa+R7tfYEBMi+7Navx/ZsEmr9E= mj@xps15 @@ -16,7 +16,7 @@ function checkUser return $status end -function createUser +function setupUser set -l userConfig (string split ':' $argv[1]) set -l user $userConfig[1] set -l key $userConfig[2] @@ -47,7 +47,8 @@ function setupGitUser echo "Setting up git user" # git user has read/write access to all repos, set git-shell # and no password login allowed -> no ssh login possible - adduser git -u $GIT_UID -D --shell "/usr/bin/git-shell" + addgroup -g $GIT_GID git + adduser git -u $GIT_UID -G git -D --shell "/usr/bin/git-shell" # group that is allowed to sudo addgroup $_GIT_SUDO_GROUP end @@ -157,7 +158,7 @@ end # Setup users setupGitUser for userConfig in $users - createUser "$userConfig" + setupUser "$userConfig" end # Setup repos |
