December 2015

HOW TO : Enable wildcard domains in Squid

We were trying to modify some ACL (access control lists) in squid to allow traffic to certain websites. Instead of adding each individual hostnames in a domain, we wanted to add all traffic to a certain domain.

Document on the interwebs is old or not clear on how to achieve this.

After some trial and error, here is what works

say you want to allow all traffic to the google.com domain, you create a access list using dstdomain like below

acl name_of_acl dstdomain .google.com

The “.” before the domain name acts as a wildcard

Then you use the acl to allow http access to it like below

http_access allow name_of_acl

HOW TO : pipe results between commands when using sudo

Let’s say you are running a command as sudo and need to pass the output to a different command using pipe, you would run

sudo command1 | command 2

this usually results in the following error

-bash: /command2: Permission denied

The trick to fix is to run sudo with -c and enclose the commands in ” like below

sudo -c 'command1 | command 2'

essentially you are opening a shell with sudo and running the commands