For When You Can't Have The Real Thing
[ start | index | login ]
start > CentOS > 7 > Test SMTP-AUTH using Telnet

Test SMTP-AUTH using Telnet

Created by dave. Last edited by dave, 2 years and 51 days ago. Viewed 2,875 times. #3
[diff] [history] [edit] [rdf]
labels
attachments
(2017-05-04)

Problem

Test SMTP AUTH configuration

SMTP-AUTH Configuration Notes

  • yum -y install cyrus-sasl-plain
  • systemctl enable saslauthd
  • systemctl start saslauthd
  • in sendmail.mc:
define(`confAUTH_OPTIONS', `A')dnl
TRUST_AUTH_MECH(`LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `LOGIN PLAIN')dnl

Solution

Get the base64 encodings of your username and password:

$ perl -MMIME::Base64 -e 'print encode_base64("username");'
% perl -MMIME::Base64 -e 'print encode_base64("password");'

Telnet to the mail server, probably on port 587, and have a conversation like this:

220 smtp2.mailserver.local ESMTP Sendmail 8.14.7/8.14.7; Thu, 4 May 2017 14:51:27 -0400
ehlo mailserver.local
250-smtp2.mailserver.local Hello gateway [10.10.1.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-AUTH LOGIN PLAIN
250-STARTTLS
250-DELIVERBY
250 HELP
auth login
334 VXNlcm5hbWU6
dXNlcm5hbWU=
334 UGFzc3dvcmQ6
cGFzc3dvcmQ=
235 2.0.0 OK Authenticated
mail from: dave@mailserver.local
250 2.1.0 dave@mailserver.local… Sender ok
rcpt to: dave@xdroop.com
250 2.1.5 dave@xdroop.com… Recipient ok
data
354 Enter mail, end with "." on a line by itself
Hello dave, I like fish.
.
250 2.0.0 v44IpRGL003654 Message accepted for delivery

Notes:

  • the first 334 response is a Base64 prompt for your username; reply with your Base64 encoded username.
  • the second 334 response is a Base64 prompt for your password; reply with your Base64 encoded password.

Incidentally

You can decrypt the username/passwords using:

$ perl -MMIME::Base64 -e 'print decode_base64("dXNlcm5hbWU=");'
no comments | post comment
This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.

Useful:


snipsnap.org | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt