Testing external emails are being sent after SMTP authentication
Home > CentOS > CentOS 6.x > Zimbra server configuration > Prevent spam problem with Zimbra server > Testing external emails are being sent after SMTP authentication
To perform this test use any public machine such as AWS VM or other ISP connection. This would ensure that mail server treats the test machine as a random external machine and not a trusted machine. From such machine use following steps:
- Setup stunnel to connect to <mail-server-public-ip>:465 whenever someone connects to current machine on port 2525 (Ports other than 2525 can also be used as client port)
- For help with stunnel refer stunnel and specially Using encrypted channels to communicate with squid proxy server. Note that on Ubuntu newest stunnel binary is installed with name stunnel4 and there might be an older binary with name stunnel. In such cases use command stunnel4 for things to work. Use additional configuration 'verify=0' in case current configuration tries to verify server certificate through a CA / Trust-chain
- Use "netstat -alnp | grep 2525" to verify that stunnel is listening on local chosen port
- telnet <local machine> 2525
- If this fails then stunnel configuration has some issue or mail server is not accepting connections on SMTPS port
- Enter "EHLO testing" after mail server greeting. Mail server response should indicate "AUTH PLAIN" as one of the possible options for proceeding.
- Then on a separate terminal prepare base64 authentication line using:
- perl -MMIME::Base64 -e 'print encode_base64("\000saurabh\@example.com\000not.my.real.password")'
-
- It would be good if password is very simple alphanumeric password so that perl escaping of special characters in passwords is not required.
- Copy the printed password in previous step and enter
- AUTH PLAIN <base64 password output>
- If server responds with message other then "Authentication successful" then solve authentication problem before proceeding further.
- Then enter following lines into telnet prompt for sending email one line at a time. After each line mail server should respond that things are fine.
- MAIL FROM: <user>@<our-domain.com>
- RCPT TO: <user>@<some-other-domain.com>
- DATA
- Subject: This is a test email from company user to someone outside company
- #Intentional blank line. Thus after typing Subject: line press enter twice
- This is test email
- . #A single dot on line to terminate mail
- QUIT #To close telnet session / TCP connection
-
- A message that 'message has been accepted for delivery' should be received.
If this does not works then mail server being tested is not allowing users to send emails to external domains after authentication. Note that mail server might have been configured to ensure that users can send email only with their own email ID. Thus in this test if you have authentication with user 'saurabh' then try to send email with 'saurabh@<company-domain>.com' as from address.
Note that this step just checks firewall configuration, email server configuration to send emails to external domain, etc. For proper working of emails DNS MX, A records should also be set properly which we have not verified here.
Some steps learned from https://qmail.jms1.net/test-auth.shtml
Home > CentOS > CentOS 6.x > Zimbra server configuration > Prevent spam problem with Zimbra server > Testing external emails are being sent after SMTP authentication