Files
bvandeusenandClaude Opus 5.5 24700ee608
CI / lint (push) Successful in 2s
CI / integration (push) Successful in 56s
CI / unit (push) Successful in 1m24s
CI / publish (push) Successful in 1m9s
feat(settings): Settings brought into line with the rest of Steward (milestone 493)
The last page of #5214's walk. Settings still described Steward as it was
before monitors were unified and SNMP was rebuilt, drew its tabs below the
breadcrumb, and showed the report schedule in UTC.

- Tabs (#5377): settings/_tabs.html is a settings_tabs() macro called in
  each page's section_tabs block, above the trail, as Ansible's are. The
  breadcrumb guard also fails any page that {% include %}s a tab strip.
- Report time (#5378): reports.schedule_tz keeps the zone of whoever saved
  the schedule; check_and_send compares in it (report_due), and the form shows
  the day and hour on the reader's clock (schedule_in) under their zone's
  name. "Last sent" uses |when.
- Wording (#5379): the report contents list what the report holds (monitors,
  not ping-enabled hosts); "Ping latency" is "Response time" and says what it
  grades; plugin detail says enabling loads now and disabling needs a
  restart; the monitor interval says it applies on the next check (the
  scheduler reads it every pass); the dead list-config branch is gone.
- Traefik (#5380): the 5xx and 4xx cutoffs are settings
  (traefik.threshold.error_5xx_pct 0.1, error_4xx_pct 1.0) in a "Traefik
  routers" group on Thresholds while the plugin runs, read by router_state
  through error_cutoffs(). The Traefik page has a Thresholds button for
  admins, to /settings/thresholds/#traefik.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 13:28:43 -04:00

193 lines
9.1 KiB
HTML

{# steward/templates/settings/auth.html #}
{% extends "base.html" %}
{% from "_macros.html" import crumbs %}
{% block title %}Settings — Auth — Steward{% endblock %}
{% from "settings/_tabs.html" import settings_tabs %}
{% block section_tabs %}{{ settings_tabs("auth") }}{% endblock %}
{% block breadcrumb %}{{ crumbs([("Settings", "/settings/"), ("Authentication", "")]) }}{% endblock %}
{% block content %}
<form method="post" action="/settings/auth/">{{ csrf_field() }}
<div style="display:grid;gap:1.25rem;max-width:640px;">
{# ── OIDC ─────────────────────────────────────────────────────────────────── #}
<div class="card">
<h2 class="section-title" style="margin-bottom:1.25rem;">OIDC / SSO</h2>
<p style="font-size:0.82rem;color:var(--text-muted);margin-bottom:1rem;">
Supports any OIDC provider — Authentik, Keycloak, Authelia, etc. Uses Authorization Code flow.
Local admin login always works regardless of OIDC status.
</p>
<div class="form-group" style="display:flex;align-items:center;gap:0.75rem;">
<input type="checkbox" name="oidc.enabled" id="oidc-enabled"
{% if settings['oidc.enabled'] %}checked{% endif %}>
<label for="oidc-enabled" style="margin:0;">Enable OIDC login</label>
</div>
<div class="form-group">
<label>Discovery URL</label>
<input type="text" name="oidc.discovery_url" value="{{ settings['oidc.discovery_url'] }}"
placeholder="https://auth.example.com/application/o/steward/.well-known/openid-configuration">
<p style="font-size:0.75rem;color:var(--text-muted);margin-top:0.2rem;">
Authentik: <code>https://&lt;host&gt;/application/o/&lt;slug&gt;/.well-known/openid-configuration</code>
</p>
</div>
<div style="display:grid;grid-template-columns:1fr 1fr;gap:1rem;">
<div class="form-group">
<label>Client ID</label>
<input type="text" name="oidc.client_id" value="{{ settings['oidc.client_id'] }}"
autocomplete="off">
</div>
<div class="form-group">
<label>Client Secret <span style="color:var(--text-dim);font-size:0.8rem;">(blank = keep current)</span></label>
<input type="password" name="oidc.client_secret" placeholder="••••••••"
autocomplete="new-password">
</div>
</div>
<div class="form-group">
<label>Scopes</label>
<input type="text" name="oidc.scopes" value="{{ settings['oidc.scopes'] }}"
placeholder="openid profile email">
</div>
<div style="display:grid;grid-template-columns:1fr 1fr 1fr;gap:1rem;">
<div class="form-group">
<label>Username claim</label>
<input type="text" name="oidc.username_claim" value="{{ settings['oidc.username_claim'] }}"
placeholder="preferred_username">
</div>
<div class="form-group">
<label>Email claim</label>
<input type="text" name="oidc.email_claim" value="{{ settings['oidc.email_claim'] }}"
placeholder="email">
</div>
<div class="form-group">
<label>Groups claim</label>
<input type="text" name="oidc.groups_claim" value="{{ settings['oidc.groups_claim'] }}"
placeholder="groups">
</div>
</div>
<div style="display:grid;grid-template-columns:1fr 1fr;gap:1rem;">
<div class="form-group">
<label>Admin group name</label>
<input type="text" name="oidc.admin_group" value="{{ settings['oidc.admin_group'] }}"
placeholder="steward-admins">
<p style="font-size:0.75rem;color:var(--text-muted);margin-top:0.2rem;">Members → admin role</p>
</div>
<div class="form-group">
<label>Operator group name</label>
<input type="text" name="oidc.operator_group" value="{{ settings['oidc.operator_group'] }}"
placeholder="steward-operators">
<p style="font-size:0.75rem;color:var(--text-muted);margin-top:0.2rem;">Members → operator role; others → viewer</p>
</div>
</div>
</div>
{# ── LDAP ─────────────────────────────────────────────────────────────────── #}
<div class="card">
<h2 class="section-title" style="margin-bottom:1.25rem;">LDAP</h2>
<p style="font-size:0.82rem;color:var(--text-muted);margin-bottom:1rem;">
Binds user credentials against an LDAP/AD directory. Requires the
<code>ldap3</code> Python package (<code>pip install ldap3</code>).
If both LDAP and OIDC are enabled, the login form tries LDAP; OIDC uses the SSO button.
</p>
<div class="form-group" style="display:flex;align-items:center;gap:0.75rem;">
<input type="checkbox" name="ldap.enabled" id="ldap-enabled"
{% if settings['ldap.enabled'] %}checked{% endif %}>
<label for="ldap-enabled" style="margin:0;">Enable LDAP login</label>
</div>
<div style="display:grid;grid-template-columns:1fr auto auto;gap:1rem;align-items:end;">
<div class="form-group">
<label>LDAP host</label>
<input type="text" name="ldap.host" value="{{ settings['ldap.host'] }}"
placeholder="ldap.example.com">
</div>
<div class="form-group">
<label>Port</label>
<input type="number" name="ldap.port" value="{{ settings['ldap.port'] }}" style="width:80px;">
</div>
<div class="form-group" style="display:flex;align-items:center;gap:0.5rem;padding-bottom:0.1rem;">
<input type="checkbox" name="ldap.tls" id="ldap-tls"
{% if settings['ldap.tls'] %}checked{% endif %}>
<label for="ldap-tls" style="margin:0;white-space:nowrap;">StartTLS</label>
</div>
</div>
<p style="font-size:0.75rem;color:var(--text-muted);margin:-0.4rem 0 1rem;">Port 636 connects with LDAPS; any other port with StartTLS ticked
upgrades the connection before any password is sent. Without either, passwords cross
the network in the clear. The server's certificate is checked.</p>
<div class="form-group">
<label>CA certificate (PEM, optional)</label>
<textarea name="ldap.ca_cert" rows="4" placeholder="-----BEGIN CERTIFICATE-----"
style="font-family:monospace;font-size:0.8rem;">{{ settings['ldap.ca_cert'] }}</textarea>
<p style="font-size:0.75rem;color:var(--text-muted);margin-top:0.2rem;">The certificate
authority that signed the directory's certificate, when it is not one the system already
trusts (a private or self-signed CA).</p>
</div>
<div class="form-group">
<label>Service account bind DN</label>
<input type="text" name="ldap.bind_dn" value="{{ settings['ldap.bind_dn'] }}"
placeholder="cn=svc-steward,ou=service,dc=example,dc=com">
</div>
<div class="form-group">
<label>Bind password <span style="color:var(--text-dim);font-size:0.8rem;">(blank = keep current)</span></label>
<input type="password" name="ldap.bind_password" placeholder="••••••••"
autocomplete="new-password">
</div>
<div class="form-group">
<label>Base DN</label>
<input type="text" name="ldap.base_dn" value="{{ settings['ldap.base_dn'] }}"
placeholder="ou=users,dc=example,dc=com">
</div>
<div class="form-group">
<label>User search filter</label>
<input type="text" name="ldap.user_filter" value="{{ settings['ldap.user_filter'] }}"
placeholder="(uid={username})">
<p style="font-size:0.75rem;color:var(--text-muted);margin-top:0.2rem;">
<code>{username}</code> is replaced with the login username. AD example: <code>(sAMAccountName={username})</code>
</p>
</div>
<div style="display:grid;grid-template-columns:1fr 1fr;gap:1rem;">
<div class="form-group">
<label>Admin group DN</label>
<input type="text" name="ldap.admin_group_dn" value="{{ settings['ldap.admin_group_dn'] }}"
placeholder="cn=steward-admins,ou=groups,dc=example,dc=com">
</div>
<div class="form-group">
<label>Operator group DN</label>
<input type="text" name="ldap.operator_group_dn" value="{{ settings['ldap.operator_group_dn'] }}"
placeholder="cn=steward-operators,ou=groups,dc=example,dc=com">
</div>
</div>
<div style="display:grid;grid-template-columns:1fr 1fr;gap:1rem;">
<div class="form-group">
<label>Username attribute</label>
<input type="text" name="ldap.attr_username" value="{{ settings['ldap.attr_username'] }}"
placeholder="uid">
</div>
<div class="form-group">
<label>Email attribute</label>
<input type="text" name="ldap.attr_email" value="{{ settings['ldap.attr_email'] }}"
placeholder="mail">
</div>
</div>
</div>
</div>
<div style="margin-top:1.25rem;">
<button type="submit" class="btn">Save</button>
<span style="color:var(--text-muted);font-size:0.82rem;margin-left:1rem;">
Changes take effect immediately.
</span>
</div>
</form>
{% endblock %}