Service Testing

Here’s a collection of services, and ways to go about testing them:

25: SMTP

Simple Mail Transfer Protocol.

Test with telnet:

$ telnet simpleigh.com 25
Trying 46.137.167.228...
Connected to simpleigh.com.
Escape character is '^]'.
220 aws.simpleigh.com ESMTP Postfix (Ubuntu)

Check it responds:

$ EHLO example.com
250-aws.simpleigh.com
250-PIPELINING
250-SIZE 20480000
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

Try sending a message to a local user:

$ MAIL FROM: <nobody@example.com>
250 2.1.0 Ok
$ RCPT TO: <blog@simpleigh.com>
250 2.1.5 Ok
$ DATA
354 End data with <CR><LF>.<CR><LF>
$ Email body goes here
$ 
$ .
$ 
250 2.0.0 Ok: queued as 18E73288

Try logging in:

$ AUTH LOGIN
334 VXNlcm5hbWU6
$ [ base64-encoded username ]
334 UGFzc3dvcmQ6
$ [ base64-encoded password ]
235 2.7.0 Authentication successful

Exit:

$ QUIT
221 2.0.0 Bye
Connection closed by foreign host.

You can test STARTTLS (where a secure channel is negotiated for an existing connection) functionality using OpenSSL‘s s_client:

$ openssl s_client -connect simpleigh.com:25 -crlf -starttls smtp
... loads of stuff
250 DSN
$ EHLO ...

80: HTTP

Hypertext Transfer Protocol.

Test with telnet:

$ telnet simpleigh.com 80
Trying 46.137.167.228...
Connected to simpleigh.com.
Escape character is '^]'.
$ GET / HTTP/1.1
$ Host: simpleigh.com
$ 
HTTP/1.1 301 Moved Permanently
Date: Sun, 11 Aug 2013 19:54:30 GMT
Server: Apache
Location: http://www.simpleigh.com/
Vary: Accept-Encoding
Content-Length: 233
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://www.simpleigh.com/">here</a>.</p>
</body></html>
Connection closed by foreign host.

110: POP3

Post Office Protocol.

Test with telnet:

$ telnet simpleigh.com 143
Trying 46.137.167.228...
Connected to simpleigh.com.
Escape character is '^]'.
+OK Dovecot ready.

Try logging in:

$ USER [ username ]
+OK
$ PASS [ password ]
+OK Logged in.

List messages:

$ LIST
+OK 20 messages:
... loads of stuff

Exit:

$ QUIT
DONE

143: IMAP

Internet Message Access Protocol.

Test with telnet:

$ telnet simpleigh.com 143
Trying 46.137.167.228...
Connected to simpleigh.com.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN AUTH=LOGIN] Dovecot ready.

Try logging in:

$ a1 LOGIN [ username ] [ password ]
a1 OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS] Logged in

List folders:

$ a2 LIST "" "*"
... loads of stuff

Find out what’s in the Inbox:

$ a3 EXAMINE INBOX
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
* OK [PERMANENTFLAGS ()] Read-only mailbox.
* 20 EXISTS
* 1 RECENT
* OK [UNSEEN 10] First unseen.
* OK [UIDVALIDITY 1345668496] UIDs valid
* OK [UIDNEXT 2543] Predicted next UID
* OK [HIGHESTMODSEQ 1] Highest
a3 OK [READ-ONLY] Select completed.

Exit:

$ a5 LOGOUT
* BYE Logging out
a5 OK Logout completed.
closed

443: HTTPS

Just like HTTP, but use s_client:

$ openssl s_client -connect simpleigh.com:443
... loads of stuff

465: SMTPS

Check using s_client:

$ openssl s_client -connect simpleigh.com:465 -crlf
... loads of stuff
220 aws.simpleigh.com ESMTP Postfix (Ubuntu)

993: IMAPS

Check using s_client:

$ openssl s_client -connect simpleigh.com:993
... loads of stuff
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN AUTH=LOGIN] Dovecot ready.

995: POP3S

Check using s_client:

$ openssl s_client -connect simpleigh.com:995
... loads of stuff
+OK Dovecot ready.

Summary

Almost everything can be driven via Telnet. If you need TLS, use s_client.

There’s a really handy OpenSSL command-line summary at http://www.madboa.com/geek/openssl/.

This entry was posted in Computing. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*
*