Open main menu

CDOT Wiki β

Changes

OPS535-online-L5

1,971 bytes added, 23:37, 8 March 2021
Investigation 1: SMTP
:* 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:
:** Run 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. Note that if the Local Address shown is 127.0.0.1 only, your SMTP server will not be reachable by other machines.
<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 responsibility purpose of those processes.
== Review the 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; border-spacing: 2px; border: 1px solid darkgray"
|<br>
|}
# == 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 25Ncat: No route to host.</pre>or<pre>[instructor@router ~]$ nc 192.168.2.2 25Ncat: Connection refused.</pre>:* The 1st problem is due to the firewalld configuration on your VM2. You need to enable the smtp commandsservice.:* 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/responsespostfix/main.cf.org as root or by sudo.# :* Study the contents of the file /etc/postfix /main configuration .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":* 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.cf132c132< #inet_interfaces = all---> inet_interfaces = all135c135< inet_interfaces = localhost---> #inet_interfaces = localhost: * 132c132 means line 132 in /etc/postfix/main.cf.org has been changed to line 132 in /etc/postfix/main.cfand 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 -atState Recv-Q Send-Q Local Address:Port Peer Address:Port...LISTEN 0 100 0.0.0.0:smtp 0.0.0.0:*...LISTEN 0 100 [::]:smtp [::]:*...</pre>   
# start/stop postfix
# mailing list
1,760
edits