[2.3.1] snapd proxy settings are not set on deployed machines or containers
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Canonical Juju |
Fix Released
|
Medium
|
Unassigned |
Bug Description
Currently Juju doesn't propagate proxy settings for snapd from model-config to either hosts or LXD containers.
It is quite easy to do so though:
sudo mkdir -p /etc/systemd/
sudo cat <<EOF | sudo tee -a /etc/systemd/
[Service]
Environment=
Environment=
EOF
sudo systemctl daemon-reload
sudo systemctl restart snapd # <- mandatory
https:/
https:/
Seems to me snapd reacts to environment variables just because of how golang runtime handles that:
https:/
snapd *MUST* be restarted though after proxy.conf is created as naturally there is no sane way to "reload" environment variables and make a process react to that without some effort on the process side itself.
Note that this is not about using core snap to set proxy settings - initially you have **no snaps at all** which means you cannot use a core snap to set some settings. `snap install core` will obviously fail at this point so this is not interesting https:/
/etc/environment isn't good for this too because no_proxy variable has to be populated with a list of ip addresses and hostnames which becomes quite large if you use a /24 or a /16 network (a /16 would even cause your programs to run out of stack memory due to an 8MiB RLIMIT_STACK default).
pam_env has certain limits which is why we should not use this file:
https:/
/* No unexpanded variable can be bigger than BUF_SIZE */
char type, tmpval[BUF_SIZE];
How private snap stores would fit into that should be evaluated but my primary concern is proxy settings for this bug.
Changed in juju: | |
status: | New → Triaged |
importance: | Undecided → Medium |
Changed in juju: | |
status: | Triaged → Fix Released |
Also adding snapd project here because if there is no core snap at the beginning then we cannot set anything, including proxy settings or snap store settings (proxy.store):
https:/ /github. com/snapcore/ snapd/blob/ release/ 2.30/corecfg/ proxy.go# L78-L96
"No core snap" condition can be easily validated by launching a container:
lxc launch ubuntu:xenial snapdtest ; lxc exec snapdtest snap list
Creating snapdtest
Starting snapdtest
No snaps are installed yet. Try "snap install hello-world".