Skip to content
Draft
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
17 changes: 0 additions & 17 deletions .github/workflows/release_libs.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions .github/workflows/terraform_module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
build:
name: Terraform Checks and Plans
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
Expand Down
62 changes: 58 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,59 @@
# Charmed SSO Service
# Charmed SSO Service for the Canonical Identity Platform

The Kubernetes charmed operator of the Canonical Identity Platform's
[SSO Service](https://github.com/canonical/sso-service), which lets a tenant sign its members in with
its own OpenID Connect identity provider.
[![CharmHub Badge](https://charmhub.io/sso-service/badge.svg)](https://charmhub.io/sso-service)
[![Juju](https://img.shields.io/badge/Juju%20-3.6+-%23E95420)](https://github.com/juju/juju)
[![License](https://img.shields.io/github/license/canonical/sso-service-operator?label=License)](https://github.com/canonical/sso-service-operator/blob/main/LICENSE)

[![Continuous Integration Status](https://github.com/canonical/sso-service-operator/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/canonical/sso-service-operator/actions?query=branch%3Amain)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196.svg)](https://conventionalcommits.org)

## Description

Python Operator for the Canonical Identity Platform SSO Service

## Network

The charm opens the ports `8080` (HTTP) and `50051` (gRPC) on the application's Kubernetes
Service and restricts neither of them.

**Important:** the sign-in service on `50051` is served **without a token**, because the login
UI calls it before a user has one. The deployment has to restrict that port to the login UI.

The `public-route` gateway has to be the one the login UI is served on, because the login UI
reads a cookie that the service sets. The charm does not check it.

## Envelope key

The key that encrypts the identity providers' client secrets in the database is kept in a Juju
secret of the application, generated by the leader in its first hook.

**Important:** back up the database and the key together. A database restored without its key
has no readable client secrets.

```bash
juju run sso-service/leader get-envelope-key
```

To restore into a new deployment, put the key in a Juju secret under the entry `key`, deploy the
application with `initial_envelope_key_secret_id` set to the secret's id, then grant the secret
to the application.

## Security

Please see [SECURITY.md](https://github.com/canonical/sso-service-operator/blob/main/SECURITY.md)
for guidelines on reporting security issues.

## Contributing

Please see the [Juju SDK docs](https://juju.is/docs/sdk) for guidelines on
enhancements to this charm following best practice guidelines,
and [CONTRIBUTING.md](https://github.com/canonical/sso-service-operator/blob/main/CONTRIBUTING.md)
for developer guidance.

## License

The Charmed SSO Service is free software, distributed under the Apache
Software License, version 2.0.
See [LICENSE](https://github.com/canonical/sso-service-operator/blob/main/LICENSE)
for more information.
237 changes: 237 additions & 0 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
# Copyright 2026 Canonical Ltd.
# See LICENSE file for licensing details.

name: sso-service
type: charm
title: SSO Service Operator
summary: Operator for the Identity Platform SSO Service (Bring Your Own SSO)
description: |
Operator for sso-service: the connections tenants register to their own
OpenID Connect providers, federation with those providers, and the login
and consent provider of a dedicated Hydra (hydra-sso) that Kratos uses as
its `byo-sso` provider.
links:
source: https://github.com/canonical/sso-service-operator
issues: https://github.com/canonical/sso-service-operator/issues

charm-user: non-root
platforms:
ubuntu@22.04:amd64:

assumes:
- juju >= 3.6
- k8s-api

config:
options:
http_proxy:
description: URL of the HTTP proxy eg http://proxy.internal:6666, it will set the HTTP_PROXY var in the workload environment
type: string
default: ''
https_proxy:
description: URL of the HTTPS proxy eg http://proxy.internal:6666, it will set the HTTPS_PROXY var in the workload environment
type: string
default: ''
no_proxy:
description: Domains that need to be excluded from proxying no_proxy="test.com,test.co.uk", it is a comma separate list
type: string
default: ''
log_level:
description: |
Configures the log level.

Acceptable values are: "info", "debug", "warning", "error" and "critical"
default: "info"
type: string
cpu:
description: |
K8s cpu resource limit, e.g. "1" or "500m". Default is unset (no limit). This value is used
for the "limits" portion of the resource requirements (the "requests" portion is
automatically deduced from it).
See https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: string
memory:
description: |
K8s memory resource limit, e.g. "1Gi". Default is unset (no limit). This value is used
for the "limits" portion of the resource requirements (the "requests" portion is
automatically deduced from it).
See https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: string
dev:
description: |
Development only, never in production. It accepts a public route without HTTPS, and
lets the service reach identity providers over plain HTTP and at private addresses.
type: boolean
default: false
initial_envelope_key_secret_id:
description: |
Juju secret id holding the envelope key under the entry `key` (the base64 of 32 random
bytes), e.g. to restore a backup of the database into a new deployment. It is only used
when the application is deployed the first time: the key is never changed afterwards,
and the charm blocks when the option names another key or a secret it cannot read.
type: secret
authn_issuer:
description: |
The expected issuer of incoming tokens to the management API. Defaults to the issuer
of the oauth integration; set it when callers present tokens of another issuer. The
service discovers that issuer's keys, unless authn_jwks_url says where they are.
type: string
default: ''
authn_jwks_url:
description: |
The URL to fetch JWKS keys for validating incoming tokens of authn_issuer, when its
keys are not to be discovered. It needs authn_issuer: alone, it blocks the charm.
type: string
default: ''
authn_allowed_subjects:
description: |
Comma separated list of token subjects that are allowed to access the management API.
Set together with authn_allowed_scope, a token is admitted with either. With neither
set, every valid token of the issuer is admitted.
type: string
default: ''
authn_allowed_scope:
description: |
The OAuth2 scope that is allowed to access the management API.
type: string
default: ''

actions:
run-migration:
description: Run the database migrations.
params:
timeout:
type: integer
description: Timeout in seconds for the migration.
minimum: 1
default: 120
get-envelope-key:
description: Get the envelope key, to keep with the database backups. Whoever can read the model can read the result.

requires:
logging:
interface: loki_push_api
optional: true
tracing:
interface: tracing
limit: 1
optional: true
description: |
Provides traces to COS Tempo instance
internal-route:
interface: istio_ingress_route
limit: 1
optional: true
description: |
Exposes the management API on the internal ingress, which has to authorize each
request. Without it the management API is reachable in the cluster only.
public-route:
interface: istio_ingress_route
optional: false
description: |
Exposes the pages a browser visits during an SSO sign-in on the public ingress,
which has to serve them over HTTPS.
pg-database:
interface: postgresql_client
optional: false
limit: 1
hydra-endpoint-info:
interface: hydra_endpoints
optional: false
limit: 1
description: |
Receive the endpoints of the Hydra deployment dedicated to SSO sign-ins, whose
login and consent provider this service is.
kratos-info:
interface: kratos_info
limit: 1
optional: false
description: |
Receive Kratos deployment info including the admin endpoint URL.
tenant-service-info:
interface: tenant_service_info
optional: false
limit: 1
description: |
Receive the tenant-service gRPC URL and the scope its API admits callers by.
oauth:
interface: oauth
optional: false
limit: 1
description: |
Receive oauth server's info and a set of client credentials.
The service calls tenant-service with them and verifies incoming tokens against the server.
byo-sso-client:
interface: oauth
optional: false
limit: 1
description: |
Register an OAuth client for Kratos at the Hydra deployment dedicated to SSO sign-ins.
receive-ca-cert:
interface: certificate_transfer
optional: true
description: |
Receive a CA cert.
This relation can be used with a local CA to obtain the CA cert that was used to sign proxied
endpoints.

provides:
metrics-endpoint:
interface: prometheus_scrape
optional: true
description: |
Provides application metrics to COS Prometheus instance
grafana-dashboard:
interface: grafana_dashboard
optional: true
description: |
Forwards the built-in grafana dashboard(s) for monitoring sso-service.
ui-endpoint-info:
interface: login_ui_endpoints
optional: false
description: |
Provides the login, consent and error page URLs to the Hydra deployment dedicated
to SSO sign-ins.
kratos-external-idp:
interface: external_provider
optional: false
limit: 1
description: |
Registers the Hydra deployment dedicated to SSO sign-ins as an external identity
provider in Kratos.
sso-service-info:
interface: sso_service_info
optional: true
description: |
Provides the sso-service gRPC URL to a related application.

peers:
sso-service:
interface: sso_service_peers

containers:
sso-service:
gid: 584792
uid: 584792
resource: oci-image

resources:
oci-image:
type: oci-image
description: OCI image for sso-service
upstream-source: ghcr.io/canonical/sso-service:bysso-d3b8476c

parts:
charm:
plugin: uv
source: .
build-snaps:
- astral-uv
build-packages:
- "rustc-1.85"
- "cargo-1.85"
templates:
plugin: dump
source: .
prime:
- templates/
14 changes: 14 additions & 0 deletions interfaces/sso_service_info/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# sso-service-info

The interface library for the `sso_service_info` relation: sso-service's charm publishes its
gRPC address, and the login UI's charm reads it.

It is a Python package that lives in this repository and is not published on Charmhub or PyPI.
A charm that needs it adds it to its dependencies at a commit of this repository:

```
sso-service-info @ git+https://github.com/canonical/sso-service-operator@<commit>#subdirectory=interfaces/sso_service_info
```

and adds `git` to the `build-packages` of its charm part in `charmcraft.yaml`. Usage is in the
module's docstring (`src/sso_service_info/__init__.py`).
17 changes: 17 additions & 0 deletions interfaces/sso_service_info/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2026 Canonical Ltd.
# See LICENSE file for licensing details.

[build-system]
requires = ["setuptools>=70.0.0"]
build-backend = "setuptools.build_meta"

[project]
name = "sso-service-info"
version = "0.1.0"
description = "Interface library for the sso_service_info relation"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"ops>=2.0.0",
"pydantic~=2.0",
]
Loading
Loading