Unix Web servers and FireWall


Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Unix Web servers and FireWall

  1. 1. Unix Web servers and Firewall PP 200 and P387 to 411 – Web Security by Lincoln D. Stein
  2. 2. Unix Server (..continue..) <ul><li>Monitor the integrity of System Files and Binaries </li></ul><ul><li>Back up Your System </li></ul>
  3. 3. Monitor the integrity of Systems Files and Binaries <ul><li>It is to monitor whether the files have been modified by intruders. </li></ul><ul><li>The approach is to run a program that generates fingerprint of each ESSENTAIL files. (such as the md5sum (md5 checksum)) </li></ul><ul><li>Compare the files a few days later and see whether any discrepancy. </li></ul>.sys and .win
  4. 4. Back up the system <ul><li>This is common to any system administrators to perform regular backups of essential files. </li></ul><ul><li>tar program is a common utility to perform backup. </li></ul>Tar is a Unix command
  5. 5. Server Security Checklist (1) <ul><li>Have you installed all security-related patches? </li></ul><ul><li>Have you disabled all unnecessary services? </li></ul><ul><li>Have you run a security scanner on your system? (lab 10) </li></ul><ul><li>Does the server do double duty as a user workstation? </li></ul><ul><li>Do the Web server’s file permissions reasonable? </li></ul>From administrator’s viewpoint
  6. 6. Server Security Checklist (2) <ul><li>Is the Web server running as root? (/) </li></ul><ul><li>Is the Web server running any unnecessary features? </li></ul><ul><li>Have you established the limit of users? </li></ul><ul><li>Do you monitor system and web pages logs? </li></ul><ul><li>Do you monitor the integrity of the host? </li></ul><ul><li>Do you backup your system? </li></ul>
  7. 7. Summary on Unix Web servers <ul><li>To harden a Unix Web server as many as possible (patch, disable features….) </li></ul><ul><li>To properly configure the Web server (reduce number of users, file/directory access rights…) </li></ul><ul><li>To Monitor the logs (error log and system log, might run fingerprint) </li></ul><ul><li>To backup your files (use tar command..) </li></ul>Learnt last week
  8. 8. Web servers & Firewall - Overview <ul><li>What is a firewall? </li></ul><ul><li>How to select a firewall? </li></ul><ul><li>How to configure a firewall? </li></ul><ul><li>Automatic proxy configuration for browsers? </li></ul><ul><li>Examining firewall logs for signs of server compromise? </li></ul>This week
  9. 9. Two firewalls with the Internet – restrict some incoming and outgoing traffic based on rules incoming traffic outgoing traffic
  10. 10. What is a firewall? - 長城 ( 防人牆 ) from http://ljq.free163.net/shgc/wlcc.htm block incoming traffic 山海関 port 80 allow traffic through port
  11. 11. Waterwall – prevent enemy, protect castle from edtech.floyd.edu / ~ lnewby/feudal_japan.htm
  12. 12. What is a firewall? <ul><li>In a traditional LAN system, all workstations can access the Internet with a result of equal attack from the outside. </li></ul><ul><li>Just one of the weakest host will break the system. </li></ul><ul><li>The firewall addresses this problem by using a special configurable machine between the outside world and internal machines to control the traffic. </li></ul>
  13. 13. The location of a firewall <ul><li>All traffic must go through the proxy server ( firewall as well ) which then decides to accept or reject the traffic. </li></ul>
  14. 14. Two basic Firewall Systems <ul><li>There are two basic implementations for firewalls. </li></ul><ul><li>Dual home gateway firewall, the gateway machine has two network interface cards each of them is connected to the LAN (inter network) and the Internet (Outer network) </li></ul><ul><li>Screened-host gateway uses a router to forward all the traffic from/to the outer and inner networks. </li></ul>
  15. 15. Dual-home gateway firewall <ul><li>By default, the two networks are isolated. </li></ul><ul><li>However, there is a need to communicate between the inner and outer networks through the specialised programs called proxy (or proxies, many programs with firewall features) </li></ul>block
  16. 16. Screen-hosted gateway <ul><li>A network router is used to control access to the inner network. The router restricts communication between the outer and inner networks. </li></ul><ul><li>It ensures that the packets from the Internet can reach the well secured proxy which then examines the data. </li></ul>In fact, there is no effective difference between dual-home and screen-host
  17. 17. Notes about firewall <ul><li>Many companies use firewall systems that are not strictly firewalls. They are used to block dangerous traffic only. </li></ul><ul><li>The essence of a firewall system is to allow or deny passage to network traffic. They are application level for particular communications protocols, such as HTTP, e-mail, FTP (You need to configure the rule) </li></ul><ul><li>For example, if you decided to block all active X, you then program the proxy to check the contents of all HTML and block those that have active X. </li></ul>
  18. 18. Select a firewall system (1) <ul><li>Because of the large number of competing firewall vendors, it can be difficult to choose. Below is a check list. </li></ul><ul><ul><li>Operating system: Firewall products are available that run on both Unix (linux) or Windows XP systems. Neither has advantages over others. If you are familiar with Unix, Choose it. </li></ul></ul><ul><ul><li>Protocols used: All firewalls will handle FTP, e-mail, HTTP, NNTP telnet etc, but some might not handle SNMP or Real Audio etc. Choose those that can satisfy your need. </li></ul></ul>
  19. 19. Select a firewall system (2) <ul><li>Filter types:Network filters based on application level proxies gives the programmers control over what passes across the firewall. Network filters based on circuit-level proxies have better performance such as IP packet-filtering system. </li></ul><ul><li>Logging: A firewall performs exhaustive logging with tools to analyse the log and summarise the log. </li></ul><ul><li>Administration: Some firewalls are configured with graphical user interfaces, others use text only. </li></ul>
  20. 20. Select a firewall system (3) <ul><li>Simplicity: Good firewall systems are simple. The proxies are small and easy to understand. </li></ul><ul><li>Tunneling: Some firewall systems provide the ability to setup up an encrypting tunnel across the Internet in order to securely connect two networks. ( Tunneling is the transmission of data intended for use only within a private, usually corporate network through the Internet in such a way that the routing node s in the Internet are unaware that the transmission is part of a private network. VPN is an example.) </li></ul>
  21. 21. Products No need to memorise Available a a software-only package or as a turnkey combination. Gauntlet Packet filtering an stateful inspection for NT and Unix Firewall-1 Uses application and circuit level proxy and is available for NT and Unix machines Eagle Unix to support packet filtering, application and circuit-level. CyberGuard A Unix-only system for both application-level and packet-level BorderWare Uses a combination of packet filters, application level proxies and circuit-level AltaVista Feature Product
  22. 22. How to configure a firewall? <ul><li>As there are many commercial products with different commands and approaches, here, we would use a table for describing the routing information and is independent on any products. </li></ul><ul><li>Outgoing web access </li></ul><ul><li>How to allow people within your organisation to safely browse the Web; </li></ul><ul><li>How to make your organisation’s public web available to the rest of the world? </li></ul>
  23. 23. A simple example – packet filter – IE and FTP <ul><li>Assume that you need to provide filter exceptions for outgoing connections to the HTTP (port 80) and FTP (port 21) and the data sent back in response to those connections. (RULE) </li></ul>important ftp - incoming ACK * * 21 * Allow ftp - outgoing * 21 * * [internal user] Allow ie- Incoming ACK * * 80 * Allow Browse outside (iexplorer – outgoing) * 80 * * [internal user] Allow Block all * * * * * Block Comment Flags Port Dest Port Src Action
  24. 24. Explanation <ul><li>The first column indicates whether it is allowed or blocked that traffic. </li></ul><ul><li>The second and third columns indicate which traffic shows from the source. Here port number is specified as well. </li></ul><ul><li>The fourth and fifth columns indicate that outgoing (destination) traffic. Again, port number is specified as well. </li></ul><ul><li>Flags indicates whether it is an </li></ul><ul><li>acknowledgement. </li></ul>
  25. 25. Another simple example – block IE and allow FTP <ul><li>Assume that you need to provide filter exceptions for outgoing connections to the FTP (port 21) and the data sent back in response to those connections. We simply block all traffic expect FTP. </li></ul>important ftp - incoming ACK * * 21 * Allow ftp - outgoing * 21 * * [internal user] Allow Block all * * * * * Block Comment Flags Port Dest Port Src Action
  26. 26. Picture – Gopher protocol is blocked, the table is in the Proxy
  27. 27. A simple example – application level – outgoing, linux environment <ul><li>If the firewall uses application level proxy to provide Internet access, we need to enable separate proxies for each of the protocols commonly used on the Web such as HTTP, FTP, SSL. Below is an example for FTP for a Class C network at 189.45.56 </li></ul><ul><ul><li>#rules for the FTP gateway </li></ul></ul><ul><ul><li>ftp-gw: denial-msg /usr/local/ect/ftp-deny.txt </li></ul></ul><ul><ul><li>ftp-gw: welcome-msg /us/local/ect/ftp-welcome.txt </li></ul></ul><ul><ul><li>ftp-gw: help-msg /usr/local/etc/ftp-help.txt </li></ul></ul><ul><ul><li>ftp-gw: timeout 3600 </li></ul></ul><ul><ul><li>ftp-gw: deny-hosts unknown </li></ul></ul><ul><ul><li>ftp-gw: permit-hosts 189.45.56.* </li></ul></ul><ul><ul><li>#rules for the http/gopher gateway </li></ul></ul><ul><ul><li>http-gw: permit-hosts 189.45.56.* </li></ul></ul>No need to memorise , step by step, but have to understand
  28. 28. Explanation <ul><li>The first six lines of this file set up defaults for the FTP proxy. </li></ul><ul><li>The line containing deny-host prohibits the use of the proxy by any machine without a domain name system entry (here unknown) </li></ul><ul><li>The line containing permit-host allows any hosts in the internal network to use the proxy. Others are prohibited by default. (here, permit-hosts 193.49.189.*, any at this network.) </li></ul>
  29. 29. Incoming Web access <ul><li>Once we solve the problem of outgoing Web services, we need to consider the incoming Web access. </li></ul><ul><li>There are many possibilities (web server with proxy, web server inside the LAN, web server outside the LAN.) Here, we introduce: </li></ul><ul><ul><li>Judas server – Proxy and Web server </li></ul></ul><ul><ul><li>Sacrificial Lamb – Web server outside firewall </li></ul></ul><ul><ul><li>Private Affairs – Web server inside the firewall </li></ul></ul><ul><ul><li>Doubly Fortified Server - use multi-level of proxy to separate networks. </li></ul></ul>
  30. 30. Judas – combine Proxy and Web server <ul><li>It is not a good idea to combine proxy and web server together. </li></ul><ul><li>It is because Web server cannot be trusted to be bug free. </li></ul><ul><li>Any security holes will degrade the proxy. </li></ul>Not a good idea
  31. 31. The Sacrificial Lamb <ul><li>The safest place for a public web server is outside the firewall. It is intended to public use. </li></ul><ul><li>Because communication between LAN and the public web server is restricted, it is difficult to use file sharing or remote login to update the material in the web server. </li></ul>Access by outsiders
  32. 32. The Private Affair Server <ul><li>If the Web server is not intended to be publicly available, all best location is behind the firewall. </li></ul><ul><li>It maintains confidential or sensitive information. </li></ul>Filter all first
  33. 33. The Doubly Fortified Server <ul><li>If you consider your web server contains highly confidential information, you should place it out of the Internet with a multiple level firewalls. (You have to set up a private firewall system.) </li></ul>
  34. 34. Running a reverse Web proxy <ul><li>The primary mission of firewall proxies is to allow people inside the organisation to make outgoing connections to servers on the Internet. </li></ul><ul><li>Their desk-top software connects to a proxy on the firewall; it relays the request to the Internet server and forwards the server's response back. </li></ul><ul><li>It is also possible to use application-level proxies in the reverse direction to grant people on the Internet controlled access to a Web server. </li></ul>
  35. 35. Flow of Information – Bastion (firewall) 1 2 3 4
  36. 36. Hybrid Server <ul><li>The hybrid approach is to combine two together. One on an external scarified lamb server; one on the firewall. </li></ul><ul><li>In this configuration, an internal server is maintained behind the firewall and kept completely inaccessible from the outside world. </li></ul>
  37. 37. Hybrid approach – Bastion (firewall here)
  38. 38. Summary <ul><li>Firewall is to filter the unwanted traffic </li></ul><ul><li>It is to limit the Incoming and outgoing traffic as well. </li></ul><ul><li>Criteria to select a firewall </li></ul><ul><li>Configure a firewall – application level (IE, e-mail) or packet level (IP or TCP) </li></ul><ul><li>Incoming web access – Judas server, Sacrificial lamb, Private affair, Doubly fortified server, reverse web proxy etc. </li></ul>
  39. 39. Next Week <ul><li>Policy and Law </li></ul>