|
||||||||
|
||||||||
|
|
Công Cụ | Xếp Bài |
19-05-2009, 02:58 PM | #1 |
Guest
Trả Lời: n/a
|
The Perfect Linux Firewall Part II -- IPCop & Copfilter
The Perfect Linux Firewall Part II -- IPCop & Copfilter Author: Joseph Guarino - Evolutionary IT This document is the second segment in a series on installing IPCop firewall. We will be creating a "DMZ" for hosting your own web server or mail server and the Copfilter proxy for filtering your application layer ingress and egress network traffic. This is intended to be a rough overview on creating a IPCop firewall with Copfilter and comes without warranty of any kind. Using your IPCop for web hosting/mail hosting Given the instructions from the previous article, you should have a full installation of IPCop running. The current focus remains two-fold: to get your server in the Orange (DMZ) segment of your IPCop Network and opening up the ports on your firewall to allow web traffic to it. Additionally, our second goal in this article will be securing our (application layer) web traffic, email and personal privacy with a wonderful add-in, called Copfilter. As we detailed in part one, I suggested the 192.168.10.x network for our "Orange" DMZ segment. In this part of the network I will place hosts that I want visible to the outside world. Port forwarding will permit the flow of traffic from external RED (DHCP interface/network) to DMZ ORANGE network. Orange Network Requirements
Secure your Orange Network Hosts
Secure your Green Network
Hosting a server on a dynamic connection As you are using a cable modem that gives your RED IPCop network interface a dynamic DHCP address, you will need to set up Dynamic DNS services to resolve to this host via a human usable form, other than IP Address. NOTE – Some ISPs block TCP port 80 (HTTP) 110 (POP3) and 25 (SMTP). To navigate around this, you can purchase port forwarding services from some of these dynamic DNS providers, run services on different non-blocked ports or upgrade to another provider. For the sake of this article we assume you have no ISP blocked ports. Setting up Dynamic DNS Along with your dynamically assigned IP address (RED), you will want to use a Dynamic DNS service to be able to allow external access to your external web/mail. Setting up Dynamic DNS with IPCop is easily achieved. Simply pick a Dynamic DNS provider listed in the IPCop DYNDNS settings.
What is Copfilter An amazing project by open source developer Markus Madlener, to extend his IPCop's capabilities to the application layer (see OSI Model). Copfilter greatly enhances the capabilities of the already powerful IPCop by offering the jaw dropping and impressive large list of capabilities:
Why Copfilter? You might ask yourself, if I have a IPCop firewall why would I need Copfilter? As a network security mechanism, the firewall has undergone a serious metamorphosis from a simple packet filter that only understood little of what it carried across the wire, to fully stateful inspection mechanisms that understand layer 5-7. This a far cry from the days of a simple packet filtering router or even a stripped down set of ipchains. And as security is not one technology, process or technique alone, but many of them, Copfilter is another powerful mechanism of defense in protecting your application layer. Installing Copfilter IPCop does not contain add-on binaries by default so they need to be copied via SCP to your IPCop. Then you will be logging in securely via SSH to your IPCop to install these binaries. Turn on SSH on your IPCop
NOTE - It is recommended that you shut off SSH access after you finish copying this code as SSH has many exploits. Enable Squid on your IPCop Via the Webgui go to -> Services -> Proxy
SSH and SCP Clients Depending on your OS you may or may not have a native SCP or SSH client on your machine. Note the port number as TCP port 222 and NOT the default SSH/SCP port. GNU/Linux, Unix, BSD & OSX Clients - Command Line # Command Line SCP scp -P 222 <Copfilterpackage_version.tar.gz root@ipcop_green_addressroot Command Line SSH ssh -p 222 -l root ipcop_green_address Graphical SCP/SSH --> If you are wary of the command line or not interested, alternatively, there are several GUI clients in almost every OS. I will not address each and every one as they are so easy to use, simply requiring a drag and drop, or point and click operation. OS X Clients --> Cyberduck Fugu Windows --> WinSCP - SCP Client Putty – SSH Client OpenSSH for Windows *NIX --> gFtp Installing Copfilter After you have SCP copied the Copfilter-x.x.tgz file to /root on your IPCop as detailed above you are now ready to install it. SSH into your IPCop with whatever client you possess on your respective Operating System. MD-What? Takes an MD5 to assure that the code you downloaded is not altered or corrupted by an external source. Doing this is a simple step verifying that what you have the original, legitimate binary. Linux/UNIX MD5 Md5sum is available in GNU/Linux and Unix by default md5sum Copfilter-x.x.tgz and compare the output to what is listed on the download link as the MD5. Microsoft Windows Windows users can use the easy to use and GPLd wxChecksums or MD5Summer. Both are FOSS software which is freedom geared and light on cost. Apple OS X Apple users will need to open up a terminal window and type md5 Copfilter-x.x.tgz to verify the file. Extract and Install the Binary
Follow the prompts and you are all done. Reboot your IPCop and to be safe empty your browsers cache. After rebooting your IPCop you should see the Copfilter navigation item on the right most top part of the screen (next to the IPCop penguin). Initial Copfilter Configuration Go to Copfilter -> Email and configure your email address, SMTP server and then save those settings. The email address is your (root or administrator) email address and it will be used to notify you of updates and other important Copfilter messages. IMPORTANT - It is strongly recommended that you READ the Copfilter documentation to have an in-depth understanding of the configuration options that you choose to implement. RTFM before you design and definitely before you deploy. Monit - Monitoring Copfilter This service enables you to monitor the core services of the Copfilter application. It provides you some resilience by automatically restarting applications should they fail. Your Configuration Monitoring
Copfilter Configuration Options In controlling the three network services we are going to have ingress (ingoing) and egress (outgoing) control of in our IPCop/Copfilter configuration we have many granular options. Copfilter is going to be filtering our HTTP traffic, POP3, and SMTP traffic. The wonder of the Copfilter add-on is the plethora of options one can chose to deploy our configuration is of course only one of the many. Copfilter - POP3 configuration - P3Scan The Post Office Protocol Version 3 is the industry standard for receiving email. The goal of our configuration is to block spam/malware from being received via our email clients. To access these setting go to Copfilter >> POP3 configuration P3Scan Configuration The following options detail those to be turned ON and all others will be left in the default OFF configuration.
The net effect of this configuration will be an aggressive stance on scanning, dropping and notifying you of the spam/malware, before it reaches your internal network. Copfilter - SMTP configuration - ProxSMTP Simple mail transfer protocol is the standard for email transmission on the the Internet today. With the power of Copfilter one can get very granular on controlling the flow of mail message to and from our network. The goal of our configuration is to block spam/malware from being sent/received via our email clients. To access these setting go to Copfilter >> SMTP configuration The following options are to be turned ON and all others will be left in the default OFF configuration. SMTP Filtering Configuration
NOTE - Choices of the ProxSMTP on RED interface entails 2 options:
This configuration will be an proactive stance on the capturing, quarantining and deleting malware before it infect our trusted machines in the GREEN network. With quarantining ON it is recommended that an administrator be very responsive to the systems warnings about quarantine Spam, and process consistently, or it will be deleted on a weekly basis. I would not recommend keeping a Spam Quarantine setup if you are short on disk space and or want to increase this interval beyond one week. If you do you run the risk of filling up your disk. Also as whitelisting and blacklisting has been turned on remember to add in your whitelisted domains (trusted email sources) and blacklisted (domains you do not trust or want spam from). HTTP Scanning - HAVP/Privoxy HyperText Transfer Protocol is the protocol we use when we are surfing the Internet. HAVP (HTTP Antivirus Proxy) is a proxy server with the ClamAV anti-virus scanner. This will be crucial in your configuration to scan incoming HTTP traffic and keep malware off your machines. To access these setting go to Copfilter >> HTTP Filter HTTP Configuration The following options are to be turned ON and all others will be left in the default OFF configuration.
This configuration will allow for malware to be filtered out at our IPCop box, such as browser exploits, phishing attempts and viruses. Additionally, ads, banners and other Internet advertising junk with Privoxy. With web banners and such that are blocked you will either see the item labeled "Advertisement" or an image of a checkered pattern indicating it has been blocked. If you hate ads as much as do I you can get an add-on for Firefox called Adblock that will allow client side blocking as well. Adblock AntiSpam - SpamAssassin and Rules Du Jour Spam Assassin will help your email server identify and filter Spam before it reaches your email client inbox. SpamAssassin uses Bayesian filtering, DNS blocklist, header and text analysis and collaborative filtering databases to keep your Spam at a minimum. Please note that the more filtering you do before delivering to the client the higher the load on the server.
To access these setting go to Copfilter >> AntiSpam configuration AntiSpam Configuration The following options are to be turned ON and all others will be left in the default OFF configuration.
AntiVirus - ClamAV ClamAV is an amazing FOSS project virus scanner. Within Copfilter this is used to virus scan email and web traffic for malware. To access these settings go to Copfilter >> Antivirus Copfilter - Antivirus Configuration
The effect of these settings is that ClamAV is going to update its virus definitions on its own and be available for scanning your SMTP/POP3 and HTTP traffic. Allowing traffic between Different Networks Please note that there are certain default rules that IPCop implements on your network and be aware of the implications. See the following link for further details. By default the configuration uses the /etc/rc.d/rc.firewall.local and changes can be made through web GUI or via SSH. Any good firewall by default setup to deny any external connections behind its trusted networks. In IPCop speak that means that there is no ingress (incoming) access by default from the RED interface/network to any other Network. By default access from ORANGE to RED is Open so there is no need for any special configuration in this example. If you for whatever reason need access from your Orange "DMZ" to Internal GREEN you can define rules via DMZ Pinholes. IPCop Port Forwarding - HTTP As detailed above SMTP and POP3 rules are created by Copfilter are automatically created. As for HTTP (RED to ORANGE) it is NOT so you have to create it in Port Forwarding as below. If you would like to open other ports to external access (ex. FTP, SSH) please be aware the services should be hardened and security as much as possible (see layered approach I detail above). Copfilter Test & Log The most obvious way is via surf the web. Send and receive a test email. The Copfilter Test & Log page can help you ascertain if your configuration is proper. The tests listed are very self-explanatory in that you can examine your Email/Spam defense by clicking on the buttons in the Test POP3 & SMTP Scanning section. Below is the Test HTTP & FTP Scanning section which you can click on to verify the functionality of your HAVP HTTP virus scanner by clicking on the link to the Eicar "test" virus. This page will come up blocked with the default HAVP message to show you that your HTTP is now secured from common malware, phishing attempts, and other threats. Sending and testing the variety of email options on the test page will allow you to verify your SMTP/POP3 configuration. If you can send and receive your emails and see the following in your email headers -- you are all set. X-Filtered-With-Copfilter: Version 0.82 (ProxSMTP 1.3.91) X-Copfilter-Virus-Scanned: ClamAV 0.88/1291 - Thu Feb 16 21:15:09 2006 Copfilter Test and Logs Screen Lastly, your log files are to the right bottom of your Copfilter Test & Log page where you can see all the details of your Copfilter configuration. Bravo! You are good to go! =) Now you can enjoy the fact you are much more secure than when you began this article! If you like what you see, I welcome you to join our FOSS community. Free and Open Software (FOSS) does not sustain on developers alone but by the work of all sorts in technical writing, support, marketing, graphics, web developers and a multitude of other supporters like you! FOSS is built upon community, so join us and take part in reinventing computing in the positive directions from which we all collectively benefit. In speaking with Markus I was able to ask him why he was motivated to create Copfilter and he answered, he said: "I created Copfilter to help protect the computers of my friends and family and the greater Internet community." Markus I don't think there is a better way to describe the spirit of FOSS. Much thanks to Markus and the entire IPCop Team and all the other projects that made this possible! ..::Check out the FOSS community Projects related to this article ::.. IPCop Homepage -->http://www.ipcop.org Copfilter Homepage --> http://www.copfilter.org Copfilter Forum --> http://copfilter.endlich-mail.de/ Additional Related Links |
|
|