-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
promtail: add support for TLS/mTLS in syslog receiver #3907
promtail: add support for TLS/mTLS in syslog receiver #3907
Conversation
@@ -91,15 +94,58 @@ func (t *SyslogTarget) run() error { | |||
if err != nil { | |||
return fmt.Errorf("error setting up syslog target %w", err) | |||
} | |||
|
|||
tlsEnabled := len(t.config.TLSConfig.CertFile) > 0 || len(t.config.TLSConfig.CertFile) > 0 || len(t.config.TLSConfig.CAFile) > 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is the best way to check if tls_config
is set.
|
||
t.openConnections.Add(1) | ||
go t.acceptConnections() | ||
|
||
return nil | ||
} | ||
|
||
func newTLSConfig(certFile string, keyFile string, caFile string) (*tls.Config, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is inspired by NewTLSConfig from github.com/prometheus/common/config.
0329e14
to
7b16ffc
Compare
7b16ffc
to
f926c1d
Compare
b7848c3
to
1ff6b8e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling correction is needed in the Docs file. Otherwise, the docs portion of the PR looks good to me.
1ff6b8e
to
cd52cf5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@KMiller-Grafana I'll need your approval to merge this one please, thanks ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the doc change. Docs LGTM now.
This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
Can we merge this if everybody’s happy with it? |
Hi! This issue has been automatically marked as stale because it has not had any We use a stalebot among other tools to help manage the state of issues in this project. Stalebots are also emotionless and cruel and can close issues which are still very relevant. If this issue is important to you, please add a comment to keep it open. More importantly, please add a thumbs-up to the original issue entry. We regularly sort for closed issues which have a We may also:
We are doing our best to respond, organize, and prioritize all issues but it can be a challenging task, |
These bots are awful. |
What this PR does / why we need it:
Add support for TLS and mTLS in promtail's syslog receiver.
Which issue(s) this PR fixes:
Fixes #3898
Special notes for your reviewer:
Go is not my main language (and I don’t really like it) so there might be some coding-style issue or some bad patterns.
I successfully tested this change using rsyslog and I got the following results:
level=warn ts=2021-06-25T17:34:09.985034229Z caller=syslogtarget.go:207 msg="error initializing syslog stream" err="tls: first record does not look like a TLS handshake"
level=warn ts=2021-06-25T17:28:22.787523967Z caller=syslogtarget.go:207 msg="error initializing syslog stream" err="tls: client didn't provide a certificate"
Checklist: