philips-labs / dct-notary-admin

To manage Docker Content Trust and Notary certificates
MIT License
12 stars 1 forks source link

Implement Basic Authentication for notary-server #48

Open marcofranssen opened 4 years ago

marcofranssen commented 4 years ago

When connecting dctna-server to https://notary.docker.io a 401 response is returned.

In order for this to work we need to add a basic authentication handler so we can connect to the notary server.

An starting point can be found here. https://github.com/docker/cli/blob/master/cli/trust/trust.go#L173

marcofranssen commented 4 years ago

Current implementation does support Basic Authentication by setting the NOTARY_AUTH variable, as most of the implementation was taken from the notary project.

Doing the following in the terminal where the dctna-server is ran should be sufficient to connect to the docker hub registry.

export NOTARY_AUTH="$(echo youruser:yourpassword | base64)"
./dctna-server

For a cleaner codebase and better end user experience of dctna-server configurability the implementation can still be improved in a way it was implemented in the docker trust cli.

Also to make this a bit more secure by reading those credentials for example from Hashicorp vault or any other secure store could be a good addition.