Skip to content

Commit 950930b

Browse files
committed
docs: Update instructions for latest Kanidm security requirements
Also general doc updates and better formatting for readability.
1 parent 8c1d6ec commit 950930b

File tree

2 files changed

+38
-15
lines changed

2 files changed

+38
-15
lines changed

Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ WORKDIR /etc/satosa
3131

3232
# Preload bespoke ENV configurable config
3333
COPY *.yaml /etc/satosa
34+
# Preload dummy XML metadata
35+
COPY dummy-metadata.xml /etc/satosa
3436

3537
# Add an entrypoint so we can use ENV for gunicorn args
3638
ENV LOG_LEVEL="info"

README.md

+36-15
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# SATOSA based SAML to Kanidm OIDC proxy
22

33
i.e. How to connect legacy web apps that only support SAML to be backed by Kanidm OIDC. While the configs in this repo can be educational for rolling your own SATOSA setup, an opinionated ENV configurable container image is also provided.
4+
This example on purpose only supports a 1:1 proxy config where a single SAML supporting web service auths via a single OIDC endpoint. To limit blast radius, just deploy multiple if you have multiple SAML-only services.
45

5-
> [!CAUTION]
6-
> This is an early version that only supports a 1:1 proxy config where a single SAML supporting web service auths via a single OIDC endpoint.
7-
> The intent is to morph into a "v2" that allows a dynamic mapping of multiple systems to multiple OIDC endpoints via a single SAML proxy. The simpler version will be preserved for educational purposes but is intended to become "legacy".
6+
> [!NOTE]
7+
> If you want to just skip to the part where we use this with Kanidm, you could jump straight to the practical example: [Ceph SSO via Kanidm](#practical-example-ceph-sso-via-kanidm)
88
99
## TODO items on the roadmap
1010
1. Get rid of the idpyoidc git build once there's a release that contains ES256 support.
@@ -14,8 +14,8 @@ i.e. How to connect legacy web apps that only support SAML to be backed by Kanid
1414

1515
The container built at `ghcr.io/jinnatar/satosa-saml-proxy:latest` is a proof of concept using the SATOSA configs in the repo. The guides below will assume you are using it, but nothing prevents you from using the same configs and ENV config with any other supported SATOSA installation method. I am using the container myself in my environment and have a vested interest in keeping it going and tested.
1616

17-
The caveats with the container and/or trying to go without it:
18-
- While recent releases of SATOSA support PKCE, they depend on the Python library `idpyoidc` for this. Unfortunately it has an issue that prevents using ES256 for signing with released versions. The container thus uses [a branch from git](https://github.com/IdentityPython/idpy-oidc/tree/issuer_metadata) that contains the fix for this. Once a full release is made with said fix that will be used specifically. Once SATOSA requires a high enough release of `idpyoidc` that contains a fix, we can stop with this nonsense altogether.
17+
### The caveats with the container and/or trying to go without it:
18+
- While recent releases of SATOSA support PKCE, they depend on the Python library `idpyoidc` for this. Unfortunately it has an issue that prevents using `ES256` for signing with released versions. The container thus uses [a branch from git](https://github.com/IdentityPython/idpy-oidc/tree/issuer_metadata) that contains the fix for this. Once a full release is made with said fix that will be used specifically. Once SATOSA requires a high enough release of `idpyoidc` that contains a fix, we can stop with this nonsense altogether.
1919
- The containers are now version tagged as per SATOSA upstream versions. However, due to the above nonsense those tags will be updated later when better build provenance is available.
2020

2121
### Container config options
@@ -67,23 +67,41 @@ SAML is a bit *involved* so we need to prep a persistent certificate and provide
6767
### Practical example: Ceph SSO via Kanidm
6868
1. Pre-create your users in Ceph to give them the correct authz. In this example we'll use short usernames for simplicity so that needs to match.
6969
1. Create your Kanidm OIDC configuration the usual way, no need to disable PKCE!
70+
```shell
71+
# **Important** give the upstream Ceph landing page URL here:
72+
kanidm system oauth2 create ceph Ceph https://ceph.example.com
73+
74+
# **Important** give the proxy callback URL here. The full value depends on $OIDC_NAME:
75+
kanidm system oauth2 add-redirect-url ceph https://ceph-saml.example.com/oidc_ceph
76+
77+
# Use short usernames for convenience
78+
kanidm system oauth2 prefer-short-username ceph
79+
80+
# Create the scope map, don't forget to create the group and add your Ceph admins to it.
81+
kanidm system oauth2 update-scope-map ceph ceph_admins openid profile email
82+
83+
# Get your client_secret for use later on:
84+
kanidm system oauth2 show-basic-secret ceph
7085
```
71-
kanidm system oauth2 create ceph Ceph https://saml.example.com # **Important**, give the proxy URL here.
72-
kanidm system oauth2 prefer-short-username ceph # Use short usernames for convenience
73-
kanidm system oauth2 update-scope-map ceph ceph_admins openid profile email # Create the scope map, don't forget to create the group and add your Ceph admins to it.
74-
kanidm system oauth2 show-basic-secret ceph # Get your client_secret for use later on.
86+
1. Create your SAML2 certs and set their permissions, remember to set the correct `SN`:
87+
```shell
88+
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 \
89+
-keyout saml.key -out saml.crt -subj "/SN=ceph-saml.example.com/"
90+
chown :999 saml.key
91+
chmod g+r saml.key
7592
```
76-
1. Create your SAML2 certs and set their permissions as per the generic steps above, nothing special here.
7793
1. We can't get Ceph to spit out it's metadata XML before the proxy is functioning so we skip ahead.
7894
1. Config your ENV variables into a new env file, `ceph.env`. If you don't change the ENCRYPTION_KEY value you deserve everything you get as a result.
7995
```shell
80-
LOG_LEVEL=debug # Enables debug logging for troubleshooting. Change this to "info" when everything works!
96+
# Enables debug logging for troubleshooting. Change this to "info" when everything works!
97+
LOG_LEVEL=debug
8198
ENCRYPTION_KEY=+OSDGTYdWxesiUwcMEzaGzwCx81YHhzOFgsitMn9A/c=
8299
OIDC_CLIENT_ID=ceph
83-
OIDC_CLIENT_SECRET=# You got this above from kanidm
100+
# The client secret you got in a previous step:
101+
OIDC_CLIENT_SECRET=
84102
OIDC_ISSUER_URL=https://idm.example.com/oauth2/openid/ceph
85103
OIDC_NAME=oidc_ceph
86-
PROXY_BASE_URL=https://saml.example.com
104+
PROXY_BASE_URL=https://ceph-saml.example.com
87105
SAML_METADATA=dummy-metadata.xml
88106
SAML_NAME=saml_ceph
89107
```
@@ -96,7 +114,10 @@ SAML is a bit *involved* so we need to prep a persistent certificate and provide
96114
```
97115
1. Register the proxy with Ceph, giving it the Ceph URL, SAML metadata endpoint and an attribute field name to expect for the username.
98116
```shell
99-
ceph dashboard sso setup saml2 https://ceph.example.com https://saml.example.com/saml_ceph/metadata.xml urn:oid:0.9.2342.19200300.100.1.1
117+
ceph dashboard sso setup saml2 \
118+
https://ceph.example.com \
119+
https://ceph-saml.example.com/saml_ceph/metadata.xml \
120+
urn:oid:0.9.2342.19200300.100.1.1
100121
```
101122
1. Assuming registration was succesful, we can now get the Ceph side SAML metadata:
102123
```shell
@@ -111,4 +132,4 @@ SAML is a bit *involved* so we need to prep a persistent certificate and provide
111132
ghcr.io/jinnatar/satosa-saml-proxy:latest
112133
```
113134

114-
1. Restart the proxy and go test Ceph SSO!
135+
1. Restart the proxy and go test Ceph SSO! Once it's all working, amend your env one more time to set `LOG_LEVEL=info`!

0 commit comments

Comments
 (0)