feat: present a client certificate for mutual TLS - #46
Merged
Conversation
ClientCertChain and ClientKey join the stream config, and the collector moves to 6515. The device now authenticates itself to the collector as well as verifying it. Flash +13,624 B (+76 on the previous stage) RAM +37,740 B (+2,052) mbedTLS peak +15,912 B (37,244 absolute) Log stack +712 B (unchanged) Service +3,800 B (unchanged) Both handles come from the cert store, which has parsed them since boot. This figure is therefore the cost of *using* credentials the device already holds — a device doing server-authenticated TLS only would also have to provision, store and parse a client certificate and key to reach the same place. Neither stack moves: client authentication is another leg of a handshake the service task already had the depth for. The RAM is 2,048 of mbedTLS pool and 4 bytes of element, and the pool is the whole story: proving the device's identity raised the measured peak from 36,092 to 37,228, and peak x 1.5 rounded up to the next KiB takes the pool from 53 to 55 KiB. That resize is the rule, not a repair. The run passes at 53 KiB with 17 KB of the pool still free, so nothing forced it — but the margin exists for fragmentation rather than capacity, and a pool sized to yesterday's peak is how a later stage inherits someone else's headroom. Both credentials must be set: either one NULL disables mTLS and the connection falls back to server authentication only, without failing. That is why the pipeline element reports what was configured rather than what was intended — an element claiming protection the device does not have would be worse than not reporting it, since it is exactly the weakening a collector is watching for. Delivery is the proof. 6515 requires a client certificate, and scripts/smoke-oracle.sh shows it refusing a client that presents none, so a record arriving there is a record whose sender authenticated. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughChangesMutual TLS is wired into syslog startup with client credentials from Mutual TLS syslog flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant SyslogStart
participant DeviceCertStore
participant MbedTlsStream
participant SyslogPipelineSd
SyslogStart->>DeviceCertStore: fetch client certificate chain and key
SyslogStart->>MbedTlsStream: configure mutual TLS stream
SyslogStart->>SyslogPipelineSd: initialize transport metadata
SyslogPipelineSd-->>SyslogStart: return shared structured data
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/syslog/Syslog.c`:
- Line 54: Update the server-only TLS fallback associated with
SYSLOG_COLLECTOR_PORT so incomplete credentials do not target port 6515, which
rejects certificate-less clients. Select the configured reachable server-only
port when either credential is missing, or fail startup explicitly instead of
attempting an unusable connection.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b849178c-d41d-49e0-a55a-69a7fdb7c9bf
⛔ Files ignored due to path filters (2)
measurements/mtls.csvis excluded by!**/*.csvmeasurements/stages.tsvis excluded by!**/*.tsv
📒 Files selected for processing (6)
README.mdapp/AppConfig.happ/syslog/Syslog.capp/syslog/SyslogPipelineSd.capp/syslog/SyslogPipelineSd.hrun-report.md
5 tasks
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.
Pull request
What this stage adds
ClientCertChain and ClientKey join the stream config, and the collector moves to
6515. The device now authenticates itself to the collector as well as verifying it.
Flash +13,624 B (+76 on the previous stage)
RAM +37,740 B (+2,052)
mbedTLS peak +15,912 B (37,244 absolute)
Log stack +712 B (unchanged)
Service +3,800 B (unchanged)
Both handles come from the cert store, which has parsed them since boot. This
figure is therefore the cost of using credentials the device already holds — a
device doing server-authenticated TLS only would also have to provision, store and
parse a client certificate and key to reach the same place.
Neither stack moves: client authentication is another leg of a handshake the
service task already had the depth for. The RAM is 2,048 of mbedTLS pool and 4
bytes of element, and the pool is the whole story: proving the device's identity
raised the measured peak from 36,092 to 37,228, and peak x 1.5 rounded up to the
next KiB takes the pool from 53 to 55 KiB.
That resize is the rule, not a repair. The run passes at 53 KiB with 17 KB of the
pool still free, so nothing forced it — but the margin exists for fragmentation
rather than capacity, and a pool sized to yesterday's peak is how a later stage
inherits someone else's headroom.
Both credentials must be set: either one NULL disables mTLS and the connection
falls back to server authentication only, without failing. That is why the pipeline
element reports what was configured rather than what was intended — an element
claiming protection the device does not have would be worse than not reporting it,
since it is exactly the weakening a collector is watching for.
Delivery is the proof. 6515 requires a client certificate, and scripts/smoke-oracle.sh
shows it refusing a client that presents none, so a record arriving there is a
record whose sender authenticated.
Files
Checklist
measurements/mtls.csvcommitted.measurements/stages.tsv.python3 scripts/gen-cost-table.py../run.shgreen (build + QEMU + baseline self-check) —run-report.mdcommitted.Context for review: 19 of 21 sequential single-commit PRs replaying the integration on top of the Baseline root. Each lands green and reviewed before the next is built on it, because a change to an early commit would force every commit above it to be re-run and re-measured.
Summary by CodeRabbit
New Features
Documentation
Configuration