
Sendmail Lab – Part 1 The sendmail program was originally written by Eric Allman while he was a student and staff member at the University of California at Berkeley. The sendmail program plays a variety of roles: • Listens to the network for incoming mail, • Transports mail messages to other machines • Hands local mail over to a local program for delivery • Appends mail to files, Pipes mail through other programs, • Queues mail for later delivery • Understands the aliasing of one recipient name to another Objectives: (1) Study the default SENDMAIL configuration file supplied with your Linux distribution. (2) Use SENDMAIL to send electronic messages to local users, and files. (3) Explore and manage SENDMAIL's mail queue. Prerequisite: Complete STMP Lab. You should do this lab on the same machine as you did your SMTP lab. Reference: Distribution Documents CentOS 5.x /usr/share/sendmail-cf/README IMPORTANT: Some of the commands in this lab must be execute as “root”. Please login as a regular user and “su -” to root when necessary. 1. Version Information: Program/Package Name Version GNU/Linux Distribution CentOS 5.x / RHEL 5.x sendmail rpm sendmail-cf rpm sendmail-doc rpm sendmail-devel rpm 2. The name of the sendmail configuration file is called “sendmail.cf”. Use the “rpm -ql” command to determine which of the above four packages contains the file and find out its path. (hint: rpm -ql [package name] | grep sendmail.cf) Path: ______________________ Package: _____________________ OPS535 Lab – Sendmail Part 1 November 2009 Page 1 of 6 3. Change to sendmail.cf's directory, execute the following command and record the output: grep AliasFile sendmail.cf Output:________________________________ 4. The output from step 3 indicates which file will be used as the mail aliases file. According to RFC822, all user names are case-sensitive except the name “postmaster”. But sendmail, when processing its aliases file, views all names as case-insensitive. Substitute the word “AliasFile” by the actual file name of the aliases file and execute the following command. Record the output. grep ops535 AliasFile Alias Name Aliase List ops535 postmaster smtp-lab Execute the following commands and answer questions (a) and (b): /usr/sbin/sendmail -v -bv postmaster /usr/sbin/sendmail -v -bv smtp-lab (a) If a message is addressed to “postmaster”, who will actually receive the message? _________________________________________________________________ (b) If a message is addressed to “smtp-lab”, who will actually receive the message? _________________________________________________________________ 5. Study the sendmail aliases file in your system. If you want all the messages addressed to “postman” in you machine to go into your mail box ( you will get those mails when you login to the system using your own login account), add the following line to the alias file: postman: your_user_name Sendmail does not read the aliases file directly, instead, it reads the dbm version of the aliases file called “aliases.db”. Execute the command “newaliases” to update the aliases database file. Run the “newaliases” command and record the output. ________________________________________________________________ 6. To verify that the alias for “postman” works as expected, create a file called “mail.txt” and execute the following command: /usr/sbin/sendmail -v postman < mail.txt OPS535 Lab – Sendmail Part 1 November 2009 Page 2 of 6 Can you access the mail message for “postman” under your user account? ________________________________________________________________ 7. Add the following line to your sendmail aliases file: ops535: /tmp/ops535.mail Use vi to create a new file called “test.mesg” in your home directory with the following contents: Every aliases file must have an alias for postmaster that will expand to the name of a real user. Mail problems encounter by the mail- daemon is always sent to postmaster. Save both files and execute the “newaliases” and the sendmail command: /usr/sbin/sendmail v ops535 < /tmp/test.mesg Record the output of the above command (use the back of this page if you need more space). _________________________________________________________________ _________________________________________________________________ 8. Check the /tmp directory for the file “ops535.mail” and determine the following: (a) Who is the owner of the file /tmp/ops535.mail? ___________________________ (b) Who has read permission on that file? __________________________________ (c) What is the “Return Path” indicated in the message header? _________________ (d) What is the “Message ID”?___________________________________________ 9. Edit your sendmail aliases file and add your login name to the “postmaster” aliases list. After you save the change to your sendmail aliases file, issue the following command: /usr/lib/sendmail bi and record the output. __________________________________________________________________ Which command has the same function as the command “/usr/lib/sendmail -bi”? __________________________________________________________________ Issue the following command to determine who will received messages send to postmaster. __________________________________________________________________ 10. Send a test message to the user “postmaster” with the following command: /usr/sbin/sendmail v postmaster < /tmp/test.mesg OPS535 Lab – Sendmail Part 1 November 2009 Page 3 of 6 Record the last 10 lines from the above command. _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ ____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ 11. Login to another virtual terminal with your login account name. Is there any new mail for you? What is the message ID of the email? __________________________________________________________________ Sendmail's mail queue 12. Change to sendmail's configuration directory and execute the following command and record the output: grep QueueDirectory sendmail.cf __________________________________________________________________ Enter the command “mailq” and “mailq -Ac” as root and record the outputs: __________________________________________________________________ __________________________________________________________________ 13. The output of the above command indicates the directory used by sendmail to store outgoing messages that need to be transferred later. Does regular user has access to this directory? Directory name:_____________________________________________________ Directory Permission: ________________________________________________ 14. In general, sendmail does not deliver messages directly to local user's mail box. Sendmail calls other programs (mailers) to perform local delivery. To find out the name of the local delivery agent(s) known by sendmail, try the following command: grep ^Mlocal sendmail.cf According to the output from the above command, Name of local delivery agent : ____________________________________ 15. Make sure that your machine CAN NOT reach out to Internet. Issue the following command (as root) and record the output: OPS535 Lab – Sendmail Part 1 November 2009 Page 4 of 6 /usr/sbin/sendmail bv [email protected] ____________________________________________________________________ ____________________________________________________________________ Is the above email address deliverable by your “sendmail”? ____________________________________________________________________ If your sendmail can handle the above email address, issue the following command and record the output: /usr/sbin/sendmail v [email protected] < /tmp/test.mesg ___________________________________________________________________ ___________________________________________________________________ ___________________________________________________________________ ___________________________________________________________________ ___________________________________________________________________ ___________________________________________________________________ 16. Issue the command “mailq Acand mailq and record the entire output. ___________________________________________________________________ ___________________________________________________________________ ___________________________________________________________________ ___________________________________________________________________ ___________________________________________________________________ ___________________________________________________________________ What is the name of the queue directory? _____________________________ How many queue directories are there? _______________________________ If there are messages in the queue, determine the following information for the 1st message on the output list: Q-ID (message id): ______________________ Size: ________________ Queue Time: _____________________________________________ Sender/Recipient:__________________________________________ OPS535 Lab – Sendmail Part 1 November 2009 Page 5 of 6 17. Issue the command /usr/sbin/sendmail
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages6 Page
-
File Size-