-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle new juju charm proxy settings and https keyserver URLs (#248)
Handle new juju charm proxy settings and https keyserver URLs This change reworks proxy server handling for add-apt-repository and key retrieval cases and introduces support for new juju-prefixed proxy setting environment variables that do not modify the http(s) connections made from hook execution environments by charm code or forked and execve-ed applications that were given environment variables of a parent process. The new proxy settings are available as of Juju 2.4.0 but are properly applied as of Juju 2.4.2 (see lp:1782236). add-apt-repository comes from the software-properties package and only reacts to HTTP_PROXY and HTTPS_PROXY environment variables as of bionic when it was switched to using curl (lp:1433761) and HTTPS-based Ubuntu keyserver URLs. For Xenial and other releases older than Bionic it is necessary to use charm options specifying GPG keys in the radix format AND source URLs in the following formats to avoid triggering the add-apt-repository behavior related to GPG keys for ppa shortcuts: deb [arch=<arches-csv] uri distribution [component1] [component2] [...] See lp:1433761 and https://git.launchpad.net/ubuntu/+source/software-properties/commit/?id=f57935235ca0f52b32da7efe2a24cb26c7fc4573 A manpage for apt-key mentions the following in a section about the "add" command: "Note: Instead of using this command a keyring should be placed directly in the /etc/apt/trusted.gpg.d/ directory with a descriptive name and either "gpg" or "asc" as file extension." The support for /etc/apt/trusted.gpg.d/ goes back to 2010: https://salsa.debian.org/nathanruiz-guest/apt/commit/c24f6ce22cd6720004addad2e3382b3caa6b1b7c Using "asc" in this directory is only supported as of apt 1.4. https://salsa.debian.org/nathanruiz-guest/apt/commit/f77ea8235cafb258d1cb0b2b90e95aa36e5c4650 https://salsa.debian.org/nathanruiz-guest/apt/commit/2906182db398419a9c59a928b7ae73cf7c7aa307 Binary GPG format is used in this change given that trusty uses 1.0.1, xenial uses 1.2.x and only bionic has 1.6.x. This requires de-armoring of ASCII armor-formatted GPG keys downloaded from the Ubuntu keyserver. apt-key usage is completely removed by this change. HTTPS is used for key retrieval with this change which is a functional change to a more secure way of retrieving GPG keys. A subset of charms using PPAs will be affected by that. Since HTTPS is used, if SSLBump-like HTTPS proxies are in place, they will impersonate keyserver.ubuntu.com and generate a certificate with keyserver.ubuntu.com in the CN field or in SubjAltName fields of a certificate. If such proxy behavior is expected it is necessary to add the CA certificate chain containing the intermediate CA of the SSLBump proxy to every machine that this code runs on via ca-certs cloud-init directive (via cloudinit-userdata model-config) or via other means (such as through a custom charm option). curl relies on openssl provided by the distribution which means it is affected by the system trusted certificate store. Also note that DNS resolution for the hostname in a URL is done at a proxy server - not at the client side.
- Loading branch information
Showing
5 changed files
with
737 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.