Ufw firewall rule sequence problems

Source: Internet
Author: User


This evening, I felt that the machine suddenly slowed down. I checked access. log and found an ip address (125.66.125.201) from Sichuan in the mainland China to access a file deleted eight hundred years ago.

So I downloaded ufw reject from 125.66.125.201 and loaded the ufw again. But the HTTP request is always filled in...

I had to run ufw status again to open all the rules and check whether the rule I just added was found.

Status: active

To Action From
------------
.............
80/tcp ALLOW Anywhere
Anywhere REJECT 125.66.125.201

It turns out that the rule that allows TCP 80 takes precedence over the blocked rule of the malicious ip address, so manually adjust the order to put the rule that blocks the malicious ip address first:

Sudo ufw insert 1 reject from 125.66.125.201

Close...

Slave? : Two blocking methods are available: reject and deny. reject directly ignores all packets. deny notifies the person who sends the packets: "His package is rejected." basically, just reject.

Update: Sometimes it is desirable to let the sender know when traffic is being denied, rather than simply ignoring it. In these cases, use reject instead of deny. from ufw man page

Here I wrote an error. I just flipped through the file again. It should be the reject that will let the sender know the rejection, while deny directly drops the packet. Row? Yuxi reject will let the client directly get "Connection refused", while deny will keep the program waiting until timeout.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.