You have been subscribed to a public bug:

Setting proxy settings via the core snap does not have any effect.

sudo snap set core proxy.http=http://192.0.2.2:3128
sudo snap set core proxy.https=http://192.0.2.2:3128


Although I wouldn't want my global /etc/environment to be modified by snapd in 
any case but it is not modified:

cat /etc/environment 
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
TESTVAR="testval"

When I go to my proxy server and check the logs there is nothing in
them.

Looking at the implementation, the core snap proxy configuration handler
only tries to update the global /etc/environment file - not the default
HTTP transport used for snapd cases.

https://github.com/snapcore/snapd/blob/2.35.1/overlord/configstate/configcore/proxy.go#L72-L94

The default http transport is updated based on environment settings:

https://github.com/snapcore/snapd/blob/2.35.1/httputil/transport17.go#L33-L43
func newDefaultTransport() *http.Transport {
        // based on 
https://github.com/golang/go/blob/release-branch.go1.7/src/net/http/transport.go#L38
        return &http.Transport{
                Proxy:                 http.ProxyFromEnvironment,

https://golang.org/pkg/net/http/#ProxyFromEnvironment

Since those settings are not there, snapd doesn't use the proxy
specified.

Instead, snapd needs to (thread-safely) set HTTP_PROXY, HTTPS_PROXY and
NO_PROXY values in-memory based on core snap settings instead of trying
to modify /etc/environment. For this to take effect connections to the
snap store need to use new http.Transport objects every time they need
to access it or react to in-memory environment variable changes.

apt policy snapd
snapd:
  Installed: 2.34.2+18.04
  Candidate: 2.34.2+18.04
  Version table:
 *** 2.34.2+18.04 500
        500 http://ru.archive.ubuntu.com/ubuntu bionic-updates/main amd64 
Packages
        100 /var/lib/dpkg/status
     2.32.5+18.04 500
        500 http://ru.archive.ubuntu.com/ubuntu bionic/main amd64 Packages

** Affects: snapd (Ubuntu)
     Importance: Undecided
         Status: Fix Released


** Tags: cpe-onsite
-- 
snapd ignores proxy settings set via core snap
https://bugs.launchpad.net/bugs/1791587
You received this bug notification because you are a member of Ubuntu Bugs, 
which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to