feat(inputs.opcua): Support persistent self-signed client certificates - #17991
Merged
mstrandboge merged 6 commits intoNov 25, 2025
Merged
Conversation
Add support for persistent auto-generated client certificates to maintain stable client identity across Telegraf restarts. Previously, self-signed certificates were always generated in temporary directories and recreated on each restart, requiring OPC UA servers to re-authorize the client.
srebhan
reviewed
Nov 13, 2025
srebhan
left a comment
Member
There was a problem hiding this comment.
Thanks @skartikey! Some comments...
- Use os.MkdirAll instead of custom validateCertificatePaths function - Move fileExists helper to test file - Extract certificate setup into determineOrCreateCertificates method
srebhan
reviewed
Nov 14, 2025
Member
There was a problem hiding this comment.
@skartikey some more minor comments and a suggestion to untangle the creation reasoning process a bit.
- Restructure determineOrCreateCertificates with generate/permanent flags - Add check for specifying only one of certificate/private_key - Use errors.Is for proper error checking on os.Stat - Simplify os.MkdirAll calls without extra directory checks - Update README headings and use Markdown alerts - Merge and simplify certificate documentation in sample.conf
srebhan
reviewed
Nov 24, 2025
srebhan
left a comment
Member
There was a problem hiding this comment.
Nice @skartikey! Just two more comments regarding the tests...
Co-authored-by: Sven Rebhan <36194019+srebhan@users.noreply.github.com>
Co-authored-by: Sven Rebhan <36194019+srebhan@users.noreply.github.com>
srebhan
reviewed
Nov 24, 2025
srebhan
left a comment
Member
There was a problem hiding this comment.
Sorry @skartikey somehow Github ate my comment regarding the file existence check...
Replace custom fileExists() helper with require.FileExists() and require.NoFileExists() from testify/require package.
Contributor
|
Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
mstrandboge
approved these changes
Nov 25, 2025
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.
Summary
Add support for persistent auto-generated client certificates to maintain stable client identity across Telegraf restarts. Previously, self-signed certificates were always generated in temporary directories and recreated on each restart, requiring OPC UA servers to re-authorize the client.
This PR implements a three-tier certificate management strategy:
Case 1: Temporary Certificates (Backward Compatible)
Case 2: Persistent Auto-Generated Certificates (NEW)
Case 3: Manual Certificates
Checklist
Related issues
resolves #11454