[SOLVED] WEB375 LAB 3 CONFIGURE A SENDMAIL SERVER IN LINUX: The purpose of this lab is to configure a sendmail server in Linux. Use the IP addresses that exist when you start Linux.
Virtual Machine Login Information for PLABFED01 and PLABFED02
Username: Student
Password: Password
Username: root
Password: Password
[SOLVED] WEB375 LAB 3 CONFIGURE A SENDMAIL SERVER IN LINUX: Lab Diagram
During your session, you will have access to the following lab configuration.
WINCONSOLE PLABFED01 PLABFED02
The Linux servers also connect to a private network. The IP address of PLABFED01 is 192.168.240.11 and the IP address of PLABFED01 is 192.168.240.12.
[SOLVED] WEB375 LAB 3 CONFIGURE A SENDMAIL SERVER IN LINUX: Connecting to Your Lab
In this module, you will be working on the following equipment to carry out the steps defined in each exercise.
Each exercise will detail which console you are required to work on to carry out the steps.
To start, simply click on the named server from the device list (located on the left-hand side of the screen) and click the “Power on” button from the Tools bar. In some cases, the devices may power on automatically.
During the boot-up process, an activity indicator will be displayed in the Name tab.
If the remote console is not displayed automatically in the main window (or pop-up), click the Connect icon located in the Tools bar to start your session.
If the remote console does not appear, please try the following option.
In the event this does not resolve your connectivity problems, please visit our Help and Support pages for additional resolution options.
sendmail Configuration Step by Step
General Information
We configure the sendmail server for our local LAN in this lab.
The sendmail daemon is configured from a directory of files in /etc/mail and a directory of configuration files in /usr/share/sendmail-cf. There are two basic configuration files.
The configuration file that the sendmail server program reads is /etc/mail/sendmail.cf. But to change the configuration on the mail server, we modify the /etc/mail/sendmail.mc file using a text editor such as nano or vi. There are two ways to generate the sendmail.cf file: Start or restart the sendmail program or use the m4 command.
For this lab, we are using one Linux server, plabfed01, with IP address 192.168.240.11.
[SOLVED] WEB375 LAB 3 CONFIGURE A SENDMAIL SERVER IN LINUX: TASK A—Configure sendmail Server
Step 1: Use TigerVNC to log in to the plabfed01 system, open a terminal window, and switch to root (or you can use Putty to log in plabfed01 as root). Make sure the sendmail, mailx, and m4 packages are installed. Type the following commands.
#rpm –qa sendmail *
#rpm –qa mailx
#rpm –qa m4*
If they are installed, the commands’ outputs look like this.
[SOLVED] WEB375 LAB 3 CONFIGURE A SENDMAIL SERVER IN LINUX: Step 2: If it tells you that the packages are not installed, then you need to install them; otherwise, skip Step 2.
To install sendmail on the Fedora Linux system, type the following.
#yum –y install sendmail
In order to configure sendmail, make sure to install the sendmail -cf package. To install sendmail.cf, type the following.
#yum –y install sendmail -cf
Sometime you may use the m4 macro processor to create a new /etc/mail/sendmail.cf. To install m4, type the following.
#yum –y install m4
To install a text-based utility program for sending and receiving mail, type the following.
#yum –y install mailx
To install all of the above packages, type the following.
#yum –y install sendmail sendmail -cf mailx m4
Step 3: You need to add your domain in /etc/hosts file to have sendmail configured correctly. Use nano or vi to edit the /etc/hosts file; its content should look like this.
Step 4: To make the hostname permanent, modify /etc/sysconfig/network file using nano or vi as editor. The file’s content should look like this.
Step 5: To modify the hostname for the current session using the command hostname, type the following.
#hostname plabfed01.linuxlab.org
[SOLVED] WEB375 LAB 3 CONFIGURE A SENDMAIL SERVER IN LINUX: Step 6: Use nano or vi to add your domain entry in /etc/mail/local-host-names file, which is a list of hostnames sendmail is to accept as the local host name. Your file should look like this.
Step 7: To allow sendmail to accept network connections from any host, use nano or vi to modify the /etc/mail/sendmail.mc file and add the “dnl #” in front of line number 118. The string “dnl” is used for commenting.
Before:
After:
Note: DNL stands for “delete to new line.”
[SOLVED] WEB375 LAB 3 CONFIGURE A SENDMAIL SERVER IN LINUX: Step 8: To generate a new sendmail.cf file by using m4, type the following.
#m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
Step 9: Now that we are ready to start sendmail, type the following.
#systemctl start sendmail.service
Step 10: To check sendmail status, type the following.
#systemctl status sendmail.service
An active sendmail status looks like this.
Note: If sendmail fails starting, check for errors using the command journalctl –xn, fix any typos, and restart the service with command #systemctl restart Sendmail.service until sendmail starts successfully. Below is a sample of journalctl –xn command output without any error.
Step 11: To enable the sendmail server at boot time, type the following.
#systemctl enable sendmail.service
[SOLVED] WEB375 LAB 3 CONFIGURE A SENDMAIL SERVER IN LINUX: TASK B—Validation and Testing
Step 1: Check the sendmail to listen to all interfaces at the host using this command.
#netstat –an | grep :25 | grep tcp
Below is a sample output of the netstat command.
[SOLVED] WEB375 LAB 3 CONFIGURE A SENDMAIL SERVER IN LINUX: Step 2: Create two test users for testing purposes (that will send and receive mail), use the following commands to add user accounts and to change user’s password. Use the password Password for the testuser accounts. For the next several steps, my examples use user1 and user2 accounts. In the lab, you use testuser1 and testuser2 accounts.
#useradd testuser1
#useradd testuser2
#passwd testuser1
#passwd testuser2
Below are examples; I used user1 and user2 accounts (yours are a little bit different).
[SOLVED] WEB375 LAB 3 CONFIGURE A SENDMAIL SERVER IN LINUX: Step 3: Log in as the testuser1 and try to send mail using the mail command (tou can switch from root to testuser1).
Here are some examples.
Note:
Step 4: To see whether the mail was sent correctly, use journalctl –xn to display messages.
Step 5: To check whether mail is delivered to testuser2, log in as the testuser2 and try to read mail using the mail command (again, you can switch from root to testuser2).
For example, see below.
Note:
[SOLVED] WEB375 LAB 3 CONFIGURE A SENDMAIL SERVER IN LINUX: TASK C—Lab Report Preparation
Step 1: Be sure you’re in the root account. Clear the screen, type the command #cat /etc/hosts to display its contents, and capture the Linux desktop, then save this image to your Lab Report document in the space allocated for the /etc/hosts file.
Step 2: Be sure you’re in the root account. Clear the screen and type the command #systemctl status sendmail.service to display the sendmail daemon status and capture the Linux desktop, then save this image to your Lab Report document in the space allocated for the #systemctl status sendmail.service command.
Step 3: Be sure you’re in the root account. Clear the screen and use the command #tail -4 /etc/passwd file to display its last four lines and capture the Linux desktop, then save this image to your Lab Report document in the space allocated for the #tail -4 /etc/passwd command.
Step 4: Switch to testuser1. Use the mail command to send the message “Hello!!! My name is ‘your first name’” (include your real first name) to testuser2. Capture the Linux desktop and save this image to your Lab Report document in the space allocated for sending mail to testuser2.
Step 5: Switch to testuser2. Use the mail command to read the message from testuser1. Capture the Linux desktop and save this image to your Lab Report document in the space allocated for read mail from testuser1