Registry login: 401 Unauthorized

Summary

When logging in into the self-deployed registry, the response for docker login is 401 Unauthorized when logging in with correct credentials, with wrong credentials the response is the expected Access denied

Steps to reproduce

Generate SSL certs into /regcerts.

Deploy a Gitlab instance with the following settings:

registry_external_url "https://registry.mygit.eu:5005"
gitlab_rails['registry_enabled'] = true
gitlab_rails['registry_key_path'] = '/certs/privkey1.pem'
gitlab_rails['registry_api_url'] = 'https://registry.mygit.eu:5005'
gitlab_rails['registry_issuer'] = 'gitlab-issuer'

Deploy a registry with the following settings:

REGISTRY_AUTH_TOKEN_REALM=https://mygit.eu/jwt/auth
REGISTRY_AUTH_TOKEN_SERVICE=container_registry
REGISTRY_AUTH_TOKEN_ISSUER=gitlab-issuer
REGISTRY_AUTH_TOKEN_ROOTCERTBUNDLE=/certs/cert1.pem
REGISTRY_HTTP_TLS_CERTIFICATE=/certs/fullchain1.pem
REGISTRY_HTTP_TLS_KEY=/certs/privkey1.pem
  1. docker login registry.mygit.eu:5005

  2. See the world burn (Error response from daemon: login attempt to https://registry.mygit.eu:5005/v2/ failed with status: 401 Unauthorized)

What is the current bug behavior?

Error response from daemon: login attempt to https://registry.mygit.eu:5005/v2/ failed with status: 401 Unauthorized

What is the expected correct behavior?

Registry login succeeds.

Output of checks

This bug happens on a dockerized self-hosted GitLab instance

Results of GitLab environment info

Expand for output related to GitLab environment info
System information
System:
Current User:   git
Using RVM:      no
Ruby Version:   2.4.4p296
Gem Version:    2.7.6
Bundler Version:1.16.2
Rake Version:   12.3.1
Redis Version:  3.2.11
Git Version:    2.17.1
Sidekiq Version:5.1.3
Go Version:     unknown

GitLab information Version: 11.0.2 Revision: d9540ee Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://gerogit.eu HTTP Clone URL: https://gerogit.eu/some-group/some-project.git SSH Clone URL: ssh://git@gerogit.eu:2224/some-group/some-project.git Using LDAP: no Using Omniauth: no

GitLab Shell Version: 7.1.4 Repository storage paths:

  • default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check
GitLab Shell version >= 7.1.4 ? ... OK (7.1.4)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:root, or git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ...
3/2 ... ok
4/3 ... ok
4/4 ... ok
7/6 ... ok
7/7 ... ok
7/8 ... ok
1/11 ... ok
9/12 ... ok
9/13 ... ok
2/14 ... repository is empty
9/15 ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Redis available via internal API: OK

Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful

Checking GitLab Shell ... 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? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 3/2 ... yes 4/3 ... yes 4/4 ... yes 7/6 ... yes 7/7 ... yes 7/8 ... yes 1/11 ... yes 9/12 ... yes 9/13 ... yes 2/14 ... yes 9/15 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.4.4) Git version >= 2.9.5 ? ... yes (2.17.1) Git user has default SSH configuration? ... yes Active users: ... 8

Checking GitLab ... Finished