SlideShare une entreprise Scribd logo
1  sur  4
Télécharger pour lire hors ligne
Express-Guide
                                       ~to~
                                 Basic Setup of


                 Squid-cache
                                Proxy Chaining
                                                by, ABK ~ http://www.twitter.com/aBionic


                              ::Task Detail::
   Setting up a secured Chained-Proxy between different offices using Squid
    for a specific URL set.




                                 ::Background::

Links: http://www.squid-cache.org/

   Some background information about Squid Cache Proxy Server:
    ◦ its a high performance proxy caching server for web clients, supporting
      FTP, Gopher and HTTP data objects i.e. normally text-based protocols
    ◦ keeps metadata and hot-objects cached in RAM, supports non-block DNS
      and SSL
    ◦ it can be implemented as a Normal Proxy which needs to be configured
      at User's end or even as a Interception Proxy



                             ::Execution Method::

   Installing Squid was really easy, its available at YUM Repositories so use
    #yum -y install squid

   Open 'squid.conf' file in an editor to edit squid's configuration {might find it
    at '/etc/squid/squid.conf' or '/usr/local/etc/squid/squid.conf'}

     ◦ NOTE: Remember, the settings here are interpreted as per their
       occurrence in file as a filter above another. So, if you block "A,B,C" first
       and then allows "C,D,E"; then C will remain blocked. So, to be on safer
       side Squid.Conf has a section defined for each configuration along-with
       its detail. For every line of configuration go in its section and then add it.
◦ Now the most basic setting required to edit is enabling access from
    clients for that just add settings as per following 2 lines
    ▪ following lines
        acl myClientNetwork src 192.168.0.0/16
        http_access allow myClientNetwork
  ◦ Suppose you wanna set rules for URLs of "A.com" and "Z.com" domain
    ▪ make its ACL as
        acl egurls url_regex .A.com .Z.com
    ▪ Denying proxy of this URL set
        always_direct allow egurls
        never_direct deny egurls
    ▪ Allowing proxy of this URL set
        always_direct deny egurls
    ▪ Denying direct access of URLs if proxy not possible
        never_direct allow egurls
  ◦ Check if line with 'http_port' is
    ▪ http_port 3128
  ◦ To stop caching queries
    ▪ acl Query urlpath_regex cgi-bin ?
    ▪ cache deny Query
  ◦ Setting a hostname for Proxy, just don't reveal any info
    ▪ visible_hostname ANYHOSTNAME
  ◦ To setup a Parent Squid Server to set Proxy Chaining
    ▪ cache_peer parent1IPorName parent 3128 0 no-query default
    ▪ cache_peer parent2IPorName parent 3128 0 no-query
  ◦ To provide sibling Squid Server for cache checks
    ▪ cache_peer parent2IPorName sibling 3128 3130
  ◦ To setup Squid Proxy only for Fail-over, preferring direct connection
    otherwise
    ▪ prefer_direct on
  ◦ To deny caching, just keep it to proxy
    ▪ cache deny all
  ◦ To open support for more ports (say 1234)
    ▪ acl safe_ports port 1234

 Check correctness of squid.conf and apply changes
  #squid k parse

 Creating Swap directories for Squid Cache
  #squid -z

 Starting service
  #squid -Ncd1
  or
  #service squid restart
