Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge from jordemort/traefik-forward-auth #5

Merged
merged 30 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2425768
Allow custom key to be used for whitelist and X-Forwarded-User instea…
jordemort Nov 5, 2022
f66cb9a
Domain matching should be case insensitive (#2)
jordemort Nov 5, 2022
0b3b8f8
fix too many forward_auth cookies (#3)
jordemort Nov 5, 2022
74b0194
feature: trusted ip address ranges skip authentication (#4)
jordemort Nov 5, 2022
e8ab996
Use Go 1.19 in CI (#5)
jordemort Nov 5, 2022
f3d1473
Update dependencies (#6)
jordemort Nov 5, 2022
d476ec0
Redo Dockerfile with Go 1.19 and distroless (#7)
jordemort Nov 5, 2022
a280dd5
Create dependabot.yml
jordemort Nov 5, 2022
3480fa8
Bump github/codeql-action from 1 to 2 (#8)
dependabot[bot] Nov 5, 2022
3d568c1
Bump actions/setup-go from 2 to 3 (#9)
dependabot[bot] Nov 5, 2022
c7be07a
Bump actions/checkout from 2 to 3 (#10)
dependabot[bot] Nov 5, 2022
c7b6e99
Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 (#11)
dependabot[bot] Nov 5, 2022
4cea39d
Fix most of the issues CodeQL dislikes (#12)
jordemort Nov 5, 2022
7a01be9
Validate redirect domain (#13)
jordemort Nov 5, 2022
744d0af
Workflow update: build container, rename master to main (#14)
jordemort Nov 6, 2022
8bd0c35
Run tests as part of container build (#15)
jordemort Nov 6, 2022
68ca6b1
Update README (#16)
jordemort Nov 6, 2022
999bfe8
Update README.md
jordemort Nov 9, 2022
c5805c2
Bump docker/setup-buildx-action from 2.0.0 to 2.2.1 (#17)
dependabot[bot] Jan 12, 2023
d2b0f9f
Bump github.com/traefik/traefik/v2 from 2.9.4 to 2.9.6 (#21)
dependabot[bot] Jan 12, 2023
d793555
Bump golang.org/x/oauth2 from 0.1.0 to 0.4.0 (#22)
dependabot[bot] Jan 13, 2023
8002ac0
Add .github to .dockerignore
ciffelia Aug 21, 2021
27517ce
Add actions workflow to build and push docker image
ciffelia Aug 21, 2021
f3ee200
Publish to ghcr
Beanow Jun 3, 2022
6f3d8d7
chore(ci): use own registry
mkska Jul 27, 2023
61fdff0
Add SameSite option
heralight Jul 1, 2021
355b680
docs: updates readme
mkska Jul 27, 2023
5cb0ea8
Update README.md
mkska Jul 27, 2023
8c246d0
Merge branch 'master' into jordemort-main
mkska Aug 22, 2023
097824c
remove docker workflow
mkska Aug 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]

jobs:

Expand All @@ -14,12 +14,12 @@ jobs:
steps:

- name: Set up Go 1.x
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ^1.13
go-version: ^1.19

- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Get dependencies
run: |
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ name: "CodeQL"

on:
push:
branches: [master]
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
branches: [main]
schedule:
- cron: '0 10 * * 2'

Expand All @@ -30,7 +30,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
Expand All @@ -43,18 +43,18 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -68,4 +68,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
70 changes: 70 additions & 0 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Build container
on:
push:
branches:
- main
pull_request:

# Allow for manually running
workflow_dispatch:
inputs:
container_tag:
description: Tag for container
default: "latest"
required: true

permissions:
packages: write

jobs:
container:
runs-on: ubuntu-20.04

env:
CONTAINER_NAME: ghcr.io/${{ github.repository }}
BUILD_PLATFORMS: linux/amd64,linux/arm,linux/arm64,linux/ppc64le,linux/s390x
RAW_CONTAINER_TAG: ${{ github.event.inputs.container_tag || github.event.pull_request.head.ref || 'latest' }}
RAW_REF_NAME: ${{ github.event.pull_request.head.ref || github.ref }}

steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
id: buildx
uses: docker/[email protected]

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@v3
with:
submodules: recursive

# Needed for buildx gha cache to work
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v2

- name: Build container
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
CONTAINER_TAG=$(echo "$RAW_CONTAINER_TAG" | sed 's/[^a-zA-Z0-9]\+/-/')
REF_NAME=$(echo "$RAW_REF_NAME" | sed -r 's#^refs/(heads|tags)/##')
docker buildx build \
--platform "$BUILD_PLATFORMS" \
--tag "$CONTAINER_NAME:$CONTAINER_TAG" \
--label "org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}" \
--label "org.opencontainers.image.documentation=${{ github.server_url }}/${{ github.repository }}" \
--label "org.opencontainers.image.url=${{ github.server_url }}/${{ github.repository }}/packages" \
--label "org.opencontainers.image.ref.name=$REF_NAME" \
--label "org.opencontainers.image.revision=${{ github.sha }}" \
--label "org.opencontainers.image.vendor=${{ github.repository_owner }}" \
--label "org.opencontainers.image.created=$(date -u --rfc-3339=seconds)" \
--cache-from type=gha \
--cache-to type=gha,mode=max \
--pull ${{ github.event_name == 'push' && '--push' || '' }} .
52 changes: 0 additions & 52 deletions .github/workflows/docker.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Traefik Forward Auth
on: [push]
jobs:
test:
name: Test with Go version -
runs-on: ubuntu-latest

strategy:
matrix:
go: ['1.19']

steps:
- uses: actions/checkout@v3

- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}

- name: Run Tests
run: go test ./...
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Go 1.x
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ^1.13
id: go
Expand Down
29 changes: 15 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
FROM golang:1.13-alpine as builder
# Start by building the application.
FROM golang:1.19 as build

# Setup
RUN mkdir -p /go/src/github.com/thomseddon/traefik-forward-auth
WORKDIR /go/src/github.com/thomseddon/traefik-forward-auth
WORKDIR /usr/src/traefik-forward-auth
COPY . .

# Add libraries
RUN apk add --no-cache git
RUN go test ./...
RUN CGO_ENABLED=0 go build -o ./traefik-forward-auth ./cmd

# Copy & build
ADD . /go/src/github.com/thomseddon/traefik-forward-auth/
RUN CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build -a -installsuffix nocgo -o /traefik-forward-auth github.com/thomseddon/traefik-forward-auth/cmd
# Now copy it into our base image.
FROM gcr.io/distroless/static-debian11:nonroot
COPY --from=build /usr/src/traefik-forward-auth/traefik-forward-auth /usr/bin/traefik-forward-auth

# Copy into scratch container
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /traefik-forward-auth ./
ENTRYPOINT ["./traefik-forward-auth"]
ENTRYPOINT [ "/usr/bin/traefik-forward-auth" ]
CMD []

LABEL org.opencontainers.image.title traefik-forward-auth
LABEL org.opencontainers.image.description "Forward authentication service for the Traefik reverse proxy"
LABEL org.opencontainers.image.licenses MIT
Loading