Difference between revisions of "Cool Solution - Squid as Reverse SSL Proxy"

From Univention Wiki

Jump to: navigation, search
(Reverted revert. Updated to 4.3)
(moved to help-u)
Tag: Replaced
 
Line 1: Line 1:
{{Version|UCS=4.3}}
+
This page has been moved to the Knowledge Base Cool Solutions in the Forum.
{{Cool Solutions Disclaimer|Repository=no}}
 
{{#seo:
 
|title={{#replace:{{#replace:{{#replace:{{#replace:{{FULLPAGENAME}}|'|'}}|&|&}}|"|"}}|Cool Solution - |}} - {{SITENAME}}
 
<!--|description=-->
 
}}
 
  
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.
+
[https://help.univention.com/t/cool-solution-squid-as-reverse-ssl-proxy/14714 Cool Solution - Squid as Reverse SSL Proxy]
 
 
== Requirements  ==
 
 
 
To install Squid3 for UCS 4, execute the following command:  
 
 
 
univention-app install squid
 
 
 
In addition you need the private key and the public certificate from the squid server (/etc/univention/ssl/...). 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 (&lt;) and a greater-than sign (&gt;) must be replaced with your own values. Less-than sign (&lt;) and greater-than sign (&gt;) must be replaced as well.
 
 
 
''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"
 
 
 
<br>
 
 
 
== Configure Squid  ==
 
 
 
Afterwards, the local configuration file ''/etc/squid/local_bottom.conf'' must be edited.
 
 
 
If there is already a configuration in this file, you should make a backup of that:
 
 
 
cp /etc/squid/local_bottom.conf /etc/squid/local_bottom.conf.backup
 
 
 
To configure your reverse SSL proxy, add the following lines to your configuration.
 
 
 
#reverse SSL proxy
 
https_port 443 cert=/path/to/cert.pem key=/path/to/private.key accel defaultsite=&lt;FQDN of DSTHOST&gt; vhost
 
cache_peer &lt;IP of DSTHOST&gt; parent 443 0 no-query proxy-only originserver ssl sslflags=DONT_VERIFY_PEER name=''myHost''
 
 
 
The given name is needed below again, if custom ACLs are to be created (optional)
 
 
 
=== 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. This is possible with UCR or via manually editing the config file. The latter is only needed when the network MUST have a certain name.
 
 
 
To grant access to a whole network, you can use the UCR variable squid/allowfrom. Multiple networks can be separated with spaces.
 
 
 
ucr set squid/allowfrom='<NETWORK>/<CIDR NETWORK MASK>'
 
 
 
So, if we'd want to allow IPs from the network 192.168.0.0/24, the command would look as follows:
 
 
ucr set squid/allowfrom='192.168.0.0/24'
 
 
 
The network will be named dynamically, starting with 'localnet1'.
 
 
 
'''Note:''' The rules for ''cache_peer_access'' and the rules for your reverse SSL proxy (''https_port'', ''cache_peer'') have to be made directly in the local config.
 
 
 
Alternatively, for example if you need to give the network a certain name, you can apply this configuration manually in your local_bottom.conf with these lines (this is completely optional):
 
 
 
...
 
 
acl ''myNetwork'' src <NETWORK>/<CIDR NETWORK MASK>
 
 
#########
 
# rules #
 
#########
 
...
 
 
 
Additionally, the rules for our newly created ACL would have to be defined
 
 
 
...
 
 
http_access allow ''myNetwork''
 
cache_peer_access ''myHost'' allow ''myNetwork''
 
 
# deny the rest
 
http_access deny all
 
http_reply_access allow all
 
icp_access allow all
 
...
 
 
 
Since Squid3 is a mighty product, we can't cover all cases you may want to define here. Please refer to the official documentation linked in the ''Further Information'' section.
 
 
 
After your changes have been saved, squid3 needs to be restarted:
 
 
 
service squid restart
 
 
 
Afterwards your reverse proxy should be working.
 
 
 
== Further Information  ==
 
 
 
http://www.squid-cache.org/Doc/config/
 
 
 
== Archive ==
 
* There is a version of this article for [https://wiki.univention.de/index.php?title=Cool_Solution_-_Squid_as_Reverse_SSL_Proxy&oldid=13920 UCS 4.2].
 
* There is a version of this article for [https://wiki.univention.de/index.php?title=Cool_Solution_-_Squid_as_Reverse_SSL_Proxy&oldid=13920 UCS 4.1].
 
 
 
[[Category:EN]]
 

Latest revision as of 09:48, 9 July 2020

This page has been moved to the Knowledge Base Cool Solutions in the Forum.

Cool Solution - Squid as Reverse SSL Proxy

Personal tools