Index

7.3 Configure Mail Server

8.1 Create Web Server virtual machine


7.4 Configure Firewall for Mail service


• Make sure that the "Firewall" virtual machine is running (see 4.2 Startup Firewall virtual machine)




Now you could log in directly in the virtual machine as user root, but connecting through SSH from your host PC, makes it possible to copy and paste text into the console window


• Open "Command Prompt" on your host computer




Write what is highlighted in red


Instead of writing "teddy", then write the username you have created on the master virtual machine:

C:\Users\teddy>ssh teddy@192.168.0.254

teddy@192.168.0.254's password:write your user's password here

Last login: Wed Jan 1 12:05:00 2020 from 192.168.0.192


[teddy@firewall ~]$ su

Password:write the root password here


Edit the firewall bash file:

[root@firewall teddy]# cd /var/firewall

[root@firewall firewall]# vim firewall.sh


Add these lines to the end of the document:

# Open ports for the mail services in the dmz zone

firewall-cmd -–zone=dmz -–add-service=smtp

firewall-cmd -–zone=dmz --add-service=imap

firewall-cmd -–zone=dmz --add-service=pop3

# Forward mail traffic from the external zone to the DNS server

firewall-cmd --zone=external --add-forward-port=port=25:proto=udp:toport=25:toaddr=192.168.255.4

firewall-cmd --zone=external --add-forward-port=port=110:proto=udp:toport=110:toaddr=192.168.255.4

firewall-cmd --zone=external --add-forward-port=port=143:proto=udp:toport=143:toaddr=192.168.255.4

firewall-cmd --zone=external --add-forward-port=port=465:proto=udp:toport=465:toaddr=192.168.255.4

firewall-cmd --zone=external --add-forward-port=port=587:proto=udp:toport=587:toaddr=192.168.255.4

firewall-cmd --zone=external --add-forward-port=port=993:proto=udp:toport=993:toaddr=192.168.255.4

firewall-cmd --zone=external --add-forward-port=port=995:proto=udp:toport=995:toaddr=192.168.255.4

# Forward SSH traffic from the external zone to the DHCP server using a dedicated port

firewall-cmd --zone=external --add-forward-port=port=22004:proto=tcp:toport=22:toaddr=192.168.255.4


Save the document and quit vim


Shutdown the system, and exit "Command Prompt":

[root@firewall firewall]# shutdown -h now

Connection to 192.168.0.254 closed by remote host.

Connection to 192.168.0.254 closed.


C:\Users\teddy>exit


Return to the "Firewall" virtual machine



Click "X" to close the virtual machine