Skip to content

[action] [PR:168] Adding support for wildcard CN matching during client cert authentication#177

Merged
mssonicbld merged 1 commit intosonic-net:202511from
mssonicbld:cherry/202511/168
Jan 15, 2026
Merged

[action] [PR:168] Adding support for wildcard CN matching during client cert authentication#177
mssonicbld merged 1 commit intosonic-net:202511from
mssonicbld:cherry/202511/168

Conversation

@mssonicbld
Copy link

Microsoft ADO ID: 36341347

This PR enables the restapi container (acting as a REST API server) to match Common Names (CNs) provided in the client certificate against trusted wildcard CNs during authentication.
Note 1: Exact matching is still supported.
Note 2: * can only appear at the beginning of a trusted CN.

Examples:
*.example.com matches one.example.com and two.one.example.com, but it does not match example.com or example.com.edu (wildcard matching).
example.com only matches example.com (exact matching).

Unit tests are also included in this PR to verify the expected behavior. For unit tests, trusted CNs are test.client.restapi.sonic, *.example.sonic, and *test.sonic. For each unit test, we generate a new client certificate and sign it with the self-signed certificate under cert/client/.

…tion

Microsoft ADO ID: 36341347

This PR enables the restapi container (acting as a REST API server) to match Common Names (CNs) provided in the client certificate against trusted wildcard CNs during authentication.
**Note 1:** Exact matching is still supported.
**Note 2:** `*` can only appear at the beginning of a trusted CN.

Examples:
`*.example.com` matches `one.example.com` and `two.one.example.com`, but it does not match `example.com` or `example.com.edu` (wildcard matching).
`example.com` only matches `example.com` (exact matching).

Unit tests are also included in this PR to verify the expected behavior. For unit tests, trusted CNs are `test.client.restapi.sonic`, `*.example.sonic`, and `*test.sonic`. For each unit test, we generate a new client certificate and sign it with the self-signed certificate under `cert/client/`.
@mssonicbld
Copy link
Author

Original PR: #168

@mssonicbld
Copy link
Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld mssonicbld merged commit 6770863 into sonic-net:202511 Jan 15, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant