squid

27/07/2017

installer

apt-get install squid

service squid restart

autoriser ip:

emacs /etc/squid/squid.conf

avant cette ligne :

http_access deny all

mettre :

acl allowed_ips src 82.224.239.198
http_access allow allowed_ips

autoriser par mdp

htpasswd -cb /etc/squid/htpasswd raf XXXXXX
chmod o+r /etc/squid/htpasswd

emacs /etc/squid/squid.conf
auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/htpasswd
auth_param basic children 5 startup=5 idle=1
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive off
acl ncsa_users proxy_auth REQUIRED
http_access allow ncsa_users

access par ip OU mdp

http_access allow allowed_ips
http_access allow ncsa_users

autoriser tout le monde

acl all src 0.0.0.0/0
http_access allow all

proxy anonyme :

forwarded_for = delete
request_header_access Allow allow all
request_header_access Authorization allow all
request_header_access WWW-Authenticate allow all
request_header_access Proxy-Authorization allow all
request_header_access Proxy-Authenticate allow all
request_header_access Cache-Control allow all
request_header_access Content-Encoding allow all
request_header_access Content-Length allow all
request_header_access Content-Type allow all
request_header_access Date allow all
request_header_access Expires allow all
request_header_access Host allow all
request_header_access If-Modified-Since allow all
request_header_access Last-Modified allow all
request_header_access Location allow all
request_header_access Pragma allow all
request_header_access Accept allow all
request_header_access Accept-Charset allow all
request_header_access Accept-Encoding allow all
request_header_access Accept-Language allow all
request_header_access Content-Language allow all
request_header_access Mime-Version allow all
request_header_access Retry-After allow all
request_header_access Title allow all
request_header_access Connection allow all
request_header_access Proxy-Connection allow all
request_header_access User-Agent allow all
request_header_access Cookie allow all
request_header_access All deny all

PROXY.PAC

emacs .htaccess
AddType application/x-ns-proxy-autoconfig pac

emacs proxy.pac
function FindProxyForURL(url, host) {
         if ((shExpMatch(host, "localhost")) ||
             (shExpMatch(host, "*.local")) ||
             (host == "127.0.0.1")) {
                return "DIRECT";
        }

        if (isInNet(host, "127.0.0.1", "255.255.255.0"))
        {
                return "DIRECT";
        }

        return "PROXY 46.105.126.96:3128";
}

tester le proxy

curl -x http://user:password@2i.raphaelpiccolo.com:3128 https://whoami.raphaelpiccolo.com
http_proxy=http://user:password@2i.raphaelpiccolo.com:3128 curl https://whoami.raphaelpiccolo.com