You want to be able to configure your proxy client settings with the terminal but don’t know how…
I use a couple of different proxy servers I’ve created with docker and I can (de)activate them through the
command line at will. The trouble came when I tried to do the same with the proxy client settings as shown in the screen shot.
Normally on linux machines you can just set environment variables like
https_proxy but it
seems to go a bit different on a Synology NAS.
So I was able to start and stop the docker proxies easily on my iPhone with a simple ssh app but not the proxy client of Synology itself.
Finally I got tired of it and dug my heels in and did some reverse engineering :-)
Do it with the
There is an
/etc/proxy.conf file where DSM saves its data to be retrieved when needed, but when I tried
to just edit that file and change some values DSM did not pick it up, hmmm not what I wanted.
Ok lets do it through the web interface and use the developers view to see the network traffic…
Yup that seemed to work and that resulted in the script below.
Note that I have my
~/bin folder always on my PATH
When I saved the above script in
set-proxy and ran it without params
the result was something like:
Use localhost with port 3128 and enable it
disable the proxy:
Use some other host on port 92000 and enable it
Note that you can add true but as it is the default you can drop it too.
I did quite a few tests with this and it seems to work just fine.
With the following command you can see your current external ip address
Start with the above command to see what your IP is before setting a proxy and then start the proxy and try again…
An example test was to run my
ivonet/nordvpn-tor-provoxy docker image on port 8118 and to set-proxy to it and then do
the curl as described above.
It all worked just as hoped.
Well my goal to be able to configure the proxy client through a cli interface has worked.
The commands need to be executed as root (sudo) and that makes scripting it a bit more difficult but not
insurmountable as I have already written a blog about how to Run A Script As root Without sudo
If you have questions of comments leave them below.
They are always welcome.