Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions profiles/saml2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# saml2

## Usage

Start a saml2 idp sidecar and configure it to Pulp.
This also starts a webbrowser in the compose network and points it to the login address.
14 changes: 14 additions & 0 deletions profiles/saml2/browser.Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM debian:latest

RUN \
apt-get update && \
apt-get install extrepo -y && \
extrepo enable librewolf && \
extrepo update librewolf && \
apt-get update && \
apt-get install librewolf -y && \
apt-get clean

COPY librewolf.overrides.cfg /root/.librewolf/librewolf.overrides.cfg

CMD librewolf
25 changes: 25 additions & 0 deletions profiles/saml2/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Add any custom services for your profile here.
---
version: "3.7"

services:
saml2idp:
image: "ghcr.io/pfrest/mock-saml2-idp:latest"
ports:
- "8443:8443"
environment:
IDP_AUTH_MODE: "auto"
SP_ENTITY_ID: "https://pulp/saml2/metadata/"
SP_ACS_LOCATION: "https://pulp/saml2/acs/"
IDP_USER_GROUPS: "file_admin"
browser:
build:
dockerfile: "../../profiles/saml2/browser.Containerfile"
context: "../../profiles/saml2/"
devices:
- "/dev/dri/"
volumes:
- "/tmp/.X11-unix/:/tmp/.X11-unix/:ro"
environment:
DISPLAY: ":0.0"
...
13 changes: 13 additions & 0 deletions profiles/saml2/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -eu

dnf -y install xmlsec1-openssl
uv pip install djangosaml2

mkdir -p /etc/pulp/certs
pushd /etc/pulp/certs
yes "" | openssl req -nodes -new -x509 -newkey rsa:2048 -days 3650 -keyout saml2-private.key -out saml2-public.crt

chown pulp saml2-private.key saml2-public.crt
popd
1 change: 1 addition & 0 deletions profiles/saml2/librewolf.overrides.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
defaultPref("browser.startup.homepage", "https://pulp/saml2/login/");
1 change: 1 addition & 0 deletions profiles/saml2/profile_default_config.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
saml_config='@json {"entityid": "https://pulp/saml2/metadata/", "entity_category": [], "allow_unknown_attributes": true, "service": {"sp": {"name": "Pulp CI", "force_authn": true, "required_attributes": ["username"], "endpoints": {"assertion_consumer_service": [["https://pulp/saml2/acs/", "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"]], "single_logout_service": [["https://pulp/saml2/ls/", "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"], ["https://pulp/saml2/ls/post", "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"]]}, "idp": {"https://saml2idp:8443/sso/saml2/idp/metadata.php": {}}, "allow_unsolicited": true}}, "key_file": "/etc/pulp/certs/saml2-private.key", "cert_file": "/etc/pulp/certs/saml2-public.crt", "xmlsec_binary": "/usr/bin/xmlsec1", "metadata": {"remote": [{"url": "https://saml2idp:8443/sso/saml2/idp/metadata.php"}]}, "debug": 1, "disable_ssl_certificate_validation": true}'
3 changes: 3 additions & 0 deletions profiles/saml2/pulp_config.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PULP_SAML_CONFIG='{saml_config}'
PULP_LOGIN_REDIRECT_URL='/pulp/default/api/v3/login/'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this only work with domains on?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess so.
But after all if this points to nowhere it's more like an inconvenience. These settings serve as an example (and not even a particularly good one) for setting up SAML support.
Is there a way to make the profile more flexible?

PULP_HTTPS=True
Loading