Introduction
All good plugins for bypassing locks like the popular friGate, but they have one drawback - they like to embed their
ads and, in the long run, keep track of everything you do on the Internet.
VPN has its drawbacks: either all traffic will go through a remote server, or it will be necessary to set up complex routing rules.
')
Ssh-tunnel on a constantly falling asleep and waking up laptop has to be restarted each time.
There are solutions like autossh, but they will not satisfy the real perfectionist.
Let's try to achieve convenience similar to friGate using services that are completely under our control.
We will need: a dedicated server with Linux / FreeBSD (I used Ubuntu), a domain, letsencrypt, squid and a bit of magic PAC-files.
Domain you can take a free 3rd level from your hoster or here:
freedomain.co.nr ,
registry.cu.cc .
Squid supports an
encrypted connection to the browser - exactly what you need for such a case.
This opportunity is for some reason practically unknown to the general public, therefore this post has appeared.
Installing Squid with SSL support
In Ubuntu, squid is compiled without supporting the keys we need (--enable-ssl)
If you have a different distribution and everything is fine with this (you can check it by running the command squid3 -v | grep -E --color "(ssl | tls)") - immediately go to the next item.
And we will build our own package for Ubuntu (
this instruction is used):
sudo apt-get install devscripts build-essential fakeroot libssl-dev apt-get source squid3 sudo apt-get build-dep squid3
apply the following patches:
engSquid Proxy needs to be adjusted too (src / ssl / gadgets.cc). Firefox error sec_error_inadequate_key_usage this usually occurs when you prevent HTTPS filtering with the latest Firefox browsers. If you use Google Chrome, Microsoft Internet Explorer or Apple Safari this step is not required.
We assemble and install:
cd squid3-3.3.8 && dpkg-buildpackage -rfakeroot -b sudo apt-get install squid-langpack sudo dpkg -i ../squid-common*.deb ../squid_*.deb
Acquiring a signed certificate using letsencrypt.org
Download scripts:
git clone https://github.com/letsencrypt/letsencrypt cd letsencrypt ./letsencrypt-auto --help
If you already have a webserver running, stop it, because the letsencrypt script will launch its.
In the case of harsh production, you can verify domain control without stopping the web server, see the
documentation .
We get a certificate:
./letsencrypt-auto --authenticator standalone --installer apache -d <_.>
If successful, pem-files can be found in the / etc / letsencrypt / live / <our domain> / directory
Squid setup
Config - default, we add only the https_port option
https_port 3129 cert=/etc/letsencrypt/live/example.com/fullchain.pem key=/etc/letsencrypt/live/example.com/privkey.pem
Optional - acl for access only from certain ip or
by password .
for example
acl mynet src <__ip>/32
http_access allow mynet
We start squid
sudo /etc/init.d/squid3 start
We learn browser encrypted connections with proxy
As
stated in the Squid documentation , it is possible to configure an https connection to a proxy server in Firefox and Chrome recently, but only using a PAC file.
PAC file switch line switch. GUI configuration appears not to be possible (yet).
...
Firefox 33.0 Browser PAC file. GUI configuration appears not to be possible (yet).
PAC (Proxy Auto Configuration) is a javascript file that is executed by the browser in order to determine the proxy for each request.
I used the following code:
Addresses in the list of hosts are taken for the test, dilute them with the ones you need;)
We connect the file in the appropriate field of the browser settings (Preferences -> Advanced -> Network -> Settings), check how our external address on myip.ru now looks, we enjoy stable work.
In this case, the traffic goes directly to all hosts, except those specified in the hosts line.
This pac-file can be put on a web server, connected via http and changes in it will automatically pull up on all hosts, for example, on a laptop, desktop and
even a smartphone .
You can also use
foxyproxy to filter hosts that need to work through a proxy in combination with a simpler PAC file — then you can edit this list directly in the browser.
Conclusion
The topic was written in hot pursuit solely to demonstrate the concept of an encrypted tunnel in a browser without using VPN / ssh / third-party extensions.