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

"Wrong host name" when using smtp on port 587 #62

Open
guillaumevillemont opened this issue Oct 14, 2022 · 0 comments
Open

"Wrong host name" when using smtp on port 587 #62

guillaumevillemont opened this issue Oct 14, 2022 · 0 comments

Comments

@guillaumevillemont
Copy link

Issue

I tried to setup rageshake on an OVH env with OVH smtp server that uses port 587.
When sending a report I just got an 500 Internal Server on the client api.
And on rageshake logs :

Oct 14 16:43:21 matrix-rageshake[10585]: 2022/10/14 14:43:21 Handling report submission; listing URI will be http://localhost:9110/api/listing/2022-10-14/144321-TUHJVFL8
Oct 14 16:43:21 matrix-rageshake[10585]: 2022/10/14 14:43:21 Error handling report submission: wrong host name

debug

Currently, we provide only smtp_server variable where we put hostname:port which is then used both during smtp.PlainAuth and smtp.Send.
It works when using port 25 but not port 587. I guess smtp.Send handle tls under the hood and that where the issue is.
Anyway, according to the doc and some tests, we should use hostname only on smtp.PlainAuth and hostname+port on smtp.Send

https://github.com/matrix-org/rageshake/blob/master/submit.go#L754
(currently) This does not work:

if s.cfg.SMTPPassword != "" || s.cfg.SMTPUsername != "" {
		auth = smtp.PlainAuth("", s.cfg.SMTPUsername, s.cfg.SMTPPassword, "example.com:587")
	}
	err := e.Send("example.com:587", auth)
	if err != nil {
		return err
	}

This should work :

if s.cfg.SMTPPassword != "" || s.cfg.SMTPUsername != "" {
		auth = smtp.PlainAuth("", s.cfg.SMTPUsername, s.cfg.SMTPPassword, "example.com")
	}
	err := e.Send("example.com:587", auth)
	if err != nil {
		return err
	}
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

1 participant