diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 00000000..7db07fc7 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,42 @@ +name: "CodeQL" + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + schedule: + - cron: '32 3 * * 5' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'go' ] + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + + - name: Autobuild + uses: github/codeql-action/autobuild@v3 + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 2f6fa4f5..80f84b31 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -16,12 +16,12 @@ jobs: steps: - name: Install Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v5 with: - go-version: "1.16.x" + go-version: "1.24.x" - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Get Build Data id: info @@ -33,7 +33,7 @@ jobs: - name: Docker meta id: docker_meta - uses: crazy-max/ghaction-docker-meta@v1 + uses: crazy-max/ghaction-docker-meta@v5 with: images: cesanta/docker_auth tag-edge: true @@ -43,13 +43,13 @@ jobs: {{major}}.{{minor}} - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v3 with: platforms: all - name: Set up Docker Buildx id: buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v3 with: install: true version: latest @@ -57,14 +57,14 @@ jobs: driver-opts: image=moby/buildkit:master - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} if: github.event_name == 'push' - name: Build and Push - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v6 with: context: auth_server file: auth_server/Dockerfile diff --git a/.github/workflows/go_test.yml b/.github/workflows/go_test.yml index a568cb5d..50c4821b 100644 --- a/.github/workflows/go_test.yml +++ b/.github/workflows/go_test.yml @@ -4,16 +4,16 @@ jobs: test: strategy: matrix: - go-version: [1.16.x] + go-version: [1.23.x,1.24.x] os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - name: Install Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Test run: | cd auth_server @@ -21,4 +21,4 @@ jobs: - name: Build run: | cd auth_server - make \ No newline at end of file + make diff --git a/README.md b/README.md index e19103fe..5e00a657 100644 --- a/README.md +++ b/README.md @@ -8,16 +8,17 @@ While performing simple user authentication is pretty straightforward, performin 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](https://github.com/docker/distribution/blob/master/docs/spec/auth/token.md). +This server fills the gap and implements the protocol described [here](https://github.com/docker/distribution/blob/main/docs/spec/auth/token.md). Supported authentication methods: * Static list of users - * Google Sign-In (incl. Google for Work / GApps for domain) (documented [here](https://github.com/cesanta/docker_auth/blob/master/examples/reference.yml)) + * Google Sign-In (incl. Google for Work / GApps for domain) (documented [here](https://github.com/cesanta/docker_auth/blob/main/examples/reference.yml)) * [Github Sign-In](docs/auth-methods.md#github) + * Gitlab Sign-In * LDAP bind ([demo](https://github.com/kwk/docker-registry-setup)) * MongoDB user collection * MySQL/MariaDB, PostgreSQL, SQLite database table - * [External program](https://github.com/cesanta/docker_auth/blob/master/examples/ext_auth.sh) + * [External program](https://github.com/cesanta/docker_auth/blob/main/examples/ext_auth.sh) Supported authorization methods: * Static ACL @@ -54,7 +55,7 @@ $ docker run \ cesanta/docker_auth:1 /config/auth_config.yml ``` -See the [example config files](https://github.com/cesanta/docker_auth/tree/master/examples/) to get an idea of what is possible. +See the [example config files](https://github.com/cesanta/docker_auth/tree/main/examples/) to get an idea of what is possible. ## Troubleshooting diff --git a/auth_server/Dockerfile b/auth_server/Dockerfile index e7ff583f..c489ad6e 100644 --- a/auth_server/Dockerfile +++ b/auth_server/Dockerfile @@ -1,9 +1,9 @@ -FROM golang:1.16-alpine3.14 as build +FROM golang:1.24-alpine3.22 AS build ARG VERSION -ENV VERSION "${VERSION}" +ENV VERSION="${VERSION}" ARG BUILD_ID -ENV BUILD_ID "${BUILD_ID}" +ENV BUILD_ID="${BUILD_ID}" ARG CGO_EXTRA_CFLAGS RUN apk add -U --no-cache ca-certificates make git gcc musl-dev binutils-gold @@ -12,7 +12,7 @@ COPY . /build WORKDIR /build RUN make build -FROM alpine:3.14 +FROM alpine:3.22 COPY --from=build /build/auth_server /docker_auth/ COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ ENTRYPOINT ["/docker_auth/auth_server"] diff --git a/auth_server/authn/data/github_auth_result.tmpl b/auth_server/authn/data/github_auth_result.tmpl index 2619d0cd..513034ea 100644 --- a/auth_server/authn/data/github_auth_result.tmpl +++ b/auth_server/authn/data/github_auth_result.tmpl @@ -43,9 +43,11 @@
$ docker login -u {{.Username}} -p {{.Password}} {{if .RegistryUrl}}{{.RegistryUrl}}{{else}}docker.example.com{{end}}
+ $ podman login -u {{.Username}} -p {{.Password}} {{if .RegistryUrl}}{{.RegistryUrl}}{{else}}docker.example.com{{end}}
+ $ nerdctl login -u {{.Username}} -p {{.Password}} {{if .RegistryUrl}}{{.RegistryUrl}}{{else}}docker.example.com{{end}}