Skip to content

Commit 5ed4c8a

Browse files
authored
Merge pull request #59 from ruby-no-kai/radius
radius
2 parents 85d130f + f947ba2 commit 5ed4c8a

File tree

24 files changed

+559
-0
lines changed

24 files changed

+559
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(import './docker-build-simple.libsonnet')('freeradius-exporter')
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"jobs": {
3+
"build": {
4+
"name": "build",
5+
"permissions": {
6+
"contents": "read",
7+
"id-token": "write"
8+
},
9+
"runs-on": "ubuntu-latest",
10+
"steps": [
11+
{
12+
"uses": "docker/setup-qemu-action@v2"
13+
},
14+
{
15+
"uses": "docker/setup-buildx-action@v2"
16+
},
17+
{
18+
"uses": "aws-actions/configure-aws-credentials@v1",
19+
"with": {
20+
"aws-region": "ap-northeast-1",
21+
"role-skip-session-tagging": true,
22+
"role-to-assume": "arn:aws:iam::005216166247:role/GhaDockerPush"
23+
}
24+
},
25+
{
26+
"id": "login-ecr",
27+
"uses": "aws-actions/amazon-ecr-login@v1"
28+
},
29+
{
30+
"uses": "docker/build-push-action@v3",
31+
"with": {
32+
"context": "{{defaultContext}}:docker/freeradius-exporter",
33+
"platforms": "linux/arm64",
34+
"push": true,
35+
"tags": "${{ steps.login-ecr.outputs.registry }}/freeradius-exporter:${{ github.sha }},${{ steps.login-ecr.outputs.registry }}/freeradius-exporter:latest"
36+
}
37+
}
38+
]
39+
}
40+
},
41+
"name": "docker-freeradius-exporter",
42+
"on": {
43+
"push": {
44+
"branches": [
45+
"master",
46+
"test"
47+
],
48+
"paths": [
49+
"docker/freeradius-exporter/**",
50+
".github/workflows/docker-freeradius-exporter.yml"
51+
]
52+
}
53+
}
54+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(import './docker-build-simple.libsonnet')('radiusd')

.github/workflows/docker-radiusd.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"jobs": {
3+
"build": {
4+
"name": "build",
5+
"permissions": {
6+
"contents": "read",
7+
"id-token": "write"
8+
},
9+
"runs-on": "ubuntu-latest",
10+
"steps": [
11+
{
12+
"uses": "docker/setup-qemu-action@v2"
13+
},
14+
{
15+
"uses": "docker/setup-buildx-action@v2"
16+
},
17+
{
18+
"uses": "aws-actions/configure-aws-credentials@v1",
19+
"with": {
20+
"aws-region": "ap-northeast-1",
21+
"role-skip-session-tagging": true,
22+
"role-to-assume": "arn:aws:iam::005216166247:role/GhaDockerPush"
23+
}
24+
},
25+
{
26+
"id": "login-ecr",
27+
"uses": "aws-actions/amazon-ecr-login@v1"
28+
},
29+
{
30+
"uses": "docker/build-push-action@v3",
31+
"with": {
32+
"context": "{{defaultContext}}:docker/radiusd",
33+
"platforms": "linux/arm64",
34+
"push": true,
35+
"tags": "${{ steps.login-ecr.outputs.registry }}/radiusd:${{ github.sha }},${{ steps.login-ecr.outputs.registry }}/radiusd:latest"
36+
}
37+
}
38+
]
39+
}
40+
},
41+
"name": "docker-radiusd",
42+
"on": {
43+
"push": {
44+
"branches": [
45+
"master",
46+
"test"
47+
],
48+
"paths": [
49+
"docker/radiusd/**",
50+
".github/workflows/docker-radiusd.yml"
51+
]
52+
}
53+
}
54+
}

freeradius-exporter/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM --platform=$BUILDPLATFORM public.ecr.aws/docker/library/golang:1.20-bullseye as builder
2+
3+
ENV GOOS=linux
4+
ENV GOARCH=arm64
5+
ENV CGO_ENABLED=0
6+
RUN go install github.com/bvantagelimited/freeradius_exporter@0ba8725aa1ab59e09f4f9f2a1a229ecb66b66d56
7+
8+
FROM gcr.io/distroless/base-debian11
9+
10+
COPY --from=builder /go/bin/linux_arm64/freeradius_exporter /usr/local/bin/
11+
CMD /usr/local/bin/freeradius_exporter

