brew install stunnel
brew install socat
Your stunnel
config file in client (/etc/stunnel/stunnel.conf
, /usr/local/etc/stunnel/stunnel.conf
) :
client = yes
foreground = yes
debug = debug
[proxy]
accept = <stunnel-local-port-to-listen>
connect = <stunnel-server-ip>:<stunnel-server-port>
cert = <absolute-path-to-stunnel-cert.pem>
git config --global http.proxy http://127.0.01:<stunnel-local-port-to-listen>
git config --global https.proxy http://127.0.0.1:<stunnel-local-port-to-listen>
& through SSH
# used like : git clone git@github-special-user:user-or-org/repo.git
Host github-special-user
HostName github.com
User git
proxycommand socat - PROXY:127.0.01:%h:%p,proxyport=<stunnel-local-port-to-listen>
IdentityFile <path-to-private-key>
IdentitiesOnly yes
Host github.com
HostName github.com
User git
proxycommand socat - PROXY:127.0.01:%h:%p,proxyport=<stunnel-local-port-to-listen>
IdentityFile <path-to-private-key>
IdentitiesOnly yes
Docker Desktop provide this in a easy way; just open the Preferences
of Docker Desktop, then you can find it at RESOURCES
/PROXIES
from (here)[https://cloud.google.com/sdk/docs/proxy-settings]
gcloud config set proxy/type http
gcloud config set proxy/address 127.0.0.1
gcloud config set proxy/port <stunnel-local-port-to-listen>
open -a "Google Chrome" --args --proxy-server=http://127.0.0.1:<stunnel-local-port-to-listen>
What I did:
$ cd /Applications/Google Chrome.app/Contents/MacOS
$ mv "Google Chrome" GoogleChrome-Main
$ cat > Google\ Chrome
#! /bin/sh
/Applications/Google\ Chrome.app/Contents/MacOS/GoogleChrome-Main --proxy-server=http://127.0.0.1:<stunnel-local-port-to-listen>
$ chmod +x Google\ Chrome
In Preferences
you can find Proxy
page/section.
By the config params that we have set for stunnel, it's not going to be run in background. It needs to be run in foreground
and it makes it more explicit. Non of the configured software could not connect to anyplace till you, explicitly run stunnel. Also in this way you can test all your configs by running your application when stunnel is running ro not, and see logs when it's running.
Nice.