I want to permit my users to login to Google apps only for my domain. I found a solution by adding the HTTP header X-GoogApps-Allowed-Domains
as described in this Google help page.
I use Squid, but can't figure out how to configure Squid to do this. How can I add this request header using Squid?
Do you can with new Squid 3.3 that support the command "request_header_add". I used CentOS for do it.
My Squid.conf is:
For SSL certificates, do you need to generate with openSSL:
And for users can't view errors in browsers, install this as a root trusted in each computer or add into your Active Directory (google may help for this).
As per the Squid FAQ:
In other words, you won't be able to add arbitrary request headers simply by using Squid ACLs. The Squid ACLs limit you to deleting existing headers or replacing existing headers, but don't allow addition of new headers. The only way to add new headers is by making use of an ICAP server together with Squid. For more information, see the ICAP section in the Squid FAQ.
Using squid, you will:
Apparently can be done with ICAP
Server: http://icap-server.sourceforge.net/irml.html
The client is in squid3: http://ftp.meisei-u.ac.jp/mirror/squid/squid-3.0-RELEASENOTES.html#ss4.1
Config from above: (squid.conf)
Then configure the server to determine whether to modify the header or not based on destination domain:
Profit? Can't figure out how to write the rules that would do this.. maybe you'll would have more luck.
So you can do this with a combination of a web proxy and an ICAP server. I'm most familiar with Squid Proxy & GreasySpoon for the ICAP. I am using Squid v3.2.1 & GreasySpoon 1.0.8.
Squid Configuration
Anyways, configure Squid to act as a standard cache. Here's a sample configuration. For more details on proper squid configuration, check out the extensive docs out there. The section you care about for this question is the
# ICAP Configurations
at the bottom.Note that the ICAP server I used was on the same host as the squid proxy so I used 127.0.0.1. If your proxy & ICAP are on different hosts then be sure to swap out the loopback for the other server's IP or server name.
ICAP Configuration
This is the easy part.
Again, I'm using the now defunct "Greasy Spoon" ICAP server. I found it to be very straight forward and did what I wanted with minimal headache. Also, while other options are available, I use the Java plugin capabilities.
For the case of GreasySpoon, I just created a small Java script (not javascript, although that is possible with many ICAP servers) that targets the HTTP request and added the needed header (Note the leading comments provide meta-data to the GS server. Probably not needed for others):
This adds the my-header header element into every request.
Using Squid to add a custom header is very difficult. I tried but failed, however I found another solution to block consumer account using following method:
In a small organisation I think Burp proxy is better and that is what we are currently using.
You will probably need to get a full-on commercial web filter for a job like this - unless you want to go fairly deep into rolling your own ICAP stuff like @Richard Keller appears to be suggesting. I work for Smoothwall who produce a filter which does the job - if it's really all you need it for (ie no other filtering) namecheck me with the sales guys and we can licence appropriately. In the interests of fairness there are competing products which also have this feature - youtube uses it too.