SSH push/pull mirroring with password authentication doesn't support a custom port
### Summary SSH push and pull mirroring with password authentication doesn't support a custom port. Tested using GDK. I've described push mirroring below but the same problem exists for pull mirroring in EE. ### Steps to reproduce 1. Configure `sshd` to use password authentication and a custom port, e.g.: ``` AllowUsers GDK_USERNAME AuthenticationMethods password ListenAddress 127.0.0.1:2222 PasswordAuthentication yes UsePAM yes Match User GDK_USERNAME ``` 2. Configure the source project to mirror a target project via push using a password: ![mirror1](/uploads/99e42d3e43d835323dd4738ff06a0e18/mirror1.png) 3. Click the Update Now button. ### What is the current *bug* behavior? An error is reported: ![mirror2](/uploads/9c6bb5a9b190c87b74d470c4f5b9d262/mirror2.png) ``` 2:Fetching remote remote_mirror_44cbf83fb7cdaa7fa5b98f95e47ad925 failed: Could not resolve hostname 127.0.0.1:2222: nodename nor servname provided, or not known fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. ``` ### What is the expected *correct* behavior? The source project is successfully mirrored ### Relevant logs and/or screenshots GDK logs: ``` 09:07:09 rails-background-jobs.1 | 2018-11-25T14:07:09.523Z 48582 TID-ox1zvh4t2 RepositoryUpdateRemoteMirrorWorker JID-c191ae4756a33857de9ee040 INFO: start 09:07:09 gitlab-workhorse.1 | 127.0.0.1:3000 127.0.0.1:58344 - - [2018/11/25:09:07:09 -0500] "POST /root/source/mirror/update_now?sync_remote=true HTTP/1.1" 302 143 "http://127.0.0.1:3000/root/source/settings/repository" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36" 0.212 09:07:09 rails-background-jobs.1 | 2018-11-25T14:07:09.688Z 48582 TID-ox1zvh4t2 RepositoryUpdateRemoteMirrorWorker JID-c191ae4756a33857de9ee040 INFO: arguments: [3,"2018-11-25 09:07:09 -0500"] 09:07:09 gitaly.1 | time="2018-11-25T09:07:09-05:00" level=error msg="finished unary call with code Unknown" error="rpc error: code = Unknown desc = Fetching remote remote_mirror_44cbf83fb7cdaa7fa5b98f95e47ad925 failed: ssh: Could not resolve hostname 127.0.0.1:2222: nodename nor servname provided, or not known\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n" grpc.code=Unknown grpc.meta.auth_version=v2 grpc.meta.client_name=gitlab-sidekiq grpc.method=FetchRemote grpc.request.fullMethod=/gitaly.RepositoryService/FetchRemote grpc.request.glRepository=project-11 grpc.request.repoPath=@hashed/4f/c8/4fc82b26aecb47d2868c4efbe3581732a3e7cbcc6c2efb32062c08170a05eeb8.git grpc.request.repoStorage=default grpc.request.topLevelGroup=@hashed grpc.service=gitaly.RepositoryService grpc.start_time="2018-11-25T09:07:09-05:00" grpc.time_ms=124.011 peer.address= span.kind=server system=grpc 09:07:09 rails-background-jobs.1 | 2018-11-25T14:07:09.994Z 48582 TID-ox1zvh4t2 RepositoryUpdateRemoteMirrorWorker JID-c191ae4756a33857de9ee040 INFO: fail: 0.472 sec 09:07:09 rails-background-jobs.1 | 2018-11-25T14:07:09.995Z 48582 TID-ox1zvh4t2 WARN: {"context":"Job raised exception","job":{"class":"RepositoryUpdateRemoteMirrorWorker","args":[3,"2018-11-25 09:07:09 -0500"],"retry":3,"queue":"repository_update_remote_mirror","dead":false,"jid":"c191ae4756a33857de9ee040","created_at":1543154829.5198789,"enqueued_at":1543154829.5214841},"jobstr":"{\"class\":\"RepositoryUpdateRemoteMirrorWorker\",\"args\":[3,\"2018-11-25 09:07:09 -0500\"],\"retry\":3,\"queue\":\"repository_update_remote_mirror\",\"dead\":false,\"jid\":\"c191ae4756a33857de9ee040\",\"created_at\":1543154829.5198789,\"enqueued_at\":1543154829.5214841}"} 09:07:09 rails-background-jobs.1 | 2018-11-25T14:07:09.995Z 48582 TID-ox1zvh4t2 WARN: RepositoryUpdateRemoteMirrorWorker::UpdateError: 2:Fetching remote remote_mirror_44cbf83fb7cdaa7fa5b98f95e47ad925 failed: ssh: Could not resolve hostname 127.0.0.1:2222: nodename nor servname provided, or not known 09:07:09 rails-background-jobs.1 | fatal: Could not read from remote repository. 09:07:09 rails-background-jobs.1 | 09:07:09 rails-background-jobs.1 | Please make sure you have the correct access rights 09:07:09 rails-background-jobs.1 | and the repository exists. 09:07:09 rails-background-jobs.1 | 2018-11-25T14:07:09.995Z 48582 TID-ox1zvh4t2 WARN: /Users/mark/dev/gitlab/gitlab-ee/app/workers/repository_update_remote_mirror_worker.rb:29:in `perform' ``` ### Output of checks #### Results of GitLab environment info <details> <summary>Expand for output related to GitLab environment info</summary> <pre> System information System: Proxy: no Current User: mark Using RVM: no Ruby Version: 2.5.3p105 Gem Version: 2.7.6 Bundler Version:1.17.1 Rake Version: 12.3.1 Redis Version: 4.0.11 Git Version: 2.18.0 Sidekiq Version:5.2.3 Go Version: go1.11 darwin/amd64 GitLab information Version: 11.5.0-pre Revision: 1c1a43fea15 Directory: /Users/mark/dev/gitlab/gitlab-ee DB Adapter: postgresql DB Version: 9.6.10 URL: http://127.0.0.1:3000 HTTP Clone URL: http://127.0.0.1:3000/some-group/some-project.git SSH Clone URL: mark@127.0.0.1:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: no Using Omniauth: yes Omniauth Providers: GitLab Shell Version: 8.4.2 Repository storage paths: - default: /Users/mark/dev/gitlab/gdk-ee/repositories Hooks: /Users/mark/dev/gitlab/gdk-ee/gitlab-shell/hooks Git: /usr/local/bin/git </pre> </details> #### Results of GitLab application Check <details> <summary>Expand for output related to the GitLab application check</summary> <pre> Checking GitLab Shell ... GitLab Shell version >= 8.4.1 ? ... OK (8.4.2) Running /Users/mark/dev/gitlab/gdk-ee/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK Access to /Users/mark/dev/gitlab/gdk-ee/.ssh/authorized_keys: OK gitlab-shell self-check successful Checking GitLab Shell ... Finished Checking Gitaly ... default ... OK Checking Gitaly ... Finished Checking Sidekiq ... Running? ... yes Number of Sidekiq processes ... 1 Checking Sidekiq ... Finished Reply by email is disabled in config/gitlab.yml Checking LDAP ... LDAP is disabled in config/gitlab.yml Checking LDAP ... Finished Checking GitLab ... Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... no Try fixing it: sudo chmod 700 /Users/mark/dev/gitlab/gitlab-ee/public/uploads For more information see: doc/install/installation.md in section "GitLab" Please fix the error above and rerun the checks. Uploads directory tmp has correct permissions? ... skipped (no tmp uploads folder yet) Init script exists? ... no Try fixing it: Install the init script For more information see: doc/install/installation.md in section "Install Init Script" Please fix the error above and rerun the checks. Init script up-to-date? ... can't check because of previous errors Projects have namespace: ... Gitlab Org / Gitlab Test ... yes Gitlab Org / Gitlab Shell ... yes Gnuwget / Wget2 ... yes Commit451 / Lab Coat ... yes Jashkenas / Underscore ... yes Flightjs / Flight ... yes Twitter / Typeahead.Js ... yes H5bp / Html5 Boilerplate ... yes Administrator / target ... yes Administrator / source ... yes Administrator / target2 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.5.3) Git version >= 2.9.5 ? ... yes (2.18.0) Git user has default SSH configuration? ... no Try fixing it: mkdir ~/gitlab-check-backup-1543157663 sudo mv /Users/mark/.ssh/id_rsa ~/gitlab-check-backup-1543157663 sudo mv /Users/mark/.ssh/id_rsa.pub ~/gitlab-check-backup-1543157663 For more information see: doc/ssh/README.md in section "SSH on the GitLab server" Please fix the error above and rerun the checks. Active users: ... 28 Elasticsearch version 5.1 - 5.5? ... skipped (elasticsearch is disabled) Checking GitLab ... Finished </pre> </details> /cc @DouweM @nick.thomas
issue