radiusd/Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM public.ecr.aws/ubuntu/ubuntu:22.04
2+
3+
ARG FR_VERSION=3.0.26~dfsg~git20220223.1.00ed0241fa-0ubuntu3.1
4+
5+
RUN mkdir -p /etc/freeradius/3.0/certs && touch /etc/freeradius/3.0/certs/dh
6+
RUN apt-get update && apt-get install -y --no-install-recommends --no-install-suggests \
7+
freeradius=${FR_VERSION} \
8+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
9+
10+
RUN rm /etc/freeradius/3.0/sites-enabled/*
11+
COPY raddb/ /etc/freeradius/3.0/
12+
COPY run.sh /run.sh
13+
14+
RUN ls -la /etc/freeradius/3.0/sites-* /etc/freeradius/3.0/mods-*
15+
16+
COPY --chown=freerad:freerad dummycert /secrets/tls-cert
17+
RUN ls -la /secrets/tls-cert
18+
19+
USER freerad
20+
RUN /usr/sbin/freeradius -f -Cx -lstdout
21+
22+
USER root
23+
RUN rm -rf /secrets
24+
25+
USER freerad
26+
EXPOSE 1812/tcp 1812/udp
27+
EXPOSE 18121/tcp 18121/udp
28+
CMD ["/run.sh"]

radiusd/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
```
2+
docker build -t rkrad . && docker run --rm --name rkrad --net=host -v $(pwd)/dummycert:/secrets/tls-cert:ro rkrad
3+
docker kill rkrad
4+
```
5+
6+
```
7+
eapol_test -c ./eapol_test.conf -s testing123 -a 127.0.0.1
8+
eapol_test -c ./eapol_fail.conf -s testing123 -a 127.0.0.1
9+
```

radiusd/dummycert/ca.crt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIBXzCCAQWgAwIBAgIQJzw+EOAAQhjHLdki+FwdXTAKBggqhkjOPQQDAjAOMQww
3+
CgYDVQQDEwNmb28wHhcNMjMwNDE1MDgzMDIwWhcNMzMwNDEyMDgzMDIwWjAOMQww
4+
CgYDVQQDEwNmb28wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARMvRKBrV7aCKUA
5+
of9byLVCLqVbaMtWzDteng2j6aTYqkdl/+blinbuDdT2ICJ03R6PYveisK4Y4FYJ
6+
QKnTUZjho0UwQzAOBgNVHQ8BAf8EBAMCAQYwEgYDVR0TAQH/BAgwBgEB/wIBATAd
7+
BgNVHQ4EFgQUIU53gInUIZFW6ryJ5TOf+TSUGA0wCgYIKoZIzj0EAwIDSAAwRQIh
8+
AIsmexLK62UY1/X9ZoXE3W/nliltOeaoc6S8AfHT4n6fAiBlSpRlgngEGJ9dvZd9
9+
dioqs4tcfOINehBBzBTBO6C8+A==
10+
-----END CERTIFICATE-----

radiusd/dummycert/tls.crt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIBnTCCAUOgAwIBAgIRALuDzP9XeVu1iY6VDcY+enMwCgYIKoZIzj0EAwIwDjEM
3+
MAoGA1UEAxMDZm9vMB4XDTIzMDQxNTA4MzAzOFoXDTIzMDQxNjA4MzAzOFowDjEM
4+
MAoGA1UEAxMDYmF6MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAELz26JG5erXWv
5+
IAdRjV1f0NmNp/Nr57UL11MSs1P4lzNVLe0wkY7UvURX/npHqSn22LHvC8het8If
6+
Tgd4vdJgwKOBgTB/MA4GA1UdDwEB/wQEAwIHgDAdBgNVHSUEFjAUBggrBgEFBQcD
7+
AQYIKwYBBQUHAwIwHQYDVR0OBBYEFP7nu1ILkPnzSWeRndZjZQSC2+W2MB8GA1Ud
8+
IwQYMBaAFCFOd4CJ1CGRVuq8ieUzn/k0lBgNMA4GA1UdEQQHMAWCA2JhejAKBggq
9+
hkjOPQQDAgNIADBFAiBoWsiJpkpjObHyKxeiY2yGb5Og//F+iJaX4K+216Qc2QIh
10+
AMu4/50CWCcB5oL9bM3SEu/alzBaX2LSdin2W+W8fo0A
11+
-----END CERTIFICATE-----

radiusd/dummycert/tls.key

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-----BEGIN EC PRIVATE KEY-----
2+
MHcCAQEEIBaExrtFLk2vlohc558r2u+zVLCLl5XeWT465GkpkBrOoAoGCCqGSM49
3+
AwEHoUQDQgAELz26JG5erXWvIAdRjV1f0NmNp/Nr57UL11MSs1P4lzNVLe0wkY7U
4+
vURX/npHqSn22LHvC8het8IfTgd4vdJgwA==
5+
-----END EC PRIVATE KEY-----

0 commit comments

Comments
 (0)