Repository navigation
v0.3.0: account safety, certificate scope, client hardening - #20
Merged
Merged
Conversation
- sdk-golang v1.9.0 (retracted upstream) -> v1.8.4; bump direct deps - go 1.26.0 + toolchain go1.26.11 so release builds use a patched stdlib - govulncheck scans with go.mod toolchain instead of 'stable' - update and SHA-pin all GitHub Actions; drop NODE24 override - ci.yml: contents: read; verify nfpm download checksum - nfpm 2.49.0, jfrog-cli 2.133.0, golang:1.26 build image - ziti-test builds via build-packages.sh; suite paths updated - add dependabot config; fix CLAUDE.md TTL/usermod drift
Use GetDialerIdentityName(), which the caller's edge router sets, as the only source of the caller's identity in ziti-ssh-ca and ziti-ssh-host. The client-supplied CallerId header is now only compared, to log a warning on mismatch. - reject connections without a router-supplied dialer identity - ziti-ssh-host per-identity: close the connection instead of proxying when the identity is unknown - BREAKING: requires OpenZiti v2.0.0+ controller and edge routers - integration suite runs OpenZiti 2.0.8; docs updated
ziti-ssh-host now records the accounts it creates in /var/lib/ziti-ssh-host/owned-users.json (username -> identity, uid) and only creates, modifies, or deletes accounts recorded there for the connecting identity. - accounts not created by ziti-ssh-host are not managed (useradd "already exists" is no longer treated as success); uid >= 1000 required - reserved names and leading '-' refused; '--' before usernames; processes terminated by UID - username collisions between identities detected across restarts - sudoers files moved to /etc/sudoers.d/ziti-ssh-host-<username> - session count re-checked before cleanup on release - ziti-ssh-ca refuses per-identity principal root or leading '-' - new 'ziti-ssh-host users list|claim' for migrating existing accounts - OS calls behind accountOps interface; fake-based unit tests
ReloadSSHD treated any active ssh.socket as per-connection sshd and skipped both "systemctl reload ssh" and the SIGHUP to leftover sshd listeners. On Ubuntu 22.10+ ssh.socket uses Accept=no and starts a long-running ssh.service on the first connection, so a host where sshd was already running never loaded TrustedUserCAKeys after enroll and certificate logins failed until sshd was restarted. - reload ssh.service whenever it is active - SIGHUP top-level (PPID 1) sshd listeners unless ssh.socket is Accept=yes; decision in planSSHDReload with table tests - install-ca.sh: report ziti-ssh-ca status accurately; a first start before the ssh-ca service exists is expected
…xists The suite creates Ziti services only after all edge routers are online, so an ER that finishes post-install first sees ziti-ssh-host exit with "service 'ssh' not found" and failed provisioning. Treat that specific error as expected (systemd restarts the unit); other failures stay fatal.
With the CA's default 5-minute TTL and a fixed 5-minute refresh window, every ziti-ssh/ziti-scp invocation requested a new certificate, and a fourth call within seconds hit the CA rate limit. The CA's "error: ..." reply was then written to <key>-cert.pub, overwriting a valid cert. - refresh when < 20% of the cert's lifetime remains (30s..5m); 1m for 5-minute certs, unchanged for certs of 25m or longer - bounded read of the CA reply; "error:" replies surface as CARejectedError; only a user cert for the caller's key is written - shared client helpers used by ziti-ssh and ziti-scp, with tests - docs: default TTL is 5 minutes, not 8 hours
- count a session only after the ownership check passes, so a rejected connection cannot make the owner's final release skip teardown - shared reserved-username list (ca.IsReservedUsername) used by both ziti-ssh-ca principal validation and ziti-ssh-host - sudoers_rule: reject a leading ',', NUL bytes, and values without '=' - startup: remove legacy /etc/sudoers.d/<user> for registered accounts; report (never remove) legacy-format files for unregistered accounts; also listed by 'ziti-ssh-host users list' - postinstall comment and operations.md revocation section corrected
Add the OpenSSH "source-address" critical option to every certificate, defaulting to 127.0.0.1/32,::1/128. ziti-ssh-host always proxies to 127.0.0.1:22, so a certificate keeps working on every host the caller's Ziti policies allow, while sshd rejects it on connections that reach port 22 directly. - --cert-source-address / ZITI_CERT_SOURCE_ADDRESS (IPs/CIDRs or "none"); validated and normalised at startup - docs and CHANGELOG
- claim the callback port on 127.0.0.1 and ::1 (IPv4 only when the host has no IPv6 loopback) before contacting the identity provider; abort if either address is in use instead of opening the browser - never listen on non-loopback addresses (was ":<port>") - print the login URL to stderr before launching a browser; a failed launch is no longer fatal (replaces cli.OpenBrowser / log.Fatal) - deliver only the first callback; state from crypto/rand.Text; ReadHeaderTimeout on the callback server - redirect URI and default port unchanged; tests for the listener, refusal ordering, port release, browser fallback
- reject the connection if setting supplementary groups, removing a legacy sudoers file, or writing/removing the sudoers file fails, instead of continuing with the account's previous privileges - on a failed sudoers install, remove the existing file first - count the session only after permissions are applied - clear supplementary groups (with sudoers) when the last session ends and on restart when accounts are kept - tests via failure injection in the fake account ops; docs updated
- ZITI_TERMINATE_ON_DISCONNECT (default false; per-identity, cleanup off): after dropping privileges, end all of the account's processes (disable-linger, loginctl terminate-user, SIGTERM/SIGKILL by UID) and keep the account; also applied to orphaned accounts at startup - terminateUserProcesses extracted from deleteUser and exposed via accountOps.TerminateProcesses; only for verified-owned accounts - startup warning when neither cleanup nor termination is enabled - tests; env template, docs and CHANGELOG
- --max-connections / ZITI_MAX_CONNECTIONS (default 64): connections beyond the cap are closed immediately (dispatch) - per-identity rate limit checked before the request is read and applied to CA public key requests too - per-connection deadline 30s -> 10s - tests: rate-limited caller answered without sending anything; cap rejects and releases slots
The host owner now limits, per Ziti service, what a controller-side ziti-ssh-host.v1 config may grant on the host: - ZITI_ALLOW_SUDOERS: services whose config may set sudoers_rule (default none; "*" for all) - ZITI_ALLOW_GROUPS: <service>:<group> / *:<group> opt-ins for privileged groups (root, sudo, admin, wheel, docker, lxd, disk, shadow, libvirt) - ZITI_RESTRICT_GROUPS=true: only listed groups may be granted Entries exceeding the policy reject the connection; violations are logged at load/reload and shown by inspect. Host env fallbacks are exempt (ResolveWithSource). Invalid settings stop run in per-identity mode. BREAKING: existing sudoers/privileged-group grants need opt-in.
The openziti-controller v2 package runs the controller as ziti-controller, so the unit's fixed User=ziti could not read the 0600 intermediate key there. The postinstall now detects the controller's user (ziti-controller.service User=, else owner of "ziti controller run" resolved by UID) and writes a managed drop-in with User=/Group=, and gives /etc/ziti-ssh-ca to that user (0750) so identity-file updates can be saved. Administrator overrides and hand-edited drop-ins are left alone; if nothing is detected, instructions are printed.
Accept ed25519, ECDSA P-256/384/521, sk- security-key variants and RSA >= 3072 bits. Refuse certificates, DSA, short RSA and the CA's own key with an "error:" reply; malformed requests also get an error reply.
- ziti-ssh-ca: --cert-extensions / ZITI_CERT_EXTENSIONS (validated), default permit-pty,permit-port-forwarding (no agent forwarding) - ziti-ssh connect: -A refused unless --forward-agent-unverified, since the host answering on a terminator address cannot yet be verified - docs and CHANGELOG (breaking for -A users)
In ProxyCommand mode stdin/stdout carry the SSH stream; the key generation prompt was written into it. resolveKey now takes an interactive flag and proxy returns an error instead of prompting.
The sshd drop-in now adds "Match Group ziti-ssh-managed" with AuthorizedKeysFile none and AuthorizedKeysCommand none, so a key a user adds to their own authorized_keys cannot outlive their certificate or identity. Other accounts are unaffected. - group created by the package postinstall, enroll and run; run rewrites an outdated drop-in at startup and reloads sshd - per-identity accounts always kept in the group (also after privileges are dropped); shared mode: admin adds the shared account, run warns if the group is empty - verified on Ubuntu 24.04: Match block ends with the included file (sshd -t ok, main-config settings stay global) - integration suite adds ziggy to the group
- refuse to write through an existing local symlink - downloaded files use the remote permission bits reduced by the umask (was always 0644); -p never makes files world-writable - recursion depth limited to 64 in both directions - control characters in server-supplied names replaced when printed - tests against pkg/sftp's in-memory server
A service whose ziti-ssh-host.v1 config cannot be fetched or parsed now rejects per-identity connections instead of falling back to the global defaults; a failed reload discards the previous config. Not attaching a config still uses the fallbacks.
- take each controller's intermediate CA from the TLS VerifiedChains, not the server-presented certificates (test: a rogue CA with the same subject was previously chosen) - a controller that does not answer no longer drops its CA key from TrustedUserCAKeys; keys are removed only when all controllers answered - serialise event/poller refreshes; ignore and never persist an empty controller URL list (PersistZtAPIs guard applies to all binaries)
In cleanup mode, before userdel, delete entries owned by the user's UID in /tmp, /var/tmp and /dev/shm (files and symlinks themselves, then directories left empty; never following links) so they do not pass to the next account given the same UID.
Document that access control is per Ziti service, that any identity with Bind can answer for an unused host name, and that one service per host gives a per-host guarantee; reference the upstream OpenZiti work.
ziti-ssh and ziti-scp no longer accept any host key. Keys are remembered per Ziti address in $XDG_CONFIG_HOME/ziti-ssh/known_hosts (0600): - "<terminator>@<service>" (one host): a changed key is refused - "<service>" dialed directly (any bound host may answer): the user is asked before trusting an additional key; refused without a terminal Also: "ziti-ssh known-hosts list|remove", a stderr notice when a service is dialed directly, and comments that wrongly claimed Ziti proves the host's identity are corrected. OpenZiti does not tell the dialer which identity answered (H8), so this detects impersonation after the first connection.
The CA key is the controller's intermediate CA key (RSA on stock controllers; ECDSA and Ed25519 also supported), not Ed25519. Packages are built with build-packages.sh, so the old dpkg-deb script is gone.
- controller TLS trust mirrors "ziti edge login": --controller-ca, then a saved bundle, then system roots, then the controller's own /.well-known/est/cacerts bundle verified against its TLS chain, shown and confirmed (or --yes) and saved; a changed CA is refused unless confirmed interactively; --insecure now warns - admin password from --password-file (or "-"), ZITI_CTRL_PASSWORD_FILE, ZITI_CTRL_PASSWORD, or a hidden prompt; --password warns - github.com/fullsailor/pkcs7 becomes a direct dependency (was indirect) - tests against a local TLS controller serving a real PKCS#7 bundle
The Docker build context no longer includes .git, dist/, local binaries, enrollment JWTs, identity JSON, key material or local security notes. golang:1.26-bookworm is pinned by its multi-arch index digest and Dependabot tracks it.
- binaries move from /usr/local/bin to /usr/bin (units and suite updated) - ziti-ssh-ca / ziti-ssh-host prerm: stop and disable the service on removal (deb remove, rpm 0), not on upgrade - postrm purge: ziti-ssh-host removes its sshd drop-in and CA key and reloads sshd; ziti-ssh-ca removes its managed systemd drop-in. Identities, env files, registry and accounts are always kept. - docs: Uninstalling section
Tagged prereleases now attach SHA256SUMS for every .deb and .rpm to the GitHub release and attest build provenance for each package with actions/attest-build-provenance (pinned to v4.2.2's commit). Document how to verify packages (repository index, checksums, gh attestation verify).
ziti-test.yml and promote.yml declare permissions: contents: read at the top level; the integration-test job adds only id-token: write. The ziti-test-suite reusable workflow and the suite code it checks out are pinned to the same commit instead of main.
…cp --service ziti-ssh and ziti-scp split [user@]target at the last '@', as OpenSSH does, so user names containing '@' work. ziti-scp treats an argument as remote only when a ':' has no '/' before it (scp semantics), and gains --service to treat the host as a terminator address even when it is also a service name. Documents ziti-ssh --service accurately.
…oopback binds Forwarding specs accept bracketed IPv6 addresses like ssh(1) and reject ports outside 1-65535. A warning is printed when a -L or -D listener is bound to a non-loopback address, since it has no authentication.
connect, sign, proxy, list and ziti-scp register an MFA TOTP listener, so MFA-enrolled identities can authenticate outside the mfa subcommands. Codes are read from /dev/tty without echo (never stdin), with three attempts; end of input stops the prompt instead of looping.
…efuse writable config Generated keys are no longer created with an empty passphrase. An encrypted key that no agent holds is unlocked with a passphrase prompt on the terminal. config.yaml and known_hosts are refused when another user could have written them.
Permission keys are matched with '*' (any run, including '/') and '?' only; '[' and '\' are literal. Patterns of equal specificity are ordered by pattern string so the result no longer depends on map order. Keys whose meaning changed are flagged at load and by inspect.
DeriveUsername lowercases only A-Z; other characters outside [a-z0-9_-] become '_'. Unicode case folding mapped some non-ASCII letters to ASCII ones, letting lookalike identity names derive the same username.
Certificates get a random non-zero serial, logged by the CA at issue (sshd logs it at login). ValidAfter is 60 s before signing so hosts with a slightly slow clock accept new certificates; expiry unchanged.
…rites Controller-supplied URL lists are filtered to https URLs with a host and no user info, query or fragment, and deduplicated, before ziti-ssh-host fetches CA keys and before any binary persists them. The identity file is not rewritten when the list is unchanged.
…sion conflicts ziti-ssh-host run caps concurrent connections per service (--max-connections / ZITI_MAX_CONNECTIONS, default 128); excess connections are closed immediately. In per-identity mode, while an account has sessions open through one service, a connection through a different service with different permissions is rejected rather than changing the open sessions' groups and sudoers rule.
Debian/Ubuntu create user files 0664 (umask 002, user private groups), so the new config/known_hosts check refused ordinary installs. Accept group write when the group is the owner's primary group, named after the owner, with no other members, as OpenSSH does.
…g tests RunDynamicProxy now answers 0xFF and closes when the client offers no acceptable method (RFC 1928). New tests run -L, -R and -D against an in-process SSH server: round trips, SOCKS5 IPv4/domain/IPv6 CONNECT, unsupported command and address type, refused connection, SOCKS4, and shutdown on cancel.
SFTP: upload/download of files and directories, multiple sources, missing paths, -r required, -p timestamps (filesystem-backed server), safeName. OIDC: a fake identity provider drives runFlow through the real redirect, PKCE and client-secret paths; tampered state, bad signature and wrong issuer yield no token. The browser launcher and flow timeout are now package variables for tests. go-jose/v4 becomes a direct (test) dependency; go.sum unchanged.
Without user@, ziti-ssh connect and ziti-scp use the certificate's single principal (the derived Linux username in per-identity mode), falling back to the local user name. Corrects the docs: in per-identity mode an explicit user must be the derived username, not the Ziti identity name.
… a user When a kept account is terminated at its last disconnect (ZITI_TERMINATE_ON_DISCONNECT) or before deletion, the account is first expired (usermod -e 1) so neither sshd nor cron accepts it, then its crontab and at jobs are removed before its processes are ended. The next authorized connection re-enables the account (usermod -e ""); if that fails the connection is rejected.
ziti-ssh-host run sets the SDK service refresh interval to 30 s (ZITI_SERVICE_REFRESH, minimum 5 s) instead of the SDK default of 5 minutes, so a changed or reduced ziti-ssh-host.v1 config reaches the host within 30 s. The docs claimed changes applied within seconds.
suites/ziti-ssh-per-identity runs the same topology in per-identity mode with a second service (ssh-ops) and checks, against real hosts: account creation and registration, certificate-principal default user, authorized_keys disabled, pre-existing accounts refused, the host grant policy, live config reload, fail-closed on an invalid config, the cross-service permission conflict, privilege clearing on disconnect, termination of crontab/processes with account expiry and re-enable, and account deletion with cleanup on. The shared install scripts read optional suite vars (ZSSH_MODE, ZSSH_SERVICES, ZSSH_ALLOW_GROUPS, ZSSH_SERVICE_REFRESH); the shared suite is unchanged.
ziti-test.yml runs suites/ziti-ssh and suites/ziti-ssh-per-identity as a matrix over the same packages, each with its own stack name (run_id_override).
Label the unreleased section 0.3.0 (2026-11-20) and replace the advisory placeholder with upgrade notes: routers >= 2.0.0, upgrade CA and hosts together, breaking changes, claiming pre-registry accounts, the managed group in shared mode, and process/job handling on disconnect. Update the project structure in CLAUDE.md.
nfpm v2.49.0 requires Go >= 1.27.4, so the go install fallback failed in the Docker build (GOTOOLCHAIN=local, Go 1.26) and on machines without nfpm. When nfpm is not on PATH, build-packages.sh now downloads the pinned release binary, verifies it against the release checksums and uses it for this run only, as prerelease.yml does. Verified with docker-build-packages.sh (deb and rpm built).
govulncheck-action defaults go-version-input to "stable", and setup-go ignores go-version-file whenever go-version is set, so the scan ran on the latest Go instead of the release toolchain. Empty go-version-input.
govulncheck-action's bundled setup-go scans with "stable" or the go directive (1.26.0), never the toolchain directive that builds releases. Run a pinned govulncheck (v1.9.0) after our setup-go instead; locally it reports no vulnerabilities with go1.26.11.
r-caamano
approved these changes
Nov 20, 2026
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.
Prepares v0.3.0. See
CHANGELOG.md→[0.3.0]for the full list. The section opens with"Security: upgrade required", which describes what operators must do when upgrading.
Highlights
ziti-ssh-caandziti-ssh-hosttake the caller's name only from the router-set dialeridentity. OpenZiti routers v2.0.0+ are required.
ziti-ssh-hostproxy (source-address);ziti-ssh-hostcreated are managed, andusers list|claimhandlesmigration;
ziti-ssh-managed);ZITI_SERVICE_REFRESH).known-hosts);known_hosts.ziti-ssh-ca config: trusts the controller CA likeziti edge login, and supports--password-file./usr/binand include remove/purge scripts;SHA256SUMSand build provenance attestations;Breaking changes
sudoers_ruleinziti-ssh-host.v1configs need a host opt-in (ZITI_ALLOW_GROUPS,ZITI_ALLOW_SUDOERS).ziti-ssh -Aneeds--forward-agent-unverified, and certificates no longer grant agent forwarding by default.*and?as wildcards. Derived usernames fold ASCII case only.ziti-ssh-caandziti-ssh-hosttogether.Testing
go build ./... && go vet ./... && go test ./.... New tests cover SFTP copy,-L/-R/SOCKS5 (against anin-process SSH server), OIDC end to end (fake identity provider), MFA, and account ownership and cleanup.
ziti-test-suite, OpenZiti 2.0.8, Ubuntu 24.04):suites/ziti-ssh(shared mode) passes;suites/ziti-ssh-per-identitypasses, 10 tests and 25 checks.ziti-test.ymlnow runs both suites as a matrix. Its first CI run will be dispatched on this branch.scripts/docker-build-packages.shbuilds deb and rpm.Please merge with a merge commit (not squash), to keep the commit history referenced in the release notes.