Use TLS for certificate-free gNMI services - #28915
Conversation
Signed-off-by: Dawei Huang <daweihuang@microsoft.com>
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Signed-off-by: Dawei Huang <daweihuang@microsoft.com>
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Signed-off-by: Dawei Huang <daweihuang@microsoft.com>
|
/azp run Azure.sonic-buildimage |
There was a problem hiding this comment.
Pull request overview
This PR updates the gNMI/telemetry container launch scripts in sonic-buildimage so that when no valid TLS certificate/key is configured, the services fall back to --insecure (TLS with an insecure/self-signed mode) instead of starting in plaintext (--noTLS) bound to loopback only.
Changes:
- Replace the no-certificate fallback from
--noTLS --bind_address 127.0.0.1to--insecurein both launcher variants. - Keep existing behavior for configured cert/mTLS paths (CERTS/X509), while making the certificate-free path encrypted.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| dockers/docker-sonic-telemetry/telemetry.sh | Switches the “no CERTS/X509 configured” fallback from plaintext loopback to --insecure. |
| dockers/docker-sonic-gnmi/gnmi-native.sh | Makes the same fallback change in the alternate launcher variant. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| else | ||
| TELEMETRY_ARGS+=" --noTLS --bind_address 127.0.0.1" | ||
| TELEMETRY_ARGS+=" --insecure" | ||
| fi |
There was a problem hiding this comment.
Current PR diff includes all three gitlinks: sonic-gnmi 835b6b4, sonic-host-services 798f9d1, and sonic-utilities 56d9bc76. The PR body now lists those integrated source changes.
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Signed-off-by: Dawei Huang <daweihuang@microsoft.com>
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Signed-off-by: Dawei Huang <daweihuang@microsoft.com>
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (2)
dockers/docker-sonic-telemetry/telemetry.sh:113
CLIENT_AUTHis extracted with the jq filter.client_auth(no// empty). If the GNMI JSON object exists but omitsclient_auth,jq -rwill return the literal stringnull, which is not caught by the-z "$CLIENT_AUTH"branch in the new--allow_no_client_authgating. This can accidentally require client cert auth even when no client CA is configured.
Normalize missing/null to empty so the condition behaves as intended.
CLIENT_AUTH=$(extract_field "$GNMI" '.client_auth')
if [ "$CERTIFICATE_FREE_TLS" == "true" ] || [ "$CLIENT_AUTH" == "false" ] || { [ -z "$CLIENT_AUTH" ] && [ "$HAS_CLIENT_CA" == "false" ]; }; then
TELEMETRY_ARGS+=" --allow_no_client_auth"
dockers/docker-sonic-gnmi/gnmi-native.sh:95
CLIENT_AUTHis extracted with.client_auth(no// empty). If the GNMI JSON object exists but doesn’t includeclient_auth,jq -rreturns the stringnull, which won’t satisfy-z "$CLIENT_AUTH"in the new--allow_no_client_authlogic. That can unintentionally enforce client cert auth even when no client CA is configured.
Use // empty so missing/null is treated as unset.
CLIENT_AUTH=$(extract_field "$GNMI" '.client_auth')
if [ "$CERTIFICATE_FREE_TLS" == "true" ] || [ "$CLIENT_AUTH" == "false" ] || { [ -z "$CLIENT_AUTH" ] && [ "$HAS_CLIENT_CA" == "false" ]; }; then
TELEMETRY_ARGS+=" --allow_no_client_auth"
fi
Signed-off-by: Dawei Huang <daweihuang@microsoft.com>
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
…e-fallback Signed-off-by: Dawei Huang <daweihuang@microsoft.com>
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Suppressed comments (2)
dockers/docker-sonic-telemetry/telemetry.sh:28
ESCAPE_QUOTEis defined but never used in this script. Removing it avoids confusion about whether additional quoting/escaping is expected elsewhere.
TELEMETRY_VARS_FILE=/usr/share/sonic/templates/telemetry_vars.j2
ESCAPE_QUOTE="'\''"
dockers/docker-sonic-gnmi/gnmi-native.sh:7
ESCAPE_QUOTEis defined but never used in this script. Removing it avoids confusion about whether additional quoting/escaping is expected elsewhere.
TELEMETRY_VARS_FILE=/usr/share/sonic/templates/telemetry_vars.j2
ESCAPE_QUOTE="'\''"
| CLIENT_AUTH=$(extract_field "$GNMI" 'if .client_auth == null then empty else .client_auth end') | ||
| if [ "$CERTIFICATE_FREE_TLS" == "true" ] || [ "$CLIENT_AUTH" == "false" ] || { [ -z "$CLIENT_AUTH" ] && [ "$HAS_CLIENT_CA" == "false" ]; }; then | ||
| TELEMETRY_ARGS+=" --allow_no_client_auth" |
There was a problem hiding this comment.
Intent clarified in the PR body: CA-backed paths keep the existing mTLS default, while explicit client_auth=false remains the pre-existing opt-out that requests but does not require a client certificate.
| CLIENT_AUTH=$(extract_field "$GNMI" 'if .client_auth == null then empty else .client_auth end') | ||
| if [ "$CERTIFICATE_FREE_TLS" == "true" ] || [ "$CLIENT_AUTH" == "false" ] || { [ -z "$CLIENT_AUTH" ] && [ "$HAS_CLIENT_CA" == "false" ]; }; then | ||
| TELEMETRY_ARGS+=" --allow_no_client_auth" |
There was a problem hiding this comment.
Intent clarified in the PR body: CA-backed paths keep the existing mTLS default, while explicit client_auth=false remains the pre-existing opt-out that requests but does not require a client certificate.
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
Verification status: Physical checks passed for the exercised DPU0 paths. Azure run Image and hardware
Evidence
Additional coverage and scope
The NPU and DPU0 were restored to their exact baseline images and defaults. Candidate images, temporary local/server/DUT artifacts, credentials, and the controller were removed. All four DPUs report |
|
/azpw retry |
|
Retrying failed(or canceled) jobs... |
|
Retrying failed(or canceled) stages in build 1187671: ✅Stage Test:
|
Why
Certificate-free gNMI currently falls back to plaintext loopback. SmartSwitch DPUs need encrypted midplane reachability without certificate provisioning.
Fixes #28540. Replaces #28564.
Microsoft ADO (number only): 39179389
What
client_auth=falseremains the existing opt-out that requests but does not require a client certificate.Validation
1187671.1188156plus focused tests.SONiC.master-28915.1187671-f1a440da3passed five direct TLSSystem.Timecalls, metadata-routed DPUProxySystem.Time, and the exercised DPU0 utility halt/reset path.Known CI Failure
cacl/test_cacl_application.pybecause its expected rules omit four FRR loopback OUTPUT rules added by earlier sonic-host-services PR 398.