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 SMTP port #26

Closed
helmut72 opened this issue Jan 23, 2022 · 15 comments
Closed

Wrong SMTP port #26

helmut72 opened this issue Jan 23, 2022 · 15 comments
Assignees
Labels

Comments

@helmut72
Copy link

Your SMTP examples uses TCP 993 for SMTP, but this is IMAP (SSL). SMTP is TCP 25 (insecure or Start TLS), TCP 465 (SSL) or TCP 587 (insecure or Start TLS).

Please also provide informations how to configure insecure, SSL and Start TLS modes.

One example:
https://raw.githubusercontent.com/greenpau/caddy-security/main/README.md

Thank you

@greenpau
Copy link
Owner

@helmut72 , thank you for opening this issue! Currently, I implemented the storage for credentials. The SMTP is actually not yet implement. Nevertheless, this issue is timely! 👍

@helmut72
Copy link
Author

helmut72 commented Jan 23, 2022

Oh, ok. I just read the example configurations and after read TCP 993 a 2nd time I thought to create an issue ;) Now I'm glad I've never tried it ;)

@greenpau
Copy link
Owner

@helmut72 , do you happen to have SMTP server that I could use for testing?

@helmut72
Copy link
Author

I'm not allowed to share this mail server, but I can test your code against this server and give you log files from the server asap. Insecure connections are disabled from the Internet for security reasons, but I'd enable it temporary for tests in the private LAN.

For common testing you can use every mail provider like Gmail, outlook.com which supports SMTP. Nearly all supports SMTP.

@greenpau
Copy link
Owner

@helmut72 , FYI, I am splitting email provider and credentials.

Got the port right this time! 😄

@helmut72
Copy link
Author

Thank you. Will try it when it's ready to test 😊

@greenpau
Copy link
Owner

greenpau commented Feb 2, 2022

@helmut72 , I baked email notification on registrations in the changes are caddy-security v1.0.12. Please test.

Also, please see the config with registration and email provider.

https://github.com/authp/authp.github.io/blob/62d7ca642fafbb496168fd5c2ccc6ecf9bb5d392/assets/conf/local/registration/Caddyfile#L10-L22

https://github.com/authp/authp.github.io/blob/62d7ca642fafbb496168fd5c2ccc6ecf9bb5d392/assets/conf/local/registration/Caddyfile#L50-L57

The function that sends the user registration emails is here:

https://github.com/greenpau/go-authcrunch/blob/ed9e58a3cb36280d004162893b614bc02e60f1c7/pkg/messaging/email.go#L39-L111

Please let me know whether you got it working or what the challenges were/are?

@helmut72
Copy link
Author

helmut72 commented Feb 6, 2022

Sorry, busy working week... basically it works. It even use TLS 1.3, great! Some informations:

mail topics:

  • doesn't create content-type in the mail header, eg: Content-Type: text/html; charset="UTF-8";
  • mail body isn't rendered as HTML, because the mail client shows it as plaintext
  • doesn't create subject line in the mail header, but renders subject in the mail body
  • empty message-id (some spam filters rise the spam score)

registration logic:

  • login to portal (or password) doesn't work after opening registration link in the mail
  • same username can register twice (because registration never finish?)

Bildschirmfoto 2022-02-06 um 15 19 38

@helmut72
Copy link
Author

helmut72 commented Feb 6, 2022

I'm not a great coder, but regarding the subject it maybe should be:
https://github.com/greenpau/go-authcrunch/blob/ed9e58a3cb36280d004162893b614bc02e60f1c7/pkg/messaging/email.go#L89

msg += "Subject: " + subj + "\r\n" + body

@greenpau
Copy link
Owner

greenpau commented Feb 6, 2022

msg += "Subject: " + subj + "\r\n" + body

@helmut72 , thank you for testing this! 👍 I was so focused on getting the mailing part "right", that I missed rookie stuff on the payload 😄

Will release a fix shortly.

@helmut72
Copy link
Author

helmut72 commented Feb 6, 2022

My code suggestion is untested. It's just a guess after looking into your code ;)

Also, there is an empty message-id. Don't know how to enable it with the smtp lib you use.

greenpau added a commit to greenpau/go-authcrunch that referenced this issue Feb 6, 2022
@greenpau
Copy link
Owner

greenpau commented Feb 6, 2022

Also, there is an empty message-id. Don't know how to enable it with the smtp lib you use.

@helmut72 , I fixed some other stuff too, e.g. date, thread, etc. greenpau/go-authcrunch@3ffb8f2

Will release shortly.

@greenpau
Copy link
Owner

greenpau commented Feb 6, 2022

Release fix in v1.0.13.

@helmut72
Copy link
Author

helmut72 commented Feb 6, 2022

Thank you 👍 ... received mail looks good!

Still couldn't login to portal after clicking registration link. Need to look into it tomorrow after work. Maybe it's one of my setting.

@greenpau
Copy link
Owner

greenpau commented Feb 6, 2022

@helmut72 , you will not be able to login. The clicking of the link adds user to the registration. (Before there was no requirement to confirm since the email functionality was not there.)

Next step in terms of development - on a user acknowledgement, the server will send an email to an admin to approve/decline the registration.

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

No branches or pull requests

2 participants