Skip to content

TACACS+ TraceId documentation and update HLD#2358

Open
Rod-Persky wants to merge 4 commits into
sonic-net:masterfrom
Rod-Persky:dev/rodpersky/tacacs-trace-id
Open

TACACS+ TraceId documentation and update HLD#2358
Rod-Persky wants to merge 4 commits into
sonic-net:masterfrom
Rod-Persky:dev/rodpersky/tacacs-trace-id

Conversation

@Rod-Persky

@Rod-Persky Rod-Persky commented Jun 2, 2026

Copy link
Copy Markdown

Summary

Adds a High-Level Design (HLD) document at doc/aaa/TACACS+ Trace ID.md describing how SONiC propagates a client-supplied SSH TraceId environment variable into TACACS+ command authorization requests issued by bash_tacplus.

Related implementation PR

Motivation

Operators routinely need to reconstruct what happened during a specific access session or automation workflow — not just what commands were observed on a device. Today, TACACS+ command authorization records identify the user and command but carry no end-to-end correlation value supplied by the client workflow. This results in disjoint audit trails between the device-side TACACS+ logs and external systems such as access proxies, session recorders, or automation runners.

TraceId provides a shared join key. An access proxy or automation system generates a TraceId, injects it into the SSH session, preserves the same value in its own logs, and SONiC copies the validated value into every TACACS+ command authorization request for that session. A TACACS+ server or downstream log pipeline can then correlate device command authorization records with external access-session, session-recording, incident-response, or automation-run records.

Design overview

SSH client  --SetEnv/SendEnv TraceId-->  sshd (AcceptEnv TraceId)
   --> bash startup marks TraceId readonly
   --> bash_tacplus validates TraceId
   --> tac_add_attrib(&attr, "traceid", trace_id)
   --> TACACS+ authorization server
  • Standard OpenSSH AcceptEnv is used to receive TraceId; no new SSH client option is introduced.
  • The user's initial interactive bash shell marks TraceId readonly as a best-effort accidental-change guard (not a security boundary).
  • bash_tacplus validates the value (length, character set) and either sends the exact value as a traceid=<value> AV pair, or omits the attribute entirely.
  • Behavior is unchanged when TraceId is absent or invalid, and for all non-authorization TACACS+ flows.

Scope

In scope

  • Accept an SSH client-supplied TraceId environment variable.
  • Preserve it as readonly in the initial interactive bash shell.
  • Validate before attaching to TACACS+ requests.
  • Add traceid=<value> to TACACS+ command authorization requests only.
  • Unit, integration, and regression tests for the authorization path.

Out of scope

  • Other TACACS+ packet types or other AAA flows.
  • Local Linux audit record changes.
  • A new ssh -o TraceId=<value> client option.
  • A tamper-resistant root-owned per-session state store.
  • SAI, SWSS, syncd, ASIC, or platform driver changes.

Compatibility

  • SSH login continues to work for clients that do not send TraceId.
  • TACACS+ servers that ignore unknown AV pairs continue to work unchanged.
  • Existing TACACS+ server configuration and AAA CLI behavior are untouched.
  • Existing OpenSSH hardening settings remain intact.

Document

  • doc/aaa/TACACS+ Trace ID.md — full HLD following the SONiC HLD template (sections 1-16).

Type of change

  • Documentation (HLD)

This PR is documentation-only; the implementation lives in sonic-net/sonic-buildimage#27667.

@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 2, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: Copilot / name: Copilot (8a29686)
  • ✅ login: Rod-Persky / name: Rod Persky (8a29686)

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@Rod-Persky
Rod-Persky force-pushed the dev/rodpersky/tacacs-trace-id branch from e394c2c to 8a29686 Compare June 2, 2026 06:33
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

Rod-Persky added a commit to Rod-Persky/sonic-buildimage that referenced this pull request Jun 2, 2026
…uthorization

