Testing a Postfix Configuration

From Zanecorpwiki

Jump to: navigation, search

Contents

Manually Testing Connection

Testing (like this) can (as far as I've found) only be done with non-TLS setups. There's something about the postfix connection that doesn't play nice with 'openssl s_client'. AFAIK, the only way to test a TLS setup is to use a mail agent like Thunderbird.

Example One

To test the server side, connect (for example, with telnet) to the Postfix SMTP server port and you should be able to have a conversation as shown below. Information sent by the client (that is, you) is shown in bold font.

   $ telnet server.example.com 25
   . . .
   220 server.example.com ESMTP Postfix
   EHLO client.example.com
   250-server.example.com
   250-PIPELINING
   250-SIZE 10240000
   250-ETRN
   250-AUTH DIGEST-MD5 PLAIN CRAM-MD5
   250 8BITMIME
   AUTH PLAIN XXXXXXXXXXXXXXXX
   235 Authentication successful

Instead of XXXXXXXXXXXXXXXX, specify the base64 encoded form of \0username\0password (the \0 is a null byte). The example above is for a user named `test' with password `testpass'.

In order to generate base64 encoded authentication information you can use one of the following commands:

   % printf '\0username\0password' | mmencode 
   % perl -MMIME::Base64 -e \
       'print encode_base64(\0username\0password);'

Example Two

 telnet localhost 25
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 something.fake ESMTP Sendmail 8.12.11/8.12.11/SuSE Linux 0.6; Wed, 2 Apr 2003 15:13:01 -0700
EHLO localhost
250-something.fake Hello localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH LOGIN PLAIN
250-DELIVERBY
250 HELP
AUTH LOGIN
334 xxxxxxxx
xxxxxxxx
334 xxxxxxxx
xxxxxxxx
235 2.0.0 OK Authenticated
MAIL FROM: me@something.fake
250 2.1.0 me@something.fake... Sender ok
RCPT TO: you@nowhere.land 
250 2.1.5 you@nowhere.land... Recipient ok
DATA
354 Enter mail, end with . on a line by itself
This is a test
.
250 2.0.0 xxxxxxxx Message accepted for delivery
QUIT
221 2.0.0 something.fake closing connection
Connection closed by foreign host.

Testing for Open Relay

 telnet mail.foo.com 25
Trying 255.255.255.255...
Connected to mail.foo.com.
Escape character is '^]'.
220 mail.foo.com ESMTP Postfix
HELO foo.com
250 mail.foo.com
MAIL FROM:zane@foo.com
250 2.1.0 Ok
RCPT TO:atestaddress@yahoo.com
554 5.7.1 atestaddress@yahoo.com: Relay access denied

Good!

Personal tools