Testing

 < Free Open Study > 



Chapter 2, "Installing qmail," covers the generation of test messages for a variety of scenarios, including injection via qmail-inject and SMTP.

A particularly powerful technique for testing network services like SMTP, POP, and IMAP is also touched upon in Chapter 2: the use of telnet to interact directly with a service. By specifying a port number on the command line, one can type protocol commands directly at a service on a local or remote host.

For example, to initiate an SMTP session with the local host, use this command:

 telnet 0 smtp 

The telnet command will look up the port number for "smtp" in /etc/services.

The host address 0 (zero) is a shortcut for the IP address 0.0.0.0, which refers to the local host, and 25 is the SMTP port number.

Note 

People often use localhost or the IP address 127.0.0.1 to refer to the local host. This will work, too, provided that the network service is configured to listen to the "loopback" interface, which is usually the case. To be on the safe side, though, use 0 (zero), which will work if the service is listening to any local interface.

The telnet command will automatically send the appropriate line breaks for the protocol, for example, translating Unix line feed (LF) newlines to SMTP carriage return-line feed (CR-LF) newlines. You will, of course, have to enter valid SMTP commands in the proper sequence.

If you just want to verify that a service is running, you can initiate a connection and break it without entering any protocol commands. For example, to verify that the SMTP service on the local host is actually running:

 $ telnet 0 25 Trying 0.0.0.0. . . Connected to 0. Escape character is '^]'. 220 dolphin.example.com ESMTP ^] telnet> quit Connection closed. $ 

The connection was established (Connected to 0.) and the SMTP greeting was displayed (220 dolphin.example.com ESMTP), so the SMTP service is active. At this point, the user breaks the connection by entering the telnet escape character (^]) by holding down the Control key, then pressing the right square bracket key and quitting.

The same technique can be used to check POP3 and IMAP services. See Chapter 10, "Serving Mailboxes," for examples.



 < Free Open Study > 



The Qmail Handbook
The qmail Handbook
ISBN: 1893115402
EAN: 2147483647
Year: 2001
Pages: 186
Authors: Dave Sill

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net