Skip to content
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
4bb4494
now checks for privileged system users instead of groups
wtripp180901 May 29, 2025
bd73d53
image bump
wtripp180901 May 29, 2025
e1bece1
can now specify additional privileged users
wtripp180901 May 29, 2025
cae4527
bump
wtripp180901 May 29, 2025
b1cb810
added unit tests
wtripp180901 May 30, 2025
1276b8f
fixed unprivileged service account being allowed
wtripp180901 May 30, 2025
e0c02d5
fixed JSON test
wtripp180901 May 30, 2025
20cfb57
formatting
wtripp180901 May 30, 2025
5935633
image bump
wtripp180901 May 30, 2025
68399ec
now allows protected service accounts to write to each other's namesp…
wtripp180901 May 30, 2025
f67fe91
bumped image
wtripp180901 May 30, 2025
e00a1fd
added protections for wildcard requests
wtripp180901 Jun 2, 2025
69a4d16
refactor + docs
wtripp180901 Jun 2, 2025
b83f978
bump
wtripp180901 Jun 2, 2025
d9eaf99
ensured allowed is always set
wtripp180901 Jun 2, 2025
92c6200
bump
wtripp180901 Jun 2, 2025
a3fa051
loosened all-namespace request rules
wtripp180901 Jun 2, 2025
59811f4
bump
wtripp180901 Jun 2, 2025
7ee025d
all namespace bans now only apply to secrets
wtripp180901 Jun 2, 2025
830fc0e
bump
wtripp180901 Jun 2, 2025
217ce15
nits
wtripp180901 Jun 18, 2025
4fa40af
added gofmt check
wtripp180901 Jun 18, 2025
16a5e3d
ci output + fixed formatting
wtripp180901 Jun 18, 2025
e4b5a15
typo
wtripp180901 Jun 18, 2025
97028f8
Logging improvements
wtripp180901 Jun 18, 2025
0acc2bb
debug
wtripp180901 Jun 18, 2025
e9f1d62
made allowed system users more explicit
wtripp180901 Jun 18, 2025
b93c713
Switched to multistage build
wtripp180901 Jun 19, 2025
c52cab4
Updated tests
wtripp180901 Jun 19, 2025
9728993
bumped image
wtripp180901 Jun 19, 2025
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
35 changes: 35 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Go unit tests

on:
pull_request:
push:
branches:
- main

jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.24.x'
- name: Check gofmt compliant
run: |
cd src
if [[ $(gofmt -l .) ]]; then
echo "Files not gofmt compliant:"
gofmt -l .
exit 1
else
exit 0
fi
- name: Install dependencies
run: |
cd src
go get .
- name: Test with Go
run: |
cd src
go test -v
Comment thread
wtripp180901 marked this conversation as resolved.
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.24
FROM golang:1.24 AS build-stage

WORKDIR /app

Expand All @@ -9,6 +9,12 @@ COPY src/*.go ./

RUN CGO_ENABLED=0 GOOS=linux go build -o /azimuth-authorization-webhook

FROM gcr.io/distroless/base-debian11 AS build-release-stage

WORKDIR /

COPY --from=build-stage /azimuth-authorization-webhook /azimuth-authorization-webhook

EXPOSE 8080

ENTRYPOINT ["/azimuth-authorization-webhook"]
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Azimuth Authorization Webhook

A Kubernetes authorization webhook to protect sensitive namespaces when users require
read-write access to all other cluster resources (e.g when they wish to install arbitrary CRDS).

Policy:
- Users cannot read secrets in protected namespaces by default
- Users cannot write any other resource in protected namespaces by default
- Internal K8s `system:` users may read/write to protected namespaces, excluding service accounts and `system:anonymous`
- Service accounts in protected namespaces may read/write to all protected namespaces
- Users specified as privileged may read/write to protected namespaces

## Flags
| Flag | Arguments |
| --- | --- |
| `--allow-opinion-mode` | Specifies if the webhook should give its opinion on requests which it doesn't deny. If true, will set 'allowed' to `true` in SubjectAccessReview response. Default: `false` |
| `--additional-privileged-users` | Comma separate listed of users to be given read/write access to protected namespaces. Default: `""` |
| `--log-level` | Verbosity of logs <br>`0`: Internal errors only. <br>`1`: Logs high level requests info. <br>`2`: Logs HTTP dumps of requests. <br>Default: `1` |
| `--protected-namespaces` | Comma separated list of protected namespaces. Default: `kube-system,openstack-system` |
2 changes: 1 addition & 1 deletion chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
containerPort: 8080
protocol: TCP
args:
- --additional-privileged-users={{ join "," .Values.additionalPrivilegedUsers }}
- --log-level={{ .Values.logLevel }}
- --protected-namespaces={{ join "," .Values.protectedNamespaces }}
- --unpriveleged-group={{ .Values.unprivilegedGroup }}
- --allow-opinion-mode={{ .Values.allowOpinionMode }}
4 changes: 2 additions & 2 deletions chart/values.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
port: 8080
version: 2f72ea1
version: 706400d

logLevel: 1
protectedNamespaces:
- kube-system
- openstack-system
unprivilegedGroup: "oidc:/platform-users"
additionalPrivilegedUsers: []
allowOpinionMode: false

ingress:
Expand Down
Loading
Loading