Repository navigation
feat: Kerberos clock skew tolerance per instance - #14
Merged
Merged
Conversation
added 4 commits
November 19, 2026 10:21
PATCH /v1/instances/{name} re-validates the merged instance, but the
ValidationError of that step was not handled: an edit such as
"lmnsquid edit <name> --http-port 0" answered "500 Internal Server
Error" without a reason. It is now a 422 in FastAPI's validation format,
naming the field, like a bad POST body; nothing is changed, as before.
A school's Windows clients run 1 h ahead of the proxy after a LINBO sync
until W32Time corrects them; their authenticators are then refused with
"Clock skew too great" (MIT default 300 s) and users get login popups.
Until the clients are fixed, an instance can now tolerate more (ADR-017):
lmnsquid edit <name> --krb5-clockskew-seconds 5400 (also on create)
PATCH /v1/instances/{name} {"krb5_clockskew_seconds": 5400}
krb5_clockskew_seconds: 5400 in the instance definition + reconcile
300-7200 s, default 300. The value is part of the instance definition,
so update, update-all, rollback and reconcile keep it. The control plane
passes it as KRB5_CLOCKSKEW_SECONDS, only when it differs from 300: the
env of an instance at the default stays that of 7.3.8, so its spec
fingerprint does not move and the upgrade replaces no container.
The entrypoint validates it again (plain decimal 300-7200, else FATAL
and exit 1 before anything is rendered; libkrb5 itself would silently
fall back to 300 on a value it cannot parse) and writes "clockskew = n"
into [libdefaults] of the krb5.conf it renders. MIT applies clockskew on
the acceptor side (krb5_check_clockskew on the authenticator time,
krb5int_validate_times on the ticket times); the replay cache keeps its
entries for the same skew (docs/references.md).
Per instance only: config.yml configures the control plane and has no
instance defaults to inherit from.
Docs: operations.md (how, when, trade-off), ADR-017, threat model T17,
architecture, references, the instance field table.
A new instance squid-skew (KRB5_CLOCKSKEW_SECONDS=5400) next to squid (default 300). The test client gets libfaketime: it fetches the TGT and the HTTP/<proxy> service ticket with the true time, as a Windows client holds them when its clock jumps, then runs curl with its clock ahead, so every authenticator carries that time: +0 min -> 200 at 300 and at 5400 +60 min -> 407 at 300, 200 at 5400 +100 min -> 407 at 5400 Also: the rendered krb5.conf carries "clockskew = 300" resp. 5400, and the image refuses 299, 7201 and abc (exit 1, FATAL), run without a network so it does not take the fixed address of the running instance.
… image
A client clock behind the proxy is not helped by a larger clockskew: an MIT
client fails itself ("Ticket not yet valid" in gss_init_sec_context, nothing
reaches the proxy) and the KDC refuses its new ticket requests; Windows (SSPI)
behaviour for that case is not verified. The setting takes effect only with a
data-plane image containing the new entrypoint (DEFAULT_IMAGE pinned to the CI
image built after the merge); with an older image the value is accepted and
stored but has no effect. operations.md, ADR-017, changelog.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
At a school, Windows clients start after the weekly LINBO re-imaging with a clock exactly 1 h behind (the image's registry holds the summer-time bias). When W32Time steps the clock later, every Kerberos authenticator of the running logon session is about 1 h in the future, and squid's
negotiate_kerberos_authrejects it (gss_accept_sec_context() failed ... Clock skew too great, MIT default 300 s), so users get login popups until they log off. The root cause is being fixed on the clients (RealTimeIsUniversal); this option bridges the time until every room has been re-imaged.What
krb5_clockskew_seconds(300–7200, default 300): CLI--krb5-clockskew-secondsoncreate/edit, REST POST/PATCH, hand-editable instance YAML (applied byreconcile/update <name>).KRB5_CLOCKSKEW_SECONDSonly when it differs from 300, so existing instances keep their container spec on upgrade; the entrypoint validates it again and writes[libdefaults] clockskew = <n>.lmnsquid edit/ PATCH with an invalid value now answers 422 with field and reason instead of 500 (all fields).clockskewapplies to the acceptor), test strategy, changelog block 7.3.9.Takes effect only with an image that contains the new entrypoint:
DEFAULT_IMAGEmust be pinned to the image CI builds after this merge (follow-up pin PR) before tagging.Tests
scripts/tests/run.sh quick: 7 passed, 0 failed, 0 skipped (pytest 223 passed).LMNSQUID_ALLOW_REAL=1 scripts/tests/run.sh e2e(Samba AD DC + squid + client, client clock shifted with libfaketime after a ticket was obtained): 4 passed, 0 failed, 0 skipped. +0 min → 200 at 300 and 5400; +60 min → 407 at 300, 200 at 5400; +100 min → 407 at 5400; entrypoint refuses 299 / 7201 /abc.make deb→linuxmuster-squid_7.3.9_amd64.deb.