# squid in a jail



## andrewm659 (Jun 2, 2016)

So I have squid (latest) running in a a jail, and I am able to use it communicate with it via the browser.  But I am trying to set it up so that I can use a proxy.pac file.  I have the proxy.pac configured.  Firefox is being used as my testbed.  When I switch over the pac file I get nothing in the logs.  Not sure why.  

Here is my squid.conf config.

```
root@proxy:/usr/local/etc/squid # cat squid.conf
#
# Recommended minimum configuration:
#

# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
acl localnet src 10.0.0.0/8    # RFC1918 possible internal network
acl localnet src 172.16.0.0/12    # RFC1918 possible internal network
acl localnet src 192.168.0.0/16    # RFC1918 possible internal network
acl localnet src fc00::/7       # RFC 4193 local private network range
acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines

acl SSL_ports port 443
acl Safe_ports port 80        # http
acl Safe_ports port 21        # ftp
acl Safe_ports port 443        # https
acl Safe_ports port 70        # gopher
acl Safe_ports port 210        # wais
acl Safe_ports port 1025-65535    # unregistered ports
acl Safe_ports port 280        # http-mgmt
acl Safe_ports port 488        # gss-http
acl Safe_ports port 591        # filemaker
acl Safe_ports port 777        # multiling http
acl CONNECT method CONNECT

acl our_networks src 10.150.1.0/24
#
# Recommended minimum Access Permission configuration:
#
# Deny requests to certain unsafe ports
http_access deny !Safe_ports

# Deny CONNECT to other than secure SSL ports
http_access deny CONNECT !SSL_ports

# Only allow cachemgr access from localhost
http_access allow localhost manager our_networks
http_access deny manager

# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on "localhost" is a local user
#http_access deny to_localhost

#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#

# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
http_access allow localhost

# And finally deny all other access to this proxy
http_access deny all

# Squid normally listens to port 3128
http_port 3128

# Uncomment and adjust the following to add a disk cache directory.
#cache_dir ufs /var/squid/cache 100 16 256

# Leave coredumps in the first cache dir
coredump_dir /var/squid/cache

#
# Add any of your own refresh_pattern entries above these.
#
refresh_pattern ^ftp:        1440    20%    10080
refresh_pattern ^gopher:    1440    0%    1440
refresh_pattern -i (/cgi-bin/|\?) 0    0%    0
refresh_pattern .        0    20%    4320

visible_hostname proxy01.borg.local

access_log /var/log/squid/access.log squid
#logformat custom %{%Y-%m-%d %H:%M:%S}tl %03tu %>a %tr %ul %ui %>Hs %mt %rm %ru %rv %st %Sh %Ss
logformat squid %tl %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt
client_db on
dns_defnames on
httpd_suppress_version_string on
retry_on_error on
uri_whitespace strip
strip_query_terms off
#pipeline_prefetch on

cache deny all
#cache_dir null /tmp
ident_lookup_access deny all

## disable ads ( [URL]http://pgl.yoyo.org/adservers/[/URL] )
acl adsites url_regex -i "/usr/local/etc/squid/ad_block.txt"
http_access deny adsites
deny_info [URL]http://proxy.borg.local/blocked.html[/URL] adsites
root@proxy:/usr/local/etc/squid # 

Proxy.pac

function FindProxyForURL(url, host) {
    //Don't proxy connections to the UTM web interface
    if (shExpMatch(url, "[URL]https://${asg_hostname}*[/URL]")) return "DIRECT";
    if (shExpMatch(url, "https://" + dnsResolve(host) + "*")) return "DIRECT";
    //Exclude non-fqdn hosts from being proxied
    if (isPlainHostName(host)) return "DIRECT";
    //Don't proxy connections to the exempted URL matches
    if (shExpMatch(url, "*borg.local*")) return "DIRECT";
   if (isInNet(myIpAddress(), "10.150.0.0", "255.255.0.0"))        {return "PROXY proxy.borg.local:3128" ;}

    return "DIRECT";
}
```


----------