Implements the HLD in sonic-net/SONiC#2358. Accepts a client-supplied `TraceId` env var via OpenSSH AcceptEnv, marks it readonly in the user's initial interactive bash, validates the value, and attaches it as a `TraceId=<value>` attribute on per-command TACACS+ authorization requests. Behavior is unchanged when TraceId is absent or invalid.

How to verify it:

- Build sonic-vs and SSH with `SendEnv TraceId` set to a valid value; confirm authorization requests include the TraceId attribute and that invalid/oversized values are silently dropped.

- Run the bash_tacplus unit tests under src/tacacs/bash_tacplus/unittest/.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Rod-Persky
Rod-Persky marked this pull request as ready for review June 2, 2026 07:30
Introduces a High-Level Design for propagating a client-supplied SSH `TraceId` environment variable into TACACS+ command authorization requests issued by `bash_tacplus`.

The `TraceId` provides a shared correlation key between external systems (access proxies, automation workflows, session recorders) and per-command TACACS+ authorization records, enabling end-to-end audit trail reconstruction without changing login behavior, TACACS+ server configuration, or command allow/deny semantics.

The design accepts `TraceId` via standard OpenSSH `AcceptEnv` propagation, preserves it as a readonly variable in the user's initial interactive shell, validates the value, and attaches it as a `TraceId=<value>` attribute on command authorization requests. Behavior is unchanged when `TraceId` is absent or invalid.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Rod Persky <770327+Rod-Persky@users.noreply.github.com>
@Rod-Persky
Rod-Persky force-pushed the dev/rodpersky/tacacs-trace-id branch from 8a29686 to c1eb65c Compare June 3, 2026 00:25
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

Rod-Persky added a commit to Rod-Persky/sonic-buildimage that referenced this pull request Jun 3, 2026
…uthorization

Implements the HLD in sonic-net/SONiC#2358. Accepts a client-supplied `TraceId` env var via OpenSSH AcceptEnv, marks it readonly in the user's initial interactive bash, validates the value, and attaches it as a `TraceId=<value>` attribute on per-command TACACS+ authorization requests. Behavior is unchanged when TraceId is absent or invalid.

How to verify it:
- Build sonic-vs and SSH with `SendEnv TraceId` set to a valid value; confirm authorization requests include the TraceId attribute and that invalid/oversized values are silently dropped.
- Run the bash_tacplus unit tests under src/tacacs/bash_tacplus/unittest/.

Signed-off-by: Rod Persky <770327+Rod-Persky@users.noreply.github.com>
Signed-off-by: Rod Persky <770327+Rod-Persky@users.noreply.github.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@tirupatihemanth

Copy link
Copy Markdown

Any plans to show some sort of indication in either CLI (or elsewhere) to indicate that we've TraceId implementation/support present.
NOTE: This is a non-blocker for this HLD approval

@sarabjeetsingh1509

Copy link
Copy Markdown

Hi Rod,

One recommendation is to check if any testcases needs to be added into https://github.com/sonic-net/sonic-mgmt/tree/master/tests/tacacs

Regards

This design adds one optional authorization attribute:

```text
traceid=<trace-id>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we don't want to honor the trace-id in the SONiC switch, do we have a config option? I'm thinking from security standpoint.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @venkatmahalingam, I've added yang configuration which is exposed in redis that can be used to disable this feature. This also can be leveraged to identify the feature is available.

Signed-off-by: Rod Persky <770327+Rod-Persky@users.noreply.github.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@Rod-Persky

Copy link
Copy Markdown
Author

@tirupatihemanth, regarding

Any plans to show some sort of indication in either CLI (or elsewhere) to indicate that we've TraceId implementation/support present. NOTE: This is a non-blocker for this HLD approval

I've added yang configuration which is exposed in redis that can be used to identify the feature is available and active.

Signed-off-by: Rod Persky <770327+Rod-Persky@users.noreply.github.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants