Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dex expiry settings #233

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,13 @@ options:
DEPRECATED - Please leave empty or use issuer-url instead. This configuration option will be removed soon.
It has been preserved to avoid breaking compatibility with existing deployments.
Publicly-accessible endpoint for cluster
enable-expiry:
type: boolean
default: false
description: Modify expiry settings for dex
expiry-settings:
type: string
default: ''
description: |
Expiry settings in YAML format, as shown
in https://dexidp.io/docs/configuration/tokens/#expiration-and-rotation-settings
8 changes: 8 additions & 0 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ def _generate_dex_auth_config(self) -> str:
"staticPasswords": [],
}

enable_expiry = self.model.config["enable-expiry"]

# The dex-auth service cannot be started correctly when the static
# login is disabled, but no connector configuration is provided.
if not enable_password_db and not connectors:
Expand All @@ -250,6 +252,12 @@ def _generate_dex_auth_config(self) -> str:
],
}

# Add expiry settings for dex-auth
# This operation might modify the security level
if enable_expiry:
expiry_config = yaml.safe_load(self.model.config["expiry-settings"])
static_config["expiry"] = expiry_config

config = yaml.dump(
{
"issuer": self._issuer_url,
Expand Down