::Tools/Technology Used::

 Squid Cache-Proxy Server:
 BurpSuite Proxy Tool:



                                ::Inference::

 Squid can be used for multiple uses like Standard Proxy, Interception Proxy,
  Reverse Proxy, Cache Service, and even as a Load Balancer for Web Service
  running on that server.
 Its a great utility being developed from great time and still has great scope
  to be developed.
 Its just that its configuration styling is a bit buggy, sometimes shows weird
  results due to some self-unhanded issues.




                       ::Troubleshooting/Updates::

 Problem: The web-service we were supposed to proxy was generating
  HTTP Request to several other domain names registered to same
  organization and sometimes it's IP addresses. This re-occurred several
  times.
  Solution:
  So, I tried to figure out all the URLs involved in correct functioning of Web-
  Service by analyzing it's request using BurpSuite Proxy tool.
  But this results into just the URLs requested at that time. So, to be on more
  safer side I analyzed the source code of parts of service giving error and
  en-listed the remaining URLs.

 Problem: Configurations of Squid Box were copied onto a newer box for
  similar results, but it resulted in blocking of sites supposed to go via Proxy.
  Solution:
  Initially, it was really absurd as the same settings worked over other box.
  But, Squid is somewhat popular for such results so it wasn't a worry. We
  were just trying different tweaks not changing the meaning of it but stating
  same things in different manner.
  It resulted into a revelation that the behavior was specific to certain Query
  URLs, other were working fine. Now, it should have worked because even
  these URLs matched RegEx.
  Some more tweaking of settings made it worked when we explicitly added
the 'always_direct' line to it; now normally that shouldn't have mattered...
  but for Query based URLs it explicitly required that setting
  {no documentation found though}

  acl egurls url_regex .A.com .Z.com
  always_direct allow egurls
  never_direct deny egurls

 Requirement:
  Squid Proxy was connected to two ISPs via two Ethernet Cards, and we
  required to find a way of load-balancing between both service providers.
  Solution:
  Reading about it showed that load-balancing configuration provided by
  Squid is only for Parent Cache Proxies which is not based on Ethernet-Based
  load-balancing. We found Ethernet-Bonding with load-balancing module to
  implement the same. It has been discussed under one of the articles on this
  portal itself.

Contenu connexe

Tendances

Rails Caching Secrets from the Edge
Rails Caching Secrets from the EdgeRails Caching Secrets from the Edge
Rails Caching Secrets from the EdgeMichael May
 
[Hello world 오픈세미나]varnish로 웹서버성능 향상시키기
[Hello world 오픈세미나]varnish로 웹서버성능 향상시키기[Hello world 오픈세미나]varnish로 웹서버성능 향상시키기
[Hello world 오픈세미나]varnish로 웹서버성능 향상시키기NAVER D2
 
Apache Camel: Jetty Component With Example
Apache Camel: Jetty Component With ExampleApache Camel: Jetty Component With Example
Apache Camel: Jetty Component With ExampleAmit Aggarwal
 
Nginx A High Performance Load Balancer, Web Server & Reverse Proxy
Nginx A High Performance Load Balancer, Web Server & Reverse ProxyNginx A High Performance Load Balancer, Web Server & Reverse Proxy
Nginx A High Performance Load Balancer, Web Server & Reverse ProxyAmit Aggarwal
 
Apache Web Services
Apache Web ServicesApache Web Services
Apache Web Serviceslkurriger
 
Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...
Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...
Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...SaltStack
 
The top 5 Kubernetes metrics to monitor
The top 5 Kubernetes metrics to monitorThe top 5 Kubernetes metrics to monitor
The top 5 Kubernetes metrics to monitorSysdig
 
SaltConf14 - Oz Akan, Rackspace - Deploying OpenStack Marconi with SaltStack
SaltConf14 - Oz Akan, Rackspace - Deploying OpenStack Marconi with SaltStackSaltConf14 - Oz Akan, Rackspace - Deploying OpenStack Marconi with SaltStack
SaltConf14 - Oz Akan, Rackspace - Deploying OpenStack Marconi with SaltStackSaltStack
 
Learn nginx in 90mins
Learn nginx in 90minsLearn nginx in 90mins
Learn nginx in 90minsLarry Cai
 
[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법Open Source Consulting
 
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability EnvironmentsSaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability EnvironmentsSaltStack
 
Supercharging Content Delivery with Varnish
Supercharging Content Delivery with VarnishSupercharging Content Delivery with Varnish
Supercharging Content Delivery with VarnishSamantha Quiñones
 
Automating the Network
Automating the NetworkAutomating the Network
Automating the NetworkPuppet
 
High Performance Web Sites
High Performance Web SitesHigh Performance Web Sites
High Performance Web SitesRavi Raj
 
SaltStack Configuration Management
SaltStack Configuration ManagementSaltStack Configuration Management
SaltStack Configuration ManagementNathan Sickler
 

Tendances (20)

Rails Caching Secrets from the Edge
Rails Caching Secrets from the EdgeRails Caching Secrets from the Edge
Rails Caching Secrets from the Edge
 
[Hello world 오픈세미나]varnish로 웹서버성능 향상시키기
[Hello world 오픈세미나]varnish로 웹서버성능 향상시키기[Hello world 오픈세미나]varnish로 웹서버성능 향상시키기
[Hello world 오픈세미나]varnish로 웹서버성능 향상시키기
 
ReplacingSquidWithATS
ReplacingSquidWithATSReplacingSquidWithATS
ReplacingSquidWithATS
 
Apache Camel: Jetty Component With Example
Apache Camel: Jetty Component With ExampleApache Camel: Jetty Component With Example
Apache Camel: Jetty Component With Example
 
Nginx A High Performance Load Balancer, Web Server & Reverse Proxy
Nginx A High Performance Load Balancer, Web Server & Reverse ProxyNginx A High Performance Load Balancer, Web Server & Reverse Proxy
Nginx A High Performance Load Balancer, Web Server & Reverse Proxy
 
Apache Web Services
Apache Web ServicesApache Web Services
Apache Web Services
 
Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...
Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...
Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...
 
The top 5 Kubernetes metrics to monitor
The top 5 Kubernetes metrics to monitorThe top 5 Kubernetes metrics to monitor
The top 5 Kubernetes metrics to monitor
 
Tomcat ssl 設定
Tomcat ssl 設定Tomcat ssl 設定
Tomcat ssl 設定
 
Nginx dhruba mandal
Nginx dhruba mandalNginx dhruba mandal
Nginx dhruba mandal
 
SaltConf14 - Oz Akan, Rackspace - Deploying OpenStack Marconi with SaltStack
SaltConf14 - Oz Akan, Rackspace - Deploying OpenStack Marconi with SaltStackSaltConf14 - Oz Akan, Rackspace - Deploying OpenStack Marconi with SaltStack
SaltConf14 - Oz Akan, Rackspace - Deploying OpenStack Marconi with SaltStack
 
Learn nginx in 90mins
Learn nginx in 90minsLearn nginx in 90mins
Learn nginx in 90mins
 
Squid Server
Squid ServerSquid Server
Squid Server
 
[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법
 
Curl Tutorial
Curl Tutorial Curl Tutorial
Curl Tutorial
 
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability EnvironmentsSaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
 
Supercharging Content Delivery with Varnish
Supercharging Content Delivery with VarnishSupercharging Content Delivery with Varnish
Supercharging Content Delivery with Varnish
 
Automating the Network
Automating the NetworkAutomating the Network
Automating the Network
 
High Performance Web Sites
High Performance Web SitesHigh Performance Web Sites
High Performance Web Sites
 
SaltStack Configuration Management
SaltStack Configuration ManagementSaltStack Configuration Management
SaltStack Configuration Management
 

Similaire à Squid for Load-Balancing & Cache-Proxy ~ A techXpress Guide

Making Spinnaker Go @ Stitch Fix
Making Spinnaker Go @ Stitch FixMaking Spinnaker Go @ Stitch Fix
Making Spinnaker Go @ Stitch FixDiana Tkachenko
 
Using aphace-as-proxy-server
Using aphace-as-proxy-serverUsing aphace-as-proxy-server
Using aphace-as-proxy-serverHARRY CHAN PUTRA
 
Aeon mike guide transparent ssl filtering (1)
Aeon mike guide transparent ssl filtering (1)Aeon mike guide transparent ssl filtering (1)
Aeon mike guide transparent ssl filtering (1)Conrad Cruz
 
Aeon mike guide transparent ssl filtering
Aeon mike guide transparent ssl filteringAeon mike guide transparent ssl filtering
Aeon mike guide transparent ssl filteringConrad Cruz
 
Taming the Cloud Database with Apache jclouds, ApacheCon Europe 2014
Taming the Cloud Database with Apache jclouds, ApacheCon Europe 2014Taming the Cloud Database with Apache jclouds, ApacheCon Europe 2014
Taming the Cloud Database with Apache jclouds, ApacheCon Europe 2014zshoylev
 
The secret life of a dispatcher (Adobe CQ AEM)
The secret life of a dispatcher (Adobe CQ AEM)The secret life of a dispatcher (Adobe CQ AEM)
The secret life of a dispatcher (Adobe CQ AEM)Venugopal Gummadala
 
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...Ivanti
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with NginxBud Siddhisena
 
Docker Networking - Common Issues and Troubleshooting Techniques
Docker Networking - Common Issues and Troubleshooting TechniquesDocker Networking - Common Issues and Troubleshooting Techniques
Docker Networking - Common Issues and Troubleshooting TechniquesSreenivas Makam
 
Squid Caching for Web Content Accerlation
Squid Caching for Web Content AccerlationSquid Caching for Web Content Accerlation
Squid Caching for Web Content Accerlationrahul8590
 
Service Discovery using etcd, Consul and Kubernetes
Service Discovery using etcd, Consul and KubernetesService Discovery using etcd, Consul and Kubernetes
Service Discovery using etcd, Consul and KubernetesSreenivas Makam
 
JavaOne 2014: Taming the Cloud Database with jclouds
JavaOne 2014: Taming the Cloud Database with jcloudsJavaOne 2014: Taming the Cloud Database with jclouds
JavaOne 2014: Taming the Cloud Database with jcloudszshoylev
 
Writing & Using Web Services
Writing & Using Web ServicesWriting & Using Web Services
Writing & Using Web ServicesRajarshi Guha
 
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
[Devconf.cz][2017] Understanding OpenShift Security Context ConstraintsAlessandro Arrichiello
 
Как мы взломали распределенные системы конфигурационного управления
Как мы взломали распределенные системы конфигурационного управленияКак мы взломали распределенные системы конфигурационного управления
Как мы взломали распределенные системы конфигурационного управленияPositive Hack Days
 
Resilience Testing
Resilience Testing Resilience Testing
Resilience Testing Ran Levy
 
NGINX Can Do That? Test Drive Your Config File!
NGINX Can Do That? Test Drive Your Config File!NGINX Can Do That? Test Drive Your Config File!
NGINX Can Do That? Test Drive Your Config File!Jeff Anderson
 
Deploy Rails Application by Capistrano
Deploy Rails Application by CapistranoDeploy Rails Application by Capistrano
Deploy Rails Application by CapistranoTasawr Interactive
 
Kubernetes Networking
Kubernetes NetworkingKubernetes Networking
Kubernetes NetworkingCJ Cullen
 

Similaire à Squid for Load-Balancing & Cache-Proxy ~ A techXpress Guide (20)

Making Spinnaker Go @ Stitch Fix
Making Spinnaker Go @ Stitch FixMaking Spinnaker Go @ Stitch Fix
Making Spinnaker Go @ Stitch Fix
 
Using aphace-as-proxy-server
Using aphace-as-proxy-serverUsing aphace-as-proxy-server
Using aphace-as-proxy-server
 
Aeon mike guide transparent ssl filtering (1)
Aeon mike guide transparent ssl filtering (1)Aeon mike guide transparent ssl filtering (1)
Aeon mike guide transparent ssl filtering (1)
 
Aeon mike guide transparent ssl filtering
Aeon mike guide transparent ssl filteringAeon mike guide transparent ssl filtering
Aeon mike guide transparent ssl filtering
 
Taming the Cloud Database with Apache jclouds, ApacheCon Europe 2014
Taming the Cloud Database with Apache jclouds, ApacheCon Europe 2014Taming the Cloud Database with Apache jclouds, ApacheCon Europe 2014
Taming the Cloud Database with Apache jclouds, ApacheCon Europe 2014
 
The secret life of a dispatcher (Adobe CQ AEM)
The secret life of a dispatcher (Adobe CQ AEM)The secret life of a dispatcher (Adobe CQ AEM)
The secret life of a dispatcher (Adobe CQ AEM)
 
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
 
Proxy
ProxyProxy
Proxy
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with Nginx
 
Docker Networking - Common Issues and Troubleshooting Techniques
Docker Networking - Common Issues and Troubleshooting TechniquesDocker Networking - Common Issues and Troubleshooting Techniques
Docker Networking - Common Issues and Troubleshooting Techniques
 
Squid Caching for Web Content Accerlation
Squid Caching for Web Content AccerlationSquid Caching for Web Content Accerlation
Squid Caching for Web Content Accerlation
 
Service Discovery using etcd, Consul and Kubernetes
Service Discovery using etcd, Consul and KubernetesService Discovery using etcd, Consul and Kubernetes
Service Discovery using etcd, Consul and Kubernetes
 
JavaOne 2014: Taming the Cloud Database with jclouds
JavaOne 2014: Taming the Cloud Database with jcloudsJavaOne 2014: Taming the Cloud Database with jclouds
JavaOne 2014: Taming the Cloud Database with jclouds
 
Writing & Using Web Services
Writing & Using Web ServicesWriting & Using Web Services
Writing & Using Web Services
 
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
 
Как мы взломали распределенные системы конфигурационного управления
Как мы взломали распределенные системы конфигурационного управленияКак мы взломали распределенные системы конфигурационного управления
Как мы взломали распределенные системы конфигурационного управления
 
Resilience Testing
Resilience Testing Resilience Testing
Resilience Testing
 
NGINX Can Do That? Test Drive Your Config File!
NGINX Can Do That? Test Drive Your Config File!NGINX Can Do That? Test Drive Your Config File!
NGINX Can Do That? Test Drive Your Config File!
 
Deploy Rails Application by Capistrano
Deploy Rails Application by CapistranoDeploy Rails Application by Capistrano
Deploy Rails Application by Capistrano
 
Kubernetes Networking
Kubernetes NetworkingKubernetes Networking
Kubernetes Networking
 

Plus de Abhishek Kumar

Insecurity-In-Security version.2 (2011)
Insecurity-In-Security version.2 (2011)Insecurity-In-Security version.2 (2011)
Insecurity-In-Security version.2 (2011)Abhishek Kumar
 
Insecurity-In-Security version.1 (2010)
Insecurity-In-Security version.1 (2010)Insecurity-In-Security version.1 (2010)
Insecurity-In-Security version.1 (2010)Abhishek Kumar
 
xml-motor ~ What,Why,How
xml-motor ~ What,Why,Howxml-motor ~ What,Why,How
xml-motor ~ What,Why,HowAbhishek Kumar
 
Syslog Centralization Logging with Windows ~ A techXpress Guide
Syslog Centralization Logging with Windows ~ A techXpress GuideSyslog Centralization Logging with Windows ~ A techXpress Guide
Syslog Centralization Logging with Windows ~ A techXpress GuideAbhishek Kumar
 
Ethernet Bonding for Multiple NICs on Linux ~ A techXpress Guide
Ethernet Bonding for Multiple NICs on Linux ~ A techXpress GuideEthernet Bonding for Multiple NICs on Linux ~ A techXpress Guide
Ethernet Bonding for Multiple NICs on Linux ~ A techXpress GuideAbhishek Kumar
 
Solaris Zones (native & lxbranded) ~ A techXpress Guide
Solaris Zones (native & lxbranded) ~ A techXpress GuideSolaris Zones (native & lxbranded) ~ A techXpress Guide
Solaris Zones (native & lxbranded) ~ A techXpress GuideAbhishek Kumar
 
An Express Guide ~ "dummynet" for tweaking network latencies & bandwidth
An Express Guide ~ "dummynet" for tweaking network latencies & bandwidthAn Express Guide ~ "dummynet" for tweaking network latencies & bandwidth
An Express Guide ~ "dummynet" for tweaking network latencies & bandwidthAbhishek Kumar
 
An Express Guide ~ Zabbix for IT Monitoring
An Express Guide ~ Zabbix for IT Monitoring An Express Guide ~ Zabbix for IT Monitoring
An Express Guide ~ Zabbix for IT Monitoring Abhishek Kumar
 
An Express Guide ~ Cacti for IT Infrastructure Monitoring & Graphing
An Express Guide ~ Cacti for IT Infrastructure Monitoring & GraphingAn Express Guide ~ Cacti for IT Infrastructure Monitoring & Graphing
An Express Guide ~ Cacti for IT Infrastructure Monitoring & GraphingAbhishek Kumar
 
An Express Guide ~ SNMP for Secure Rremote Resource Monitoring
An Express Guide ~ SNMP for Secure Rremote Resource MonitoringAn Express Guide ~ SNMP for Secure Rremote Resource Monitoring
An Express Guide ~ SNMP for Secure Rremote Resource MonitoringAbhishek Kumar
 
Presentation on "XSS Defeating Concept in (secure)SiteHoster" : 'nullcon-2011'
Presentation on "XSS Defeating Concept in (secure)SiteHoster" : 'nullcon-2011'Presentation on "XSS Defeating Concept in (secure)SiteHoster" : 'nullcon-2011'
Presentation on "XSS Defeating Concept in (secure)SiteHoster" : 'nullcon-2011'Abhishek Kumar
 
XSS Defeating Concept - Part 2
XSS Defeating Concept - Part 2XSS Defeating Concept - Part 2
XSS Defeating Concept - Part 2Abhishek Kumar
 
XSS Defeating Trick ~=ABK=~ WhitePaper
XSS Defeating Trick ~=ABK=~ WhitePaperXSS Defeating Trick ~=ABK=~ WhitePaper
XSS Defeating Trick ~=ABK=~ WhitePaperAbhishek Kumar
 
FreeSWITCH on RedHat, Fedora, CentOS
FreeSWITCH on RedHat, Fedora, CentOSFreeSWITCH on RedHat, Fedora, CentOS
FreeSWITCH on RedHat, Fedora, CentOSAbhishek Kumar
 

Plus de Abhishek Kumar (17)

Insecurity-In-Security version.2 (2011)
Insecurity-In-Security version.2 (2011)Insecurity-In-Security version.2 (2011)
Insecurity-In-Security version.2 (2011)
 
Insecurity-In-Security version.1 (2010)
Insecurity-In-Security version.1 (2010)Insecurity-In-Security version.1 (2010)
Insecurity-In-Security version.1 (2010)
 
DevOps?!@
DevOps?!@DevOps?!@
DevOps?!@
 
xml-motor ~ What,Why,How
xml-motor ~ What,Why,Howxml-motor ~ What,Why,How
xml-motor ~ What,Why,How
 
XML-Motor
XML-MotorXML-Motor
XML-Motor
 
DevOps with Sec-ops
DevOps with Sec-opsDevOps with Sec-ops
DevOps with Sec-ops
 
Syslog Centralization Logging with Windows ~ A techXpress Guide
Syslog Centralization Logging with Windows ~ A techXpress GuideSyslog Centralization Logging with Windows ~ A techXpress Guide
Syslog Centralization Logging with Windows ~ A techXpress Guide
 
Ethernet Bonding for Multiple NICs on Linux ~ A techXpress Guide
Ethernet Bonding for Multiple NICs on Linux ~ A techXpress GuideEthernet Bonding for Multiple NICs on Linux ~ A techXpress Guide
Ethernet Bonding for Multiple NICs on Linux ~ A techXpress Guide
 
Solaris Zones (native & lxbranded) ~ A techXpress Guide
Solaris Zones (native & lxbranded) ~ A techXpress GuideSolaris Zones (native & lxbranded) ~ A techXpress Guide
Solaris Zones (native & lxbranded) ~ A techXpress Guide
 
An Express Guide ~ "dummynet" for tweaking network latencies & bandwidth
An Express Guide ~ "dummynet" for tweaking network latencies & bandwidthAn Express Guide ~ "dummynet" for tweaking network latencies & bandwidth
An Express Guide ~ "dummynet" for tweaking network latencies & bandwidth
 
An Express Guide ~ Zabbix for IT Monitoring
An Express Guide ~ Zabbix for IT Monitoring An Express Guide ~ Zabbix for IT Monitoring
An Express Guide ~ Zabbix for IT Monitoring
 
An Express Guide ~ Cacti for IT Infrastructure Monitoring & Graphing
An Express Guide ~ Cacti for IT Infrastructure Monitoring & GraphingAn Express Guide ~ Cacti for IT Infrastructure Monitoring & Graphing
An Express Guide ~ Cacti for IT Infrastructure Monitoring & Graphing
 
An Express Guide ~ SNMP for Secure Rremote Resource Monitoring
An Express Guide ~ SNMP for Secure Rremote Resource MonitoringAn Express Guide ~ SNMP for Secure Rremote Resource Monitoring
An Express Guide ~ SNMP for Secure Rremote Resource Monitoring
 
Presentation on "XSS Defeating Concept in (secure)SiteHoster" : 'nullcon-2011'
Presentation on "XSS Defeating Concept in (secure)SiteHoster" : 'nullcon-2011'Presentation on "XSS Defeating Concept in (secure)SiteHoster" : 'nullcon-2011'
Presentation on "XSS Defeating Concept in (secure)SiteHoster" : 'nullcon-2011'
 
XSS Defeating Concept - Part 2
XSS Defeating Concept - Part 2XSS Defeating Concept - Part 2
XSS Defeating Concept - Part 2
 
XSS Defeating Trick ~=ABK=~ WhitePaper
XSS Defeating Trick ~=ABK=~ WhitePaperXSS Defeating Trick ~=ABK=~ WhitePaper
XSS Defeating Trick ~=ABK=~ WhitePaper
 
FreeSWITCH on RedHat, Fedora, CentOS
FreeSWITCH on RedHat, Fedora, CentOSFreeSWITCH on RedHat, Fedora, CentOS
FreeSWITCH on RedHat, Fedora, CentOS
 

Squid for Load-Balancing & Cache-Proxy ~ A techXpress Guide

  • 1. Express-Guide ~to~ Basic Setup of Squid-cache Proxy Chaining by, ABK ~ http://www.twitter.com/aBionic ::Task Detail::  Setting up a secured Chained-Proxy between different offices using Squid for a specific URL set. ::Background:: Links: http://www.squid-cache.org/  Some background information about Squid Cache Proxy Server: ◦ its a high performance proxy caching server for web clients, supporting FTP, Gopher and HTTP data objects i.e. normally text-based protocols ◦ keeps metadata and hot-objects cached in RAM, supports non-block DNS and SSL ◦ it can be implemented as a Normal Proxy which needs to be configured at User's end or even as a Interception Proxy ::Execution Method::  Installing Squid was really easy, its available at YUM Repositories so use #yum -y install squid  Open 'squid.conf' file in an editor to edit squid's configuration {might find it at '/etc/squid/squid.conf' or '/usr/local/etc/squid/squid.conf'} ◦ NOTE: Remember, the settings here are interpreted as per their occurrence in file as a filter above another. So, if you block "A,B,C" first and then allows "C,D,E"; then C will remain blocked. So, to be on safer side Squid.Conf has a section defined for each configuration along-with its detail. For every line of configuration go in its section and then add it.
  • 2. ◦ Now the most basic setting required to edit is enabling access from clients for that just add settings as per following 2 lines ▪ following lines acl myClientNetwork src 192.168.0.0/16 http_access allow myClientNetwork ◦ Suppose you wanna set rules for URLs of "A.com" and "Z.com" domain ▪ make its ACL as acl egurls url_regex .A.com .Z.com ▪ Denying proxy of this URL set always_direct allow egurls never_direct deny egurls ▪ Allowing proxy of this URL set always_direct deny egurls ▪ Denying direct access of URLs if proxy not possible never_direct allow egurls ◦ Check if line with 'http_port' is ▪ http_port 3128 ◦ To stop caching queries ▪ acl Query urlpath_regex cgi-bin ? ▪ cache deny Query ◦ Setting a hostname for Proxy, just don't reveal any info ▪ visible_hostname ANYHOSTNAME ◦ To setup a Parent Squid Server to set Proxy Chaining ▪ cache_peer parent1IPorName parent 3128 0 no-query default ▪ cache_peer parent2IPorName parent 3128 0 no-query ◦ To provide sibling Squid Server for cache checks ▪ cache_peer parent2IPorName sibling 3128 3130 ◦ To setup Squid Proxy only for Fail-over, preferring direct connection otherwise ▪ prefer_direct on ◦ To deny caching, just keep it to proxy ▪ cache deny all ◦ To open support for more ports (say 1234) ▪ acl safe_ports port 1234  Check correctness of squid.conf and apply changes #squid k parse  Creating Swap directories for Squid Cache #squid -z  Starting service #squid -Ncd1 or #service squid restart
  • 3. ::Tools/Technology Used::  Squid Cache-Proxy Server:  BurpSuite Proxy Tool: ::Inference::  Squid can be used for multiple uses like Standard Proxy, Interception Proxy, Reverse Proxy, Cache Service, and even as a Load Balancer for Web Service running on that server.  Its a great utility being developed from great time and still has great scope to be developed.  Its just that its configuration styling is a bit buggy, sometimes shows weird results due to some self-unhanded issues. ::Troubleshooting/Updates::  Problem: The web-service we were supposed to proxy was generating HTTP Request to several other domain names registered to same organization and sometimes it's IP addresses. This re-occurred several times. Solution: So, I tried to figure out all the URLs involved in correct functioning of Web- Service by analyzing it's request using BurpSuite Proxy tool. But this results into just the URLs requested at that time. So, to be on more safer side I analyzed the source code of parts of service giving error and en-listed the remaining URLs.  Problem: Configurations of Squid Box were copied onto a newer box for similar results, but it resulted in blocking of sites supposed to go via Proxy. Solution: Initially, it was really absurd as the same settings worked over other box. But, Squid is somewhat popular for such results so it wasn't a worry. We were just trying different tweaks not changing the meaning of it but stating same things in different manner. It resulted into a revelation that the behavior was specific to certain Query URLs, other were working fine. Now, it should have worked because even these URLs matched RegEx. Some more tweaking of settings made it worked when we explicitly added
  • 4. the 'always_direct' line to it; now normally that shouldn't have mattered... but for Query based URLs it explicitly required that setting {no documentation found though} acl egurls url_regex .A.com .Z.com always_direct allow egurls never_direct deny egurls  Requirement: Squid Proxy was connected to two ISPs via two Ethernet Cards, and we required to find a way of load-balancing between both service providers. Solution: Reading about it showed that load-balancing configuration provided by Squid is only for Parent Cache Proxies which is not based on Ethernet-Based load-balancing. We found Ethernet-Bonding with load-balancing module to implement the same. It has been discussed under one of the articles on this portal itself.