MCPcopy Index your code
hub / github.com/cesanta/docker_auth

github.com/cesanta/docker_auth @1.14.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.14.0 ↗ · + Follow
316 symbols 709 edges 32 files 63 documented · 20%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Docker Registry 2 authentication server

The original Docker Registry server (v1) did not provide any support for authentication or authorization. Access control had to be performed externally, typically by deploying Nginx in the reverse proxy mode with Basic or other type of authentication. While performing simple user authentication is pretty straightforward, performing more fine-grained access control was cumbersome.

Docker Registry 2.0 introduced a new, token-based authentication and authorization protocol, but the server to generate them was not released. Thus, most guides found on the internet still describe a set up with a reverse proxy performing access control.

This server fills the gap and implements the protocol described here.

Supported authentication methods: * Static list of users * Google Sign-In (incl. Google for Work / GApps for domain) (documented here) * Github Sign-In * Gitlab Sign-In * LDAP bind (demo) * MongoDB user collection * MySQL/MariaDB, PostgreSQL, SQLite database table * External program

Supported authorization methods: * Static ACL * MongoDB-backed ACL * MySQL/MariaDB, PostgreSQL, SQLite backed ACL * External program

Installation and Examples

Using Helm/Kubernetes

A helm chart is available in the folder chart/docker-auth.

Docker

A public Docker image is available on Docker Hub: cesanta/docker_auth.

Tags available: - :edge - bleeding edge, usually works but breaking config changes are possible. You probably do not want to use this in production. - :latest - latest tagged release, will line up with :1 tag - :1 - the 1.x version, will have fixes, no breaking config changes. Previously known as :stable. - :1.x - specific release, see here for the list of current releases.

The binary takes a single argument - path to the config file. If no arguments are given, the Dockerfile defaults to /config/auth_config.yml.

Example command line:

$ docker run \
    --rm -it --name docker_auth -p 5001:5001 \
    -v /path/to/config_dir:/config:ro \
    -v /var/log/docker_auth:/logs \
    cesanta/docker_auth:1 /config/auth_config.yml

See the example config files to get an idea of what is possible.

Troubleshooting

Run with increased verbosity:

docker run ... cesanta/docker_auth:1 --v=2 --alsologtostderr /config/auth_config.yml

Contributing

Bug reports, feature requests and pull requests (for small fixes) are welcome. If you require larger changes, please file an issue. We cannot guarantee response but will do our best to address them.

Licensing

Copyright 2015 Cesanta Software Ltd.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this software except in compliance with the License. You may obtain a copy of the License at

   https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Extension points exported contracts — how you extend this code

Authenticator (Interface)
Authentication plugin interface. [10 implementers]
auth_server/api/authn.go
TokenDB (Interface)
TokenDB stores tokens using LevelDB [2 implementers]
auth_server/authn/tokendb_level.go
Authorizer (Interface)
Authorizer interface performs authorization of the request. It is invoked after authentication so it can be assumed that [6 …
auth_server/api/authz.go
RedisClient (Interface)
(no doc)
auth_server/authn/tokendb_redis.go

Core symbols most depended-on inside this repo

Close
called by 19
auth_server/authn/tokendb_level.go
Validate
called by 8
auth_server/authn/ext_auth.go
Get
called by 8
auth_server/authn/tokendb_redis.go
StoreToken
called by 8
auth_server/authn/tokendb_level.go
GetValue
called by 7
auth_server/authn/tokendb_level.go
Stop
called by 6
auth_server/api/authz.go
getDBKey
called by 6
auth_server/authn/tokendb_level.go
String
called by 6
auth_server/authn/static_auth.go

Shape

Method 157
Struct 77
Function 68
TypeAlias 10
Interface 4

Languages

Go100%

Modules by API surface

auth_server/authn/github_auth.go26 symbols
auth_server/authz/acl.go23 symbols
auth_server/authn/gitlab_auth.go22 symbols
auth_server/authn/google_auth.go21 symbols
auth_server/server/server.go18 symbols
auth_server/authn/ldap_auth.go17 symbols
auth_server/authn/tokendb_level.go15 symbols
auth_server/authn/oidc_auth.go14 symbols
auth_server/authn/tokendb_redis.go13 symbols
auth_server/authz/acl_xorm.go12 symbols
auth_server/authz/acl_mongo.go11 symbols
auth_server/authz/casbin_authz.go10 symbols

Datastores touched

(mongodb)Database · 1 repos

For agents

$ claude mcp add docker_auth \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact