sameersbn / sameersbn/docker-gitlab
SSH configuration in host with multiple services
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 8.1k
- Forks
- 2.1k
- Avg merge
- 17h 47m
- Merged PRs (30d)
- 7
Description
Hi to all,
This is not really an issue, but I didn't know how to share this config.
I installed the image in a server already managing different services, and exposing ssh to different users for different purposes. I have no way to manage dns records for this machine, so I wanted to have a 'proxy' for SSH to forward requests made to the git user to the embedded SSH server in the image.
Instead I ended up with a different (possibly simpler) solution. The idea is:
- have your container mount its volume data at /home/git/data:/home/git/data;
- every new ssh key will be stored in
/home/git/data/.ssh/authorized_keysand its entries will contain the command/home/git/gitlab-shell/bin/gitlab-shell key-x
So if you create in /home/git/gitlab-shell/bin/gitlab-shell a script like this:
#!/bin/bash
docker exec -i gitlab_gitlab_1 sh -c \
"SSH_CONNECTION='$SSH_CONNECTION' SSH_ORIGINAL_COMMAND='$SSH_ORIGINAL_COMMAND' /home/git/gitlab-shell/bin/gitlab-shell $1"
Assuming that gitlab_gitlab_1 is the name of your gitlab container, this calls the command gitlab-shell into the container from the outside, using your host ssh server, only on the git user.
The only remaining bit is to link your .ssh/authorized_keys to the one manager by gitlab.
I just implemented this solution and it works. It allowed me to expose gitlab without arranging a different machine and having a single server exposing ssh to many users.
Are there other simpler solutions out there?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue contains a host SSH workaround using a mounted /home/git/data volume, an authorized_keys entry, and a shell script invoking docker exec. No repository files or tests are mentioned; first determine whether this configuration belongs in the project documentation, and consider the request complete only when a supported, documented approach is agreed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, shell
- Domain
- devops, infrastructure
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100