Changes

Jump to: navigation, search

OPS535-online-L5

22 bytes removed, 13:46, 9 March 2021
Investigation 1: SMTP
= Investigation 1: SMTP =
== Perform the following steps on your VM2 (pri-dns)==
:* login to your VM2 as the student user. :* Find out the version of the postfix rpm installed on the system with one of the following commands and keep a record of it.
<pre>
rpm -q postfix
yum info postifx
</pre>
:* SMTP servers use one of the well-known ports, you can find out the port number used by the smtp protocol with the following command:
<pre>
grep -w smtp /etc/services
</pre>
:* Make sure that the postfix.service is running on VM2, if not, start the postfix.service and confirm that it is running properly.:* Beside the systemctl command, there are two more places (or commands) you can use to confirm whether there is a SMTP server running on your system: the "ss -at" and "ps -ef" command::* Try the following command pipe line and look for the SMTP port number under the "Local Address" column and record the line(s) for future reference.
<pre>
ss -at | grep smtp
ss -atn | grep [smtp port number]
</pre>
:* Note that if the Local Address shown is 127.0.0.1 only, your SMTP server will not be reachable by other machines.:* Run the following command pipe line and study the output carefully:
<pre>
[instructor@pri-dns ~]$ ps -ef | grep -v grep | grep postfix
postfix 122216 122055 0 20:33 ? 00:00:00 pickup -l -t unix -u
</pre>
:* Look up the man page for "qmgr", "tlsmgr", and "pickup", and find out the purpose of those processes.
== The SMTP Protocol: clear text commands/responses ==
:* As a regular user on VM2, execute the commands given in the "Command" column and record the output in the corresponding "Response" column for future reference. Do not proceed if the first command does not establish a connection to the SMTP port on the local host.
{| class="wikitable" cellspacing="0" width="90%" cellpadding="5" border="1" style="text-align: left; vertical-align: top; background: #3333ff; border-spacing: 2px; border: 1px solid darkgray"
|+ SMTP command / Response
== postfix main configuration file: /etc/postfix/main.cf ==
:* Login to your VM1, and run the following nc command to try to connect to the SMTP server on your VM2:
<pre>
nc 192.168.x.2 25 (replace x with your network number)
</pre>
:* You may get one of the following responses:
<pre>
[instructor@router ~]$ nc 192.168.2.2 25
Ncat: Connection refused.
</pre>
:* The 1st problem is due to the firewalld configuration on your VM2. You need to enable the smtp service.:* The 2nd problem is due to the configuration of postfix, its default configuration is just bind to the loop back interface.:* Switch back to VM2, backup the file /etc/postfix/main.cf to /etc/postfix/main.cf.org as root or by sudo.:* Study the contents of the file /etc/postfix/main.cf. (Look for the parameters you learned about in OPS335):* Edit the file "/etc/postfix/main.cf" with the following changes:
<pre>
comment out the line "inet_interfaces = localhost"
uncomment the line "inet_interfaces = all"
</pre>
:* Save the changes, and run the "diff" command on /etc/postfix/main.cf and /etc/postfix/main.cf.org and make sure you get something similar to the following:
<pre>
[instructor@pri-dns ~]$ diff /etc/postfix/main.cf.org /etc/postfix/main.cf
> #inet_interfaces = localhost
</pre>
:* 132c132 means line 132 in /etc/postfix/main.cf.org has been changed to line 132 in /etc/postfix/main.cf and 135c135 means similarly.:* Restart "postfix" service on VM2.:* Check to confirm that postfix is listening on smtp port on all network interface (i.e. with local address 0.0.0.0):
<pre>
[instructor@pri-dns ~]$ ss -at
</pre>
:* Switch to VM1, and login as a regular user. Execute the commands given in the "Command" column and record the output in the corresponding "Response" column for future reference. Do not proceed if the first command does not establish a connection to the SMTP port on the VM2, replace the place holder [VM2-IP-ADDR] with your VM2's actual IP address.
{| class="wikitable" cellspacing="0" width="90%" cellpadding="5" border="1" style="text-align: left; vertical-align: top; border-spacing: 2px; border: 1px solid darkgray"
|+ SMTP command / Response
1,760
edits

Navigation menu