tailscale/ssh/tailssh
James Tucker 39a61888b8 ssh/tailssh: send audit messages on SSH login (Linux)
Send LOGIN audit messages to the kernel audit subsystem on Linux
when users successfully authenticate to Tailscale SSH. This provides
administrators with audit trail integration via auditd or journald,
recording details about both the Tailscale user (whois) and the
mapped local user account.

The implementation uses raw netlink sockets to send AUDIT_USER_LOGIN
messages to the kernel audit subsystem. It requires CAP_AUDIT_WRITE
capability, which is checked at runtime. If the capability is not
present, audit logging is silently skipped.

Audit messages are sent to the kernel (pid 0) and consumed by either
auditd (written to /var/log/audit/audit.log) or journald (available
via journalctl _TRANSPORT=audit), depending on system configuration.

Note: This may result in duplicate messages on a system where
auditd/journald audit logs are enabled and the system has and supports
`login -h`. Sadly Linux login code paths are still an inconsistent wild
west so we accept the potential duplication rather than trying to avoid
it.

Fixes #18332

Signed-off-by: James Tucker <james@tailscale.com>
2026-01-05 16:53:05 -08:00
..
testcontainers ssh/tailssh: accept passwords and public keys 2025-02-13 11:29:45 -06:00
accept_env_test.go ssh: Add logic to set accepted environment variables in SSH session (#13559) 2024-09-30 21:47:45 -06:00
accept_env.go ssh: Add logic to set accepted environment variables in SSH session (#13559) 2024-09-30 21:47:45 -06:00
auditd_linux_test.go ssh/tailssh: send audit messages on SSH login (Linux) 2026-01-05 16:53:05 -08:00
auditd_linux.go ssh/tailssh: send audit messages on SSH login (Linux) 2026-01-05 16:53:05 -08:00
incubator_linux.go ssh/tailssh: exclude Android from Linux build tags 2025-05-22 20:02:59 -07:00
incubator_plan9.go ssh/tailssh: add Plan 9 support for Tailscale SSH 2025-04-02 07:36:04 -07:00
incubator.go ssh/tailssh: fix incubator tests on macOS arm64 2025-11-17 16:20:46 -08:00
privs_test.go ssh/tailssh: only chdir incubator process to user's homedir when necessary and possible 2024-08-21 13:20:12 -05:00
tailssh_integration_test.go ssh/tailssh: accept passwords and public keys 2025-02-13 11:29:45 -06:00
tailssh_test.go ssh/tailssh: mark TestSSHRecordingCancelsSessionsOnUploadFailure as flaky 2025-09-17 11:27:00 +01:00
tailssh.go ssh/tailssh: send audit messages on SSH login (Linux) 2026-01-05 16:53:05 -08:00
user.go ssh/tailssh: exclude Android from Linux build tags 2025-05-22 20:02:59 -07:00