Category: Web Filtering & Proxies

Smoothwall, pfSense, Squid and web security gateways: proxy types, filtering policies, authentication and HTTPS inspection.

  • Smoothwall GNS3 step by step Lab setup

    VirtualBox and GNS3 (Smoothwall Virtual Test Labs)

    GNS3 Test Labs (Smoothwall Labs):
     
    Lab Scenarios:
    (Please add more Lab scenarios that you think could be useful)
     

    1. Cisco IOS Router (7200 series) with NATTing connected to the internet (ACLs configured for specific subnets being used behind the Smoothwall).

    2. Smoothwall UTM Master and Failover with Multiple External connections (Primary/Secondary) to test HA and LLB

    3. Apache Server on an internal Windows 7 machine to test port-forwarding rules from the internet facing VM.

    4. VLANs using NM-16ESW (3725 series router network module) trunk linked to the Smoothwall (VLANs 10, 20 and 1)

    5. Child node (bridged) for a Windows 7 machine getting replication from a parent node.

    6. Windows 7 machine externally connected to the UTM (between the external router and the Master UTM ) to test L2TP, SSL VPNs, Global Proxy, Mobile Proxy and Syslog server.

    7. Solarwinds Real-time SNMP bandwidth monitoring tool for testing SNMP.

    8. Hardware WAP (TPLink) connected to virtual switch (NM-16ESW 3725 series) configured with RADIUS (802.1x//WPA Enterprise/BYOD) to test iOS (iPads and iPhones) or android devices (Installed Openwrt firmware on my TPLink that supports not only authentication but also accounting i.e. ports 1812 and 1813)(Smoothwall configured as a DHCP Server)(Will try to find a WAP that support framed IPs to test further RADIUS scenarios)

    9. Using two Windows 2012 VMs for testing multi domains AD connection on the Smoothwall.

    10. Other VMs include Win 7, Win 8, Win 10, Ubuntu, Mac OS X and Chromium.

    11. Wireshark is already integrated in GNS3 and you can capture traffic on any connected links for troubleshooting.

    12. Separate lab for testing IPSec VPN connectivity between two Smoothwalls or Smoothwall and ASA.

    13. It will be easier with VMs on GNS3 to test further features like IDS/IPS, Upstream Proxy, Bandwidth Management (You might notice some latency), Upstream Firewall, F5 Load Balancer VMs.
     
    14. For Cisco devices you can also use CCP (Cisco Configuration Professional) software to configure using a wizard based GUI instead of CLI.


    gns3network

    Install GNS3 1.3.0 on Ubuntu 14.10 and 14.04 LTS :

    — GNS3 CLI installation —

    – After opening a terminal, I recommend changing to your user home directory.

    $ cd ~

    – Run apt-get update

    $ sudo apt-get  update

    $ sudo apt-get  upgrade

    $ sudo apt-get  dist-upgrade

    – Install GNS3 Python dependencies

    $ sudo apt‐get install python3‐setuptools

    $ sudo apt‐get install python3‐pyqt4

    $ sudo apt‐get install python3‐ws4py

    $ sudo apt‐get install python3‐netifaces

    – Install Dynmips dependencies

    $ sudo apt-get install cmake

    $ sudo apt‐get install libelf‐dev

    $ sudo apt‐get install uuid‐dev

    $ sudo apt‐get install libpcap‐dev

     – Download and unzip GNS3 Linux source files (Download )

    $ unzip GNS3-1.3.7-source.zip

             dynamips-0.2.14.zip  gns3-server-1.3.7.zip  vpcs-0.6.zip

              gns3-gui-1.3.7.zip

     – Build and Install Dynamips

    $ unzip dynamips-0.2.14.zip

    $ cd  dynamips-0.2.14

    $ mkdir build

    $ cd build

    $ cmake ..

    $ make

    $ sudo make install

    $ sudo setcap cap_net_admin,cap_net_raw=ep /usr/local/bin/dynamips

    $ cd ../..

     – Install GNS3 Server

    $ unzip gns3-server-1.3.7.zip

    $ cd gns3-server-1.3.7

    $ sudo python3 setup.py install

    $ cd ..

     – Install GNS3 GUI

    $ unzip gns3-gui-1.3.7.zip

    $ cd gns3-gui-1.3.7

    $ sudo python3 setup.py install

    $ cd ..

     – Install VPCS

    $ unzip vpcs-0.6.zip

    $ cd vpcs-0.6/src

    $ ./mk.sh

    $ sudo cp vpcs /usr/local/bin/

    $ cd ../..

     – Install VirtualBox

    $ sudo apt-get install virtualbox

     – Install Wireshark

    $ sudo apt-get install wireshark

     – Install QEMU – method 1

    $ sudo apt-get install qemu

     – Install QEMU – method 2 (x86 arch. only)

    $ sudo apt-get install qemu-system-x86

    $ sudo apt-get install qemu-utils

     – Install cpulimit

    $ sudo apt-get install cpulimit

     – Start GNS3

    $ gns3

     

  • Distributing Smoothwall’s (https) mitm self-signed CA certificate to BYOD (mobile) client devices (unmanaged device other than Windows clietns)

    If you wish to use ‘decrypt and inspect’ for BYOD devices, the users will need to have the Smoothwall’s HTTPS MiTM CA cert sent out to them so that they can install it on their systems.

    The best ways to get this CA to the clients is to either:

    – Email the CA to them directly
    or
    – Provide a download link to the CA so the users can download it themselves directly.

    Then, according to their devices instructions, they need to install the CA so it can be trusted.

    (It isn’t possible to use a normal real world certificate for the MiTM as this requires a full certificate authority)

  • Smoothwall IPSec (Openswan) VPN to Microsoft Azure (Site-to-Site VPN)

    Smoothwall can only be set to use Diffie Hellman group 5 in Phase 1 when initiating the VPN, however when offered by the other device the smoothwall can downgrade to DH2.

    All the other encryption settings can be done on the smoothwall. So when setting up the connection on the smoothwall’s end, it would look something like this:

    Authenticate by: preshared key
    Use comrpession – off
    Initiate the connection – off
    Perfect forward secrecy – off
    Authentication type: ESP
    Phase 1 cryptograhic algo: AES256
    Phase 1 hash algo: SHA
    Phase 2 cryptograhic algo: AES256
    Phase 2 hash algo: SHA

    Key life: 480 mins
    IKE lifetime: 60 mins

    These settings would need to be set the same on the Azure gateway, and it would need to be set up as the initiator

  • Block a single domain through DNS on windows server 2003/2008/2012

    We just got a phishing attempt and I felt really bad that I could not stop people from accessing a domain. Isn’t there a way to override a domain in our DNS just for a while so I can stop people from accessing a domain?

    Yes, you could create a zone for that domain. No need to create any records, unless you want to point them to a webserver explaining why they are there. Having a DNS zone will make you authoritative for it. When people click on the phishing links, their computers will try to resolve the name with your DNS, and of course, will not be able to access the malware site.

  • Deep Packet inspection (DPI) / Layer 7 application recognition / Network Based application recognition (NBAR)

    Deep packet inspection (DPI) is an advanced method of packet filtering that functions at the Application layer of the OSI (Open Systems Interconnection) reference model. The use of DPI makes it possible to find, identify, classify, reroute or block packets with specific data or code payloads that conventional packet filtering, which examines only packet headers, cannot detect.

    Network Based Application Recognition (NBAR) is the mechanism used by some Cisco routers and switches to recognize a dataflow by inspecting some packets sent.

    The networking equipment which uses NBAR does a deep packet inspection on some of the packets in a dataflow, to determine which traffic category the flow belongs to. Used in conjunction with other features, it may then program the internal ASICs to handle this flow appropriately. The categorization may be done with OSI layer 4 info, packet content, signaling, and so on but some new applications have made it difficult on purpose to cling to this kind of tagging.

    The NBAR approach is useful in dealing with malicious software using known ports to fake being “priority traffic”, as well as non-standard applications using dynamic ports. That’s why NBAR is also known as OSI layer 7 categorization.

    On Cisco routers, NBAR is mainly used for Quality of Service and Security purposes.

  • Reverse Proxy (Reverse Proxy vs Forward Proxy)

     

    In computer networks, a reverse proxy is a type of proxy server that retrieves resources on behalf of a client from one or moreservers. These resources are then returned to the client as though they originated from the server itself (or servers themselves).While a forward proxy acts as an intermediary for its (usually nearby) associated clients and returns to them resources accessible on the Internet, a reverse proxy acts as an intermediary for its (usually nearby) associated servers and only returns resources provided by those associated servers.

     

     

    A proxy server connecting the Internet to an internal network.

    A forward proxy taking requests from an internal network and forwarding them to the Internet.

    Diagram of proxy server connected to the Internet.
    An open proxy forwarding requests from and to anywhere on the Internet.
    A proxy server connecting the Internet to an internal network.
    A reverse proxy taking requests from the Internet and forwarding them to servers in an internal network. Those making requests connect to the proxy and may not be aware of the internal network.
    Reverse Proxies broker connections coming from the internet, to your app servers. Forward Proxies filter connections going out to the internet, from clients sitting behind the firewall.
    Reverse Proxies take origin connections from the internet and connect them to one server or a server farm, meaning multiple inbound connections from the internet are pooled into one or more connections to the server(s). This is known as TCP Multiplexing, and is often used with Load Balancing techniques to optimize and accelerate application delivery. Reverse Proxies measure load based on the incoming and outgoing connection ratio, the higher the ratio the better the performance
    Reverse Proxies are good for:
    • Application Delivery including:
      • Load Balancing (TCP Multiplexing)
      • SSL Offload/Acceleration (SSL Multiplexing)
      • Caching
      • Compression
      • Content Switching/Redirection
      • Application Firewall
      • Server Obfuscation
      • Authentication
      • Single Sign On

     

    • Reverse proxies can hide the existence and characteristics of an origin server or servers.
    • Application firewall features can protect against common web-based attacks. Without a reverse proxy, removing malware or initiating takedowns, for example, can become difficult.
    • A reverse proxy can distribute the load from incoming requests to several servers, with each server serving its own application area. In the case of reverse proxying in the neighborhood of web servers, the reverse proxy may have to rewrite the URL in each incoming request in order to match the relevant internal location of the requested resource.
    • A reverse proxy can reduce load on its origin servers by caching static content, as well as dynamic content – also known as web acceleration. Proxy caches of this sort can often satisfy a considerable number of website requests, greatly reducing the load on the origin server(s).
    • Reverse proxies can operate whenever multiple web-servers must be accessible via a single public IP address. The web servers listen on different ports in the same machine, with the same local IP address or, possibly, on different machines and different local IP addresses altogether. The reverse proxy analyzes each incoming request and delivers it to the right server within the local area network.

    The Forward Proxy

    When people talk about a proxy server (often simply known as a “proxy”), more often than not they are referring to a forward proxy. Let me explain what this particular server does.

    A forward proxy provides proxy services to a client or a group of clients. Oftentimes, these clients belong to a common internal network like the one shown below.

     

    forward proxy

     

    When one of these clients makes a connection attempt to that file transfer server on the Internet, its requests have to pass through the forward proxy first.

    Depending on the forward proxy’s settings, a request can be allowed or denied. If allowed, then the request is forwarded to the firewall and then to the file transfer server. From the point of view of the file transfer server, it is the proxy server that issued the request, not the client. So when the server responds, it addresses its response to the proxy.

    But then when the forward proxy receives the response, it recognizes it as a response to the request that went through earlier. And so it in turn sends that response to the client that made the request.

    Because proxy servers can keep track of requests, responses, their sources and their destinations, different clients can send out various requests to different servers through the forward proxy and the proxy will intermediate for all of them. Again, some requests will be allowed, while some will be denied.

    As you can see, the proxy can serve as a single point of access and control, making it easier for you to enforce security policies. A forward proxy is typically used in tandem with a firewall to enhance an internal network’s security by controlling traffic originating from clients in the internal network that are directed at hosts on the Internet. Thus, from a security standpoint, a forward proxy is primarily aimed at enforcing security on client computers in your internal network.

    But then client computers aren’t always the only ones you find in your internal network. Sometimes, you also have servers. And when those servers have to provide services to external clients (e.g. field staff who need to access files from your FTP server), a more appropriate solution would be a reverse proxy.

     

    The Reverse Proxy

    As its name implies, a reverse proxy does the exact opposite of what a forward proxy does. While a forward proxy proxies in behalf of clients (or requesting hosts), a reverse proxy proxies in behalf of servers. A reverse proxy accepts requests from external clients on behalf of servers stationed behind it just like what the figure below illustrates.

    reverse proxy

     

    To the client in our example, it is the reverse proxy that is providing file transfer services. The client is oblivious to the file transfer servers behind the proxy, which are actually providing those services. In effect, whereas a forward proxy hides the identities of clients, a reverse proxy hides the identities of servers.

    An Internet-based attacker would therefore find it considerably more difficult to acquire data found in those file transfer servers than if he wouldn’t have had to deal with a reverse proxy.

    Just like forward proxy servers, reverse proxies also provide a single point of access and control. You typically set it up to work alongside one or two firewalls to control traffic and requests directed to your internal servers.

    Both types of proxy servers relay requests and responses between source and destination machines. But in the case of reverse proxy servers, client requests that go through them normally originate from the Internet, while, in the case of forward proxies, client requests normally come from the internal network behind them.

     

  • What is a Proxy?

    Web Proxy?

    A proxy server is computer that functions as an intermediary between a web browser (such as Internet Explorer) and the Internet. Proxy servers help improve web performance by storing a copy of frequently used webpages. When a browser requests a webpage stored in the proxy server’s collection (its cache), it is provided by the proxy server, which is faster than going to the web. Proxy servers also help improve security by filtering out some web content and malicious software.

    Proxy servers are used mostly by networks in organizations and companies. Typically, people connecting to the Internet from home will not use a proxy server.

    1. Obscure Client IP
    2. Block Malicious Traffic
    3. Block Sites (whitelists/blacklists)(categories of sites)
    4. Log activity (user activity reports)
    5. Improve Performance (caching the pages)
    ——————————–
    :::Types of Proxies:::
    1. Forward Proxies
    2. Open Proxies
    3. Reverse Proxies
    ——————————–
    In an enterprise that uses the Internet, a proxy server is a server that acts as an intermediary between a workstation user and the Internet so that the enterprise can ensure security, administrative control, and caching service. A proxy server is associated with or part of a gateway server that separates the enterprise network from the outside network and a firewall server that protects the enterprise network from outside intrusion.

    A proxy server receives a request for an Internet service (such as a Web page request) from a user. If it passes filtering requirements, the proxy server, assuming it is also a cache server , looks in its local cache of previously downloaded Web pages. If it finds the page, it returns it to the user without needing to forward the request to the Internet. If the page is not in the cache, the proxy server, acting as a client on behalf of the user, uses one of its own IP addresses to request the page from the server out on the Internet. When the page is returned, the proxy server relates it to the original request and forwards it on to the user.

    To the user, the proxy server is invisible; all Internet requests and returned responses appear to be directly with the addressed Internet server. (The proxy is not quite invisible; its IP address has to be specified as a configuration option to the browser or other protocol program.)

    An advantage of a proxy server is that its cache can serve all users. If one or more Internet sites are frequently requested, these are likely to be in the proxy’s cache, which will improve user response time. In fact, there are special servers called cache servers. A proxy can also do logging.

    The functions of proxy, firewall, and caching can be in separate server programs or combined in a single package. Different server programs can be in different computers. For example, a proxy server may in the same machine with a firewall server or it may be on a separate server and forward requests through the firewall.
    ——————————–
    :::Transparent versus non-transparent proxying:::

    Issue
    Smoothwall web proxy service can be configured to operate in either transparent or non-transparent mode – but what are the differences, and how should you choose between them?
    Resolution
    In transparent mode, there are no special configuration steps needed to setup client browsers, thus allowing the proxy service to be activated and in-use almost immediately. Once activated, all traffic destined for the Internet arriving on port 80 is automatically redirected through the proxy. With the latest Guardian products you can even use NTLM with Active Directory in conjunction with transparent proxying allowing for single sign on and minimal network configuration.
    Both transparent and non-transparent proxying can be used together at the same time. Enabling transparent does not stop non-transparent from working. In situations where transparent is the norm but a specific application requires non-transparent you can simply configure the proxy settings in that application.
    Both modes have pros and cons – if you would like to use transparent proxying please contact support for a discussion on the issues your network may experience when using this method.

    Why use non-transparent proxying?

    The main reason to use a non-transparent proxy is so that the web browser and other client applications know that a proxy is being used, and so can act accordingly. Initial configuration of a non-transparent proxy might be trickier, but ultimately provides a much more powerful and flexible proxying service. Another advantage of non-transparent proxying is that spyware and worms that use the web for transmission may not be able to function because they don’t know the proxy settings. This can reduce the spread of malicious software and prevent bandwidth from being wasted by infected systems.

    Configuring proxy settings in non-transparent mode

    When using non-transparent proxying, appropriate proxy settings must be configured on client machines and browsers. This can be achieved in a number of different ways:

    Manually – Proxy settings can be entered manually in most web browsers and web-enabled applications. Usually such settings are entered as part of the applications Connection Settings or similar. The address of the proxy is required, along with the proxy port number. These settings are displayed on the “Services / web proxy” and “Guardian / web proxy” pages as part of the “Automatic configuration scrip”” region.

    Automatic configuration script – The Smoothwall proxy provides a proxy.pac file that can be used to automatically configure proxy settings in most Internet browsers. To use the automatic configuration script, enter the URL displayed in the “Automatic configuration script” region of the “Services / web proxy” and “Guardian / web proxy” pages into your browser software.

    Microsoft Windows 2000 domain – In a Windows 2000+ domain, proxy settings can be configured in the domain security policy. This eliminates the need to manually configure any part of the users system.

    Automatic discovery – Many browsers support automatic discovery of proxy settings using the WPAD (Web Proxy Auto-Discovery) protocol. This is relatively easy to configure if you have a local DNS server. Using DHCP to distrubute proxy settings – DHCP can also be used to set proxy settings. That might be a better method than using security policies. Currently the DHCP server on the Smoothwall firewalls cannot be used for giving out proxy.pac locations.

    Microsoft Windows login script – The Windows login script can be used to import a registry file which will automatically configure the system wide proxy settings.

    .ini files – Browsers like Firefox can be configured automatically with ini files. Such files could be copied or modified as part of the login script on a Microsoft Windows or Linux network.

    Third party solutions – Third party applications are available for Windows which can, at login, automatically configure web browser proxy settings. These range from simple programs designed specifically to automate proxy configuration, or more sophisticated applications that provide a range of services such as monitoring the users desktop.

    When to use transparent proxying

    When minimal or no network configuration is required. Transparent proxying can be useful in mixed environments containing Unix, Linux, Apple Mac and Microsoft Windows systems. This allows quick access to the web proxy for everyone, without having to configure a multitude of different platform specific applications and browsers. If transparent proxy is required, please have a talk with Smoothwall support before you decide on the implementation as there are a lot of caveats using this method.
    ——————————————–
    How to Setup a Proxy

    Most internet browsers can be setup to run through proxies in just a matter of minutes.

    Internet Explorer Proxy Settings
    Click Tools
    Click Internet Options
    Click the Connections Tab
    Click LAN settings
    Check the “Use a proxy server for your LAN” box
    Enter the IP Address of the Proxy Server and the Port Number
    Click OK
    Go to WhatIsMyIP.com to check for proxy

    FireFox Proxy Settings
    Click the FireFox Button(The button in the upper left corner)
    Click Options
    Click Options in the new tab
    Click the Advanced Tab
    Click Settings
    Click Manual Proxy Settings
    In the HTTP Proxy Box enter the IP Address of the proxy server and the Port number
    Click OK
    Go to WhatIsMyIP.com to check for proxy

    Google Chrome Proxy Settings
    Click the Customize and Control Button(Button with the wrench picture in upper right corner
    Click Under the Hood
    Click Change proxy settings
    Click LAN Settings
    Check the “Use a proxy server for your LAN” box
    Enter the IP Address of the Proxy Server and the Port Number
    Click OK
    Go to WhatIsMyIP.com to check for proxy

    Safari Proxy Settings
    Click Safari
    Click Preferences
    Click Advanced
    Click Change Settings
    Check the Web Proxy(HTTP) box
    Enter the IP Address of the Proxy Server and the Port Number
    Click Apply Now
    Go to WhatIsMyIP.com to check for proxy

  • Port Forwarding

    ::::Port forwarding::::
    http://portforward.com/

    Port forwarding or port mapping is a name given to the combined technique of

    1.translating the address or port number of a packet to a new destination
    2.possibly accepting such packet(s) in a packet filter (firewall)
    3.forwarding the packet according to the routing table.

    The destination may be a predetermined network port (assuming protocols like TCP and UDP, though the process is not limited to these) on a host within a NAT-masqueraded, typically private network, based on the port number on which it was received at the gateway from the originating host.

    The technique is used to permit communications by external hosts with services provided within a private local area network

    Port forwarding allows remote computers (for example, computers on the Internet) to connect to a specific computer or service within a private local-area network (LAN).

    In a typical residential network, nodes obtain Internet access through a DSL or cable modem connected to a router or network address translator (NAT/NAPT). Hosts on the private network are connected to an Ethernet switch or communicate via a wireless LAN. The NAT device’s external interface is configured with a public IP address. The computers behind the router, on the other hand, are invisible to hosts on the Internet as they each communicate only with a private IP address.

    When configuring port forwarding, the network administrator sets aside one port number on the gateway for the exclusive use of communicating with a service in the private network, located on a specific host. External hosts must know this port number and the address of the gateway to communicate with the network-internal service. Often, the port numbers of well-known Internet services, such as port number 80 for web services (HTTP), are used in port forwarding, so that common Internet services may be implemented on hosts within private networks.

    Typical applications include the following:

    Running a public HTTP server within a private LAN
    Permitting Secure Shell access to a host on the private LAN from the Internet
    Permitting FTP access to a host on a private LAN from the Internet

    Administrators configure port forwarding in the gateway’s operating system. In Linux kernels, this is achieved by packet filter rules in the iptables or netfilter kernel components. BSD and Mac OS X operating systems implement it in the Ipfirewall (ipfw) module.

    When a port forward is implemented by a proxy process , then no packets are actually translated, only data is proxied. This usually results in the source address (and port number) being changed to that of the proxy machine.

    ———————————————
    Port forwarding opens certain ports on your home or small business network, usually blocked from access by your router, to the Internet. Opening specific ports can allow games, servers, BitTorrent clients, and other applications to work through the usual security of your router that otherwise does not permit connections to these ports.

    ———————————————-

    If you are running servers inside your network, which are going to be accessed from the outside world, you have to use port forwarding on your router.
    Within the router it forwards certain ports to specific servers.
    If you have a webserver and you want to access it from outside the local network, you will have to port forward port 80.
    e.g: email server, web server, ftp server etc.

    you can only port forward a single port for a single public IP to the single IP to that port inside the network.
    e.g: 2.2.2.2:80 port forwarded to 192.168.1.10:80, but if you are using another web server then you will have to you another port

    webserver(192.168.1.10:80)<->switch<->(192.168.1.1)router(203.55.66.11:80)<->internet(someone accessing 203.55.66.11:80)

    e.g. SMB router
    sometimes the common services are already mentioned and you simply have to mention the destination IP (e.g. FTP 21->21 to IP 10.1.10.20)