Cool Solution - Squid as Reverse SSL Proxy
From Univention Wiki
Note: Cool Solutions are articles documenting additional functionality based on Univention products.
Not all of the shown steps in the article are covered by Univention Support. For questions about your support coverage contact your contact person at Univention before you want to implement one of the shown steps.
This article describes how to configure Squid3 as a reverse proxy with HTTPS and SSL support. This allows to proxy your secured application without exposing your Webserver to the outside or to loadbalance between multiple SSL Servers.
Contents
Requirements
To install Squid3 for UCS 3.2, execute the following command:
univention-install univention-squid
In addition you need the private key and the public certificate from the server you want to tunnel to. In the following we refer to the certificate as cert.pem,to the key as private.key and to the server you want to tunnel to as DSTHOST.
Note: Everything within a less-than sign (<) and a greater-than sign (>) must be replaced with your own values.
Note: Everything that is written cursive in the code boxes is a variable value and may be changed to own use.
Pre-Configuration
At first, the Apache Server must be stopped and disabled within its UCR variable. This is necessary to free the HTTPS port for Squid3
service apache2 stop ucr set apache2/autostart="no"
Configure Squid
Afterwards the template file /etc/univention/templates/files/etc/squid3/squid.conf must be edited.
To configure your reverse SSL proxy, add the lines below # reverse proxy to your configuration. A good placement for it is at the top of your configuration file (e.g. below # debug options).
# debug options ... # reverse proxy https_port 443 cert=/path/to/cert.pem key=/path/to/private.key defaultsite=<FQDN of DSTHOST> vhost cache_peer <IP of DSTHOST> parent 443 0 no-query proxy-only originserver ssl sslflags=DONT_VERIFY_PEER name=myHost
Remember the name you've given here, we need it later to configure the ACLs
Configure ACLs
After the reverse proxy is configured, the next step is to configure ACLs to define who is able to access your site and who is not. At first, we define an ACL for a network. A few ACLs are already defined in your configuration. To keep the configuration file human readable, we stick to the schema and add our changes into the correct sections.
To grand access to a whole network, add the following line to your config
######### # acl's # ######### ... acl myNetwork src <Network adress>/<Netmask>
Afterwards, the rules for our new created ACL have to be defined
######### # rules # ######### ... http_access allow myNetwork cache_peer_access myHost allow myNetwork
Since Squid3 is a mighty product, we can't cover all cases you may want to define here. Please refer to the offical documentation in the Further Information section.
After your changes have been saved, your Squid3 configuration file needs to be commited and the Squid3 needs to be restarted.
ucr commit /etc/squid3/squid.conf serice squid3 restart
Afterwards your revers Proxy should be working.