UFW 设置教程

2020-01-08  本文已影响0人  时见疏星

https://www.digitalocean.com/community/tutorials/ufw-essentials-common-firewall-rules-and-commands

Service: Mail
Mail servers, such as Sendmail and Postfix, listen on a variety of ports depending on the protocols being used for mail delivery. If you are running a mail server, determine which protocols you are using and allow the appropriate types of traffic. We will also show you how to create a rule to block outgoing SMTP mail.

Block Outgoing SMTP Mail
If your server shouldn’t be sending outgoing mail, you may want to block that kind of traffic. To block outgoing SMTP mail, which uses port 25, run this command:

sudo ufw deny out 25
This configures your firewall to drop all outgoing traffic on port 25. If you need to reject a different service by its port number, instead of port 25, simply replace it.

Allow All Incoming SMTP
To allow your server to respond to SMTP connections, port 25, run this command:

sudo ufw allow 25
Note: It is common for SMTP servers to use port 587 for outbound mail.

Allow All Incoming IMAP
To allow your server to respond to IMAP connections, port 143, run this command:

sudo ufw allow 143
Allow All Incoming IMAPS
To allow your server to respond to IMAPS connections, port 993, run this command:

sudo ufw allow 993
Allow All Incoming POP3
To allow your server to respond to POP3 connections, port 110, run this command:

sudo ufw allow 110
Allow All Incoming POP3S
To allow your server to respond to POP3S connections, port 995, run this command:

sudo ufw allow 995

上一篇下一篇

猜你喜欢

热点阅读