Rotten mud: firewall configuration enabled on the FTP server

Source: Internet
Author: User
Tags ftp client filezilla ftp protocol

This article is first published in the dark world.

The most recent server of the company needs to enable the FTP service to transfer files.

However, considering that the server is on the public network, firewall is usually enabled for security considerations. In general, I disable the firewall for FTP servers in the company.

Below I will flow out the firewall configuration as follows:

OS: Windows Server 2003, 2008 ftp: filezilla server 0.9.41

The first step is to install the FTP server. In this scenario, the open-source FTP server filezill server is used. For installation and use of filezilla server, you can go to Baidu. There are many articles on the Internet. I will not discuss it here.

FTP transmission is special, unlike other protocols that use a port. The FTP protocol requires two ports, one of which is port 21, which is used to transmit related commands. One is the data port. The default port is Port 20, which is used to transmit file data.

Therefore, we need to open two ports 21 and 20 on the firewall.

After all, it is transmitted over the public network, so we have to consider the security. Here we change the FTP ports to 2121 and 6650. In addition, only the specified IP address can be used to connect to the FTP server.

For example:

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_1404560742HRNV.png "width =" 820 "Height =" 488 "/>

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_1404560743xklC.png "width =" 607 "Height =" 418 "/>

Now the firewall is enabled. Let's connect to it remotely.

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_1404560743q9OP.png "width =" 441 "Height =" 478 "/>

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_1404560744CG3t.png "width =" 538 "Height =" 517 "/>

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_1404560745REt4.png "width =" 534 "Height =" 249 "/>

The FTP server cannot be connected.

Now we open ports 2121 and 6650 on the firewall, as shown below:

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_1404560746tLcz.png "width =" 554 "Height =" 484 "/>

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_1404560747TJCJ.png "width =" 586 "Height =" 485 "/>

Now we connect to the FTP server, for example:

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_14045607487MZ5.png "width =" 553 "Height =" 640 "/>

We can see that the FTP client has successfully connected to the FTP server.

The above firewall is operated on Windows Server 2003. Let's take a look at the firewall settings on Windows Server 2008.

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_1404560749Io8q.png "width =" 688 "Height =" 410 "/>

In the firewall rule options, we only need to configure inbound rules. For example:

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_1404560750ZWSS.png "width =" 768 "Height =" 301 "/>

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_1404560751SEp2.png "width =" 725 "Height =" 541 "/>

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_1404560751VsLH.png "width =" 714 "Height =" 311 "/>

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_14045607523OEC.png "width =" 663 "Height =" 331 "/>

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_1404560753CWyE.png "width =" 461 "Height =" 415 "/>

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_1404560753ghOJ.png "width =" 391 "Height =" 392 "/>

In inbound rules, port 6650 is opened in the same way.

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_1404560754RRl8.png "width =" 607 "Height =" 251 "/>

The preceding figure shows how to open the corresponding port on the firewall. Next we will configure the specified IP address to connect to the FTP server.

In fact, there are two ways to specify an IP address to connect to the FTP server. One is to set the IP address on filezilla server, and the other is the key firewall in this article.

First, let's take a look at how to set up filezilla server. Open filezilla server and select a global configuration item. IP Filter is very important.

Fill in the upper half of the IP Filter with the IP address that cannot be connected, and the lower half with the IP address that can be connected to the FTP server. By default, all IP addresses cannot connect to the FTP server. Therefore, fill in "*" in the upper part. For example:

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_1404560755eVHI.png "width =" 599 "Height =" 408 "/>

Now let's try to connect. My local public IP address is:

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_1404560756lGxs.png "width =" 755 "Height =" 295 "/>

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_1404560757M0ch.png "width =" 550 "Height =" 175 "/>

I cannot connect to the FTP server locally. So can the allowed IP addresses be connected? For example:

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_1404560758j8Fn.png "width =" 1076 "Height =" 587 "/>

We can see that the connection is successful.

These are the IP address filtering settings of the filezilla server. Next we will not use filezilla server settings, but firewall settings.

Enable the ports 2121 and 6650 configured by the firewall, for example:

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_1404560759p8yX.png "width =" 512 "Height =" 387 "/>

Click "change range"-"custom list", and fill in the IP addresses allowed for access in the custom list. For example:

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_14045607600PHD.png "width =" 579 "Height =" 297 "/>

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_1404560760E52p.png "width =" 704 "Height =" 314 "/>

After the above firewall settings are complete, let's test the connection.

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_1404560762uijV.png "width =" 701 "Height =" 608 "/>

I can see that I still cannot connect to the FTP server locally. What is the allowed IP address? For example:

650) This. width = 650; "Title =" image "style =" border-right-width: 0px; Background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; padding-Right: 0px; border-top-width: 0px; margin-Right: auto; "Border =" 0 "alt =" image "src =" http://img1.51cto.com/attachment/201407/5/526870_1404560763pGtl.png "width =" 810 "Height =" 433 "/>

We can see that the allowed IP Address can connect to the FTP server.

Through the above experiments, we can know. If we have special requirements, for example, the port 80 of the Open Server can only be accessed by the specified IP address, which improves the security of related applications.

Especially for servers with port 3389 enabled, we can use this method to reduce the possibility of server attacks.

PS: Since version 0.9.42, filezilla server does not support Windows Server 2003.

This article from the "muddy world" blog, please be sure to keep this source http://ilanni.blog.51cto.com/526870/1434874

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.