Skip to content
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

net/http: TLS handshake errors flood stdout with unhelpful messages #56183

Closed
ecnepsnai opened this issue Oct 12, 2022 · 2 comments
Closed

net/http: TLS handshake errors flood stdout with unhelpful messages #56183

ecnepsnai opened this issue Oct 12, 2022 · 2 comments

Comments

@ecnepsnai
Copy link

When an incoming connection to a TLS-backed HTTP server does not contain a valid TLS record, the net/http package will try to return a helpful error if the incoming message is HTTP (matching the behaviour of Apache), however in the event that the incoming connection doesn't contain a HTTP request, it writes an event to the logger of the http.Server: https://cs.opensource.google/go/go/+/master:src/net/http/server.go;l=1870;bpv=1;bpt=0

For http.Servers that are internet facing, especially those on public cloud providers, this can result in the output of that logger (by default stdout), being flooded with unhelpful messages such as: http: TLS handshake error from <ip>: EOF. A simple port scan will trigger this message.

This makes troubleshooting or monitoring the actual application difficult, as the log is overwhelmed by these messages. While other servers like nginx and apache do print out similar error messages, they offer significantly greater control over logging.

Go, on the other hand, only lets you override the logger with your own. This requires the application to either implement a null logger (therefor silencing all messages from the http.Server, including helpful errors), or writing a custom logger that filters these unhelpful errors.

I'm unsure if this is a proposal or bug (I feel it's both, really). I am asking if we want to remove this log line, or ignore EOF errors.

@seankhliao
Copy link
Member

While you might not care, other people do. Our best option is to log the error and you can filter it out if you don't care. Logger calls Write once per log line, the filtering isn't hard to implement.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Oct 12, 2022
@AlexanderYastrebov
Copy link
Contributor

This looks like duplicate of #26918

and you can filter it out if you don't care

See example https://github.com/zalando/skipper/blob/352fdda799f16f96480dbb588795886ed7042e04/skipper.go#L891-L907

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants