1 SMTP Transport Configuration SMTP Configurations and Virtual Servers Customizing the SMTP Service.
SMTP-Lab
Transcript of SMTP-Lab
![Page 1: SMTP-Lab](https://reader035.fdocuments.net/reader035/viewer/2022081811/53f9a96cdab5cad23a8b4a75/html5/thumbnails/1.jpg)
OPS535 – Advanced Network Administration
SMTP LabReference: RFC821 – Simple Mail Transfer Protocol
SIMPLE MAIL TRANSFER PROTOCOL
1. INTRODUCTION
The objective of Simple Mail Transfer Protocol (SMTP) is to transfer mail reliably and efficiently.
SMTP is independent of the particular transmission subsystem and requires only a reliable ordered data stream channel. Appendices A, B, C, and D describe the use of SMTP with various transport services. A Glossary provides the definitions of terms as used in this document.
An important feature of SMTP is its capability to relay mail across transport service environments. A transport service provides an interprocess communication environment (IPCE). An IPCE may cover one network, several networks, or a subset of a network. It is important to realize that transport systems (or IPCEs) are not one-to-one with networks. A process can communicate directly with another process through any mutually known IPCE. Mail is an application or use of interprocess communication. Mail can be communicated between processes in different IPCEs by relaying through a process connected to two (or more) IPCEs. More specifically, mail can be relayed between hosts on different transport systems by a host on both transport systems.
- RFC821
Objective: Explore the command/response transaction of the Simple Mail Transfer Protocol
This lab consists of THREE parts. We will first check the version of the SMTP server and make sure that the SMTP port is on. Secondly, we will establish an interactive SMTP session with the local SMTP server and study some of the major SMTP commands. Lastly, we will use the interactive SMTP session to send email to users and mailing list on the local machine.
© [email protected] Last Updated: March 2011 OPS535Page 1 of 7
![Page 2: SMTP-Lab](https://reader035.fdocuments.net/reader035/viewer/2022081811/53f9a96cdab5cad23a8b4a75/html5/thumbnails/2.jpg)
OPS535 – Advanced Network Administration
Part I: SMTP Server
(1) Login to your NIS server (VM3) as a regular user. The default SMTP server installed on a CentOS/RHEL is sendmail. Find out which version of the sendmail rpm is installed on the system.
Command: rpm -q sendmail
Sendmail Version: _______________________________________________________
(2) SMTP server uses one of the well-known ports. You can find out the port number used by smtp with the following command:
Command: grep -w smtp /etc/services
Output: ________________________________________________________________
The port number used by SMTP is ________
(3) There are two places (or commands) you can check to see whether there is a SMTP server running on your system. The 1st one is the output of the “netstat -a” command. Look for the SMTP port number under the “Local Address” column and record the line(s) that contain the SMTP port :
(a) Command: netstat -a | grep smtpOutput:
________________________________________________________________________(b) Command: netstat -an | grep [smtp port number] (use the actual port #)Output:
________________________________________________________________________
(4) The other place is the output of the “ps -ef | grep -v grep | grep sendmail” command. Command: ps -ef | grep -v grep | grep sendmail Output:
________________________________________________________________________
_________________________________________________________________________(Note: You need a different command if the system is running other SMTP server.)
© [email protected] Last Updated: March 2011 OPS535Page 2 of 7
![Page 3: SMTP-Lab](https://reader035.fdocuments.net/reader035/viewer/2022081811/53f9a96cdab5cad23a8b4a75/html5/thumbnails/3.jpg)
OPS535 – Advanced Network Administration
Part II: SMTP commands(5) Login to your NIS server (VM3) as a regular user and execute the commands given in the “Command” column and record the output in the corresponding “Response” column. Do not proceed if the first command does not establish a connection to the SMPT port on the local host.
Command Response
telnet localhost smtp Trying 127.0.0.1...Connected to localhost.localdomain (127.0.0.1).Escape character is '^]'.220 localhost.localdomain ESMTP ...
HELO domain.com
EHLO domain.com
NOOP
RSET
VERB
EXPN ops535m
VRFY toronto
VRFY nobody
HELP
QUIT
(6) “su” to “root” and backup the file “/etc/mail/sendmail.cf” to “/etc/mail/sendmail.cf.org”.
(7) While you are still “su” to “root”, edit the file “/etc/mail/sendmail.cf”, change the line:
O PrivacyOptions=authwarnings,novrfy,noexpn,restrictqrun to:
O PrivacyOptions=authwarnings,restrictqrun
(8) Save the changes and restart “sendmail” server.Command: service sendmail restart
Type exit to exit from the root shell.
© [email protected] Last Updated: March 2011 OPS535Page 3 of 7
![Page 4: SMTP-Lab](https://reader035.fdocuments.net/reader035/viewer/2022081811/53f9a96cdab5cad23a8b4a75/html5/thumbnails/4.jpg)
OPS535 – Advanced Network Administration
(9) Execute the commands in the “Command” column and record the output in the “Response” column as a regular user.
Command Response
telnet localhost smtp
HELO domain.com
EXPN ops535m
VRFY toronto
VRFY postmaster
EXPN postmaster
VRFY mailer-daemon
EXPN mailer-daemon
VRFY manager
VRFY somebody
QUIT
(10) “su” to “root”, backup the file “/etc/aliases” to “/etc/aliases.org” and execute the following commands:
# echo “ops535m: adm,uucp,ftp” >> /etc/aliases# newaliases
(11) Record the output of the above commands:
___________________________________________________________________________
© [email protected] Last Updated: March 2011 OPS535Page 4 of 7
![Page 5: SMTP-Lab](https://reader035.fdocuments.net/reader035/viewer/2022081811/53f9a96cdab5cad23a8b4a75/html5/thumbnails/5.jpg)
OPS535 – Advanced Network Administration
(12) Login as a regular user and execute the command in the “Command” column and record the output in the “Response” column.
Command Response
telnet localhost 25 Trying 127.0.0.1...Connected to localhost.localdomain (127.0.0.1).Escape character is '^]'.220 localhost.localdomain ESMTP Sendmail ...
HELO domain.com
EXPN ops535m(may take a while to produce the output)
VRFY ops535m(may take a while to product the output)
QUIT
(13) In the NIS Lab, you were ask to create user nis101and nis102. Look up the login name from your /etc/passwd file and record them in the following table:
Login Name UID User Name(The 5th field of a /etc/passwd record)
User 1 nis101
User 2 nis102If the 5th field for nis101 is empty, use the command “chfn nis101” to set the Name[] field to “Alice”.Do the same for nis102 and set it to “Bob” (14) “su” to “root” and execute the following commands:
# echo “smtp-lab: nis101,nis102” >> /etc/aliases# newaliases
(15) Login as a regular user and execute the commands in the “Command” column and record the output in the “Response” column.
Command Response
telnet localhost 25 Trying 127.0.0.1...Connected to localhost.localdomain (127.0.0.1).Escape character is '^]'.220 localhost.localdomain ESMTP Sendmail ...
HELO domain.com
EXPN smtp-lab(may take a while to produce the output)
© [email protected] Last Updated: March 2011 OPS535Page 5 of 7
![Page 6: SMTP-Lab](https://reader035.fdocuments.net/reader035/viewer/2022081811/53f9a96cdab5cad23a8b4a75/html5/thumbnails/6.jpg)
OPS535 – Advanced Network Administration
Command Response
VRFY smtp-lab(may take a while to produce the output)
QUIT
(16) Compare the results from step 5, 9, 12 and 15 for the “EXPN” and “VRFY” commands and comment on the results.
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
Question 1: How do you enable the EXPN and VRFY command in Sendmail?
Question 2: How do you add a mailing list called “helpdesk” on your NIS server so that all email send to the “helpdesk”mail list will be forwarded to user nis102?
Question 3: Would you be able to telnet from your other virtual machines to the SMPT port on your NIS server and repeat the task in step (9)? If not, what need to be changed on your NIS server to allow other machines to connect to the SMTP server on your NIS server?
© [email protected] Last Updated: March 2011 OPS535Page 6 of 7
![Page 7: SMTP-Lab](https://reader035.fdocuments.net/reader035/viewer/2022081811/53f9a96cdab5cad23a8b4a75/html5/thumbnails/7.jpg)
OPS535 – Advanced Network Administration
Part III – Sending emails using the SMTP commands
(17) Login as a a regular user and connect to the local SMTP server. Use the information in the following table to send email to nis101, nis102, postmaster, ftp, ops535m and smtp-lab.
From To Message Final Destination of the Message
ws.podx.ca nis101 Message for nis101 Test message 1.
ws.podx.ca nis102 Message for nis102 Test message 2.
ws.podx.ca smtp-lab Message for smtp-labTest message 4
ws.podx.net postmaster Message for postmasterTest message 5
ws.podx.net ftp Message for ftpTest message 6
ws.podx.net ops535m Message for ops535mTest message 7
(18) Login as user1, and user2 and check out what messages they received:
User Login_name Message received
User 1 nis101
User 2 nis102
Question 4: Who will actually receive the email for “Test message 5”?
Question 5: Who will actually receive the email for “Test message 6”?
Question 6: Who will actually receive the email for “Test message 7”?
Completing the Lab
Upload your answers to questions 1 to 6 to MySeneca by the due date.
© [email protected] Last Updated: March 2011 OPS535Page 7 of 7