Re:Don't Take Security Advice from SEO Experts or Psychics
by wolfgang42 on Thursday August 10, 2017 @12:44PM
(#14981535)
Why not use the URL syntax? Then you can do
git clone ssh://[email protected]:2222/path/torepo.git
which shouldn't be mangled by the shell. (In fact, this is the syntax that GitLab gives you by default.)Alternatively, each user could put into their ~/.ssh/config:
Host gitlab
Hostname gitlab.example.com
Port 2222
User git
and then use "gitlab:path/torepo.git" instead.(In this particular scenario a bastion host probably isn't useful, since you'd have to copy the SSH keys out of gitlab into the bastion and make sure you get the management/security right. A web search for "ssh forward git user" turns up a number of people struggling with your problem; none of them seem to have entirely satisfactory answers.)
Re:Don't Take Security Advice from SEO Experts or Psychics
by mschuster91 on Thursday August 10, 2017 @12:52PM
(#14981629)
Because gitlab does not provide this syntax (if you do know how to get it that way, please tell me!), and people like to copy-paste... and getting people to set up their .ssh/config, tried that and failed, I would not ask if that were an option :(
Re:Don't Take Security Advice from SEO Experts or Psychics
by wolfgang42 on Thursday August 10, 2017 @01:31PM
(#14982021)
My GitLab CE instance (also docker) provides the URL syntax, so I did some spelunking through GitLab's source to figure out what might be different with your instance and found build_gitlab_shell_ssh_path_prefix: https://gitlab.com/gitlab-org/gitlab-ce/blob/c946ee1282655d3...
The gist of it is that it looks like you probably have "git.my.tld:22222" set somewhere in your config file, which should be removed and replaced with:
gitlab_rails['gitlab_shell_ssh_port'] = 22222
Alternatively, you may have gitlab_shell['ssh_path_prefix'] set which would cause the same symptoms.
Re:Don't Take Security Advice from SEO Experts or Psychics
by drkstr on Thursday August 10, 2017 @12:48PM
(#14981590)
I have never had to use the brakets like that when referring to a remote path in shell (bash or zsh). Is it because of the port number? Perhaps I never used a port number in the string, but im pretty sure I've needed it at some point (jenkins ran on :8080).
Re:Don't Take Security Advice from SEO Experts or Psychics
by mschuster91 on Thursday August 10, 2017 @12:52PM
(#14981635)
> Is it because of the port number?
yep, exactly. ssh normally does not need a portnumber if you are running gitlab-ssh on standard tcp/22.
More context: the server in question is running gitlab in a docker container, and users should also be able to SSH into the server. Now I have to run either gitlab or the host sshd on a different port, which confuses users and often enough leads to problems with git clone (the syntax is [[email protected]:22222]:path/torepo.git, which is accepted by bash but people insist on zsh and other shells which break on the brackets)...