Snapd behind Socks proxy

Hello,

Is it possible to run snap behind a socks proxy.

I see how to use an http proxy, but socks proxy doesn’t seem to work.

Thank you
Lavrenti

Can you be more specific? Do you mean a snap application, eg. spotify or the snapd daemon and snap command that interacts with it?

I was talking of the snapd daemon and the snap command that interacts with it.

My all_proxy command is set up as such :
export all_proxy=socks5h://10.0.2.2:9999/
It works for many Linux tools (such as curl for example)

I need both the http/https calls to be proxified as well as the DNS calls (which are UDPs).

For the moment, I haven’t been able to use snap on my machine.

Thank you very much for your help !
Lavrenti

snapd supports whatever the go net/http client supports, see https://pkg.go.dev/net/http. Skimming the documentation, I don’t see any mention of all_proxy, so most likely it’s not used, however, you can set HTTP_PROXY and HTTPS_PROXY to socks5://<host>:<port>/ in snapd environment and give it a try.

I suggest you do systemctl edit snapd.service and then in the editor window paste this:

[Service]
Environment=HTTP_PROXY=socks5://...
Environment=HTTPS_PROXY=socks5://..

Next run systemctl restart snapd.service and try to install a snap.

Hello Maciej

Thank you for your response. But unfortunately, I tried and it doesn’t work.

It is possible that the protocol socks5:// is supported. But the protocol socks5h:// is not…

In my corporate environment, we don’t have a direct access to the DNS (for security reasons). All calls to the DNS server have to go through the proxy.

Would you see any other option for me ?

Thank you very much !
Lavrenti

I don’t think there’s any other solution available at the moment. Can you file a bug about missing socks5h support at https://bugs.launchpad.net/snapd/ ?

This is done : https://bugs.launchpad.net/snapd/+bug/1922051

Thank you very much !
Lavrenti

1 Like