-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use only locally available GPG keys #757
Comments
For dnf, we do explicitly warn when we're not using gpg checking. We can't really rely only on local keys by default since local gpg keys can only be relied on to be available if we're building the same distro as the host distro. I'm open to dropping the fallback that disables gpg checking though. Or we add it behind an option so that it's opt-in and not used by default |
A warning is in practise probably useless,... in automatic deployments no one notices them anyway,.. and even if, possible rogue packages would have already been installed. As for keys, as said, the best would be if mkosi would ship them, or if there was some bundle that collects the keys of all major distros and that mkosi depends upon. The best would IMO be an option that enables fallbacks,... and per default it should only use locally available keys. |
We got rid of the fallback to no GPG checks if the url is unavailable, but we're going to keep using the urls. Happy to switch to using local keys as soon as there's a package in all distributions that ships the keys of all the rpm based distros. |
Hey @DaanDeMeyer. Do you happen to know the commit where this was changed? Also, what do you mean by "keep using the URLs"? That If so, may I then kindly ask to keep this issue open until some solution is found that gives really strong security per default? As outlaid above, https/TLS has the practical problem that people typically trust the browser bundle of CAs... which in turn poses a rather big attack surface. All that seems much weaker to me, than the security provided afterwards by some OpenPGP keys/signatures,... and since an attacker would typically focus on the weakest element of the chain, that quite jeopardises the strong security provided by the repos themselves (via OpenPGP). So please either re-open, or advise me to make another feature request for that. |
Oh and btw:... I think I recently read on phoronix or so, that Fedora plans on replacing dracut via something mkosi based? If so, it would IMO warrant even more for strong (that is: already trusted OpenPGP keys) security requirements unless some And as for:
I think that would definitely make sense... even more so, if such registry could contain keys for all well known distros (and not just rpm based). Not sure though, where such registry should be placed ... I mean it would need to be some organisation which a) can get the keys in some trusted manner and b) is itself credibly enough so that others would use them as source. |
For Debian/Ubuntu and Arch, packages already exist and are widely packaged and we depend on those. For rpm based distros, there's https://github.com/xsuchy/distribution-gpg-keys but it's not packaged on Debian/Ubuntu or Arch so we cannot depend on it. The change to make urls non-optional was in f360165. I am happy to switch to using disk based locations only, but I need distribution-gpg-keys to be packaged across all distros to make that a viable option. Will reopen until someone can make that happen. |
There's already an ITP in Debian (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1026087), though no progress for a while. But anyway... I personally would think, that Having a package like A user, whose distro doesn't provide it, could still manually fetch it from github (and be still comparably secure[0] than with using https). [0] A number of factors are IMO relevant here:
|
Oh and btw: |
Since #1949 we use local GPG keys for Fedora, CentOS, Alma and Rocky if the distribution-gpg-keys package is installed. |
Since we now use local keys when available for most distributions, let's close this as completed. Please open separate RFEs and PRs for the other distributions where you'd also like to see this happen. Note that we're unlikely to drop support for downloading the keys as a fallback. Yes CA's might be unsafe, but if you care about that then it's on you to make sure the keys are available locally at the correct location so we can pick them up from there. |
Hey @DaanDeMeyer
Well... it's the same as I've said before: What should be done, and what this request was about is: that it never uses packages/code, for which keys (and not just some TLS certs) haven't been installed (via some trusted way, not by downloading it). If you now say "when available" and "for most distributions", it sounds like something else might be done when not available… and/or not for all distributions.
Fine, but why not make the default safe and and add an option Sure I can file a new bug, but it would be basically the same request... not sure if that makes sense. |
@calestyo You might want to chime in on openSUSE/zypper#528 as well with regards to this issue. |
@DaanDeMeyer Well I don't really use zipper, so woudn't it be more appropriate if you just link to my points here? Also, it seems convincing people to make things secure by design feels often like fighting against windmills... and that it needs something extreme like XZ to change minds (for a few weeks until everything is forgotten again). I filed this whole issue purely for the purpose, that there should be no means (unless some So for that reason, we banned using mkosi at the institute. |
I've reopened this and assigned the blocked tag as this is blocked on https://github.com/xsuchy/distribution-gpg-keys being packaged everywhere so there's an easy way to install GPG keys from a package. Currently it's not packaged in Debian, Ubuntu and Arch |
Wouldn't it be the simplest solution to add options like If a distribution hasn't packaged There's IMO no need to block this on some 3rd party collection of repo keys. |
@DaanDeMeyer, the ITP Thus it will sooner or later also land in *buntu. |
This setting controls whether we'll fetch GPG keys remotely or not. We disable it by default so that we only rely on locally available GPG keys for checking package and repository metadata signatures. This new setting only affects dnf/zypper based distributions as apt and pacman do not support retrieving GPG keys remotely in the first place. zypper does not trust GPG keys listed in gpgkey= by default so we import local GPG keys manually with rpm to work around that. Fixes systemd#757
This setting controls whether we'll fetch GPG keys remotely or not. We disable it by default so that we only rely on locally available GPG keys for checking package and repository metadata signatures. This new setting only affects dnf/zypper based distributions as apt and pacman do not support retrieving GPG keys remotely in the first place. zypper does not trust GPG keys listed in gpgkey= by default so we import local GPG keys manually with rpm to work around that. Fixes systemd#757
This setting controls whether we'll fetch GPG keys remotely or not. We disable it by default so that we only rely on locally available GPG keys for checking package and repository metadata signatures. This new setting only affects dnf/zypper based distributions as apt and pacman do not support retrieving GPG keys remotely in the first place. zypper does not trust GPG keys listed in gpgkey= by default so we import local GPG keys manually with rpm to work around that. Fixes systemd#757
This setting controls whether we'll fetch GPG keys remotely or not. We disable it by default so that we only rely on locally available GPG keys for checking package and repository metadata signatures. This new setting only affects dnf/zypper based distributions as apt and pacman do not support retrieving GPG keys remotely in the first place. zypper does not trust GPG keys listed in gpgkey= by default so we import local GPG keys manually with rpm to work around that. Fixes systemd#757
This setting controls whether we'll fetch GPG keys remotely or not. We disable it by default so that we only rely on locally available GPG keys for checking package and repository metadata signatures. This new setting only affects dnf/zypper based distributions as apt and pacman do not support retrieving GPG keys remotely in the first place. zypper does not trust GPG keys listed in gpgkey= by default so we import local GPG keys manually with rpm to work around that. Fixes systemd#757
This setting controls whether we'll fetch GPG keys remotely or not. We disable it by default so that we only rely on locally available GPG keys for checking package and repository metadata signatures. This new setting only affects dnf/zypper based distributions as apt and pacman do not support retrieving GPG keys remotely in the first place. zypper does not trust GPG keys listed in gpgkey= by default so we import local GPG keys manually with rpm to work around that. Fixes systemd#757
This setting controls whether we'll fetch GPG keys remotely or not. We disable it by default so that we only rely on locally available GPG keys for checking package and repository metadata signatures. This new setting only affects dnf/zypper based distributions as apt and pacman do not support retrieving GPG keys remotely in the first place. zypper does not trust GPG keys listed in gpgkey= by default so we import local GPG keys manually with rpm to work around that. Fixes systemd#757
This setting controls whether we'll fetch GPG keys remotely or not. We disable it by default so that we only rely on locally available GPG keys for checking package and repository metadata signatures. This new setting only affects dnf/zypper based distributions as apt and pacman do not support retrieving GPG keys remotely in the first place. zypper does not trust GPG keys listed in gpgkey= by default so we import local GPG keys manually with rpm to work around that. Fixes systemd#757
This setting controls whether we'll fetch GPG keys remotely or not. We disable it by default so that we only rely on locally available GPG keys for checking package and repository metadata signatures. This new setting only affects dnf/zypper based distributions as apt and pacman do not support retrieving GPG keys remotely in the first place. zypper does not trust GPG keys listed in gpgkey= by default so we import local GPG keys manually with rpm to work around that. Fixes systemd#757
This setting controls whether we'll fetch GPG keys remotely or not. We disable it by default so that we only rely on locally available GPG keys for checking package and repository metadata signatures. This new setting only affects dnf/zypper based distributions as apt and pacman do not support retrieving GPG keys remotely in the first place. zypper does not trust GPG keys listed in gpgkey= by default so we import local GPG keys manually with rpm to work around that. Fixes systemd#757
This setting controls whether we'll fetch GPG keys remotely or not. We disable it by default so that we only rely on locally available GPG keys for checking package and repository metadata signatures. This new setting only affects dnf/zypper based distributions as apt and pacman do not support retrieving GPG keys remotely in the first place. zypper does not trust GPG keys listed in gpgkey= by default so we import local GPG keys manually with rpm to work around that. Fixes systemd#757
This setting controls whether we'll fetch GPG keys remotely or not. We disable it by default so that we only rely on locally available GPG keys for checking package and repository metadata signatures. This new setting only affects dnf/zypper based distributions as apt and pacman do not support retrieving GPG keys remotely in the first place. zypper does not trust GPG keys listed in gpgkey= by default so we import local GPG keys manually with rpm to work around that. Fixes systemd#757
This setting controls whether we'll fetch GPG keys remotely or not. We disable it by default so that we only rely on locally available GPG keys for checking package and repository metadata signatures. This new setting only affects dnf/zypper based distributions as apt and pacman do not support retrieving GPG keys remotely in the first place. zypper does not trust GPG keys listed in gpgkey= by default so we import local GPG keys manually with rpm to work around that. Fixes systemd#757
Nice. :-) So what's the overall situation now?
Cheers, |
With one exception which I'll discuss later, all internet access done by mkosi when building images is done via the target distribution's package manager. All the downloads done by the package manager are verified with the distribution's GPG keys unless explicitly disabled with The one exception is when building opensuse images with dnf, we use curl to download some extra GPG keys from the repository as this is done by zypper as well when building opensuse images so to ensure things behave the same with dnf which doesn't implement this behavior we do that bit ourselves. This extra downloading is also disabled by default unless Finally, for full transparency, we do enable |
Hey.
Not sure whether I've understood the code correctly, but it seems that
mkosi
quite easily falls back to disabling signature checks for at lest the DNF/YUM case:mkosi/mkosi/__init__.py
Lines 1825 to 1826 in 28e9da0
which seems to be set here https://github.com/systemd/mkosi/blob/main/mkosi/__init__.py#L1850-L1856
My understanding is, that it first looks locally for the key, and if not there falls back to simply downloading it if there is a URL specified (in mkosi) itself, and if not it simply doesn't verify signatures at all.
It also doesn't seem to be obviously documented whether that key must be in the host OS or inside the container image already.
For security reasons, it should per default only use/trust locally installed keys. Additionally perhaps even ignore any
gpgcheck=0
orgpgkey=
that use non-local key locations if possible.Simply downloading a key via HTTPS doesn't seem really much more secure either. The usual CA bundles (e.g. Mozilla) come with some ~150 root CAs... (which themselves have thousands of intermediate CAs) many of them under the control of quite questionable organisations.
The same principles would obviously apply to
debootstrap
, etc. as well.. but at least for debootstrap I couldn't find that similar things are done (though I didn't look were closely).So would it be possible to default to only using local keys and doing anything further like downloading/trusting keys or simply not checking sigs only with some
--i-really-know-what-i-am-doing-promised
option?Another way would be that mkosi ships those keys, which obviously has some pros and cons.
Pros, that people using mkosi would at least get all the same keys (and not having to download them - more or less securely - on their own).
Cons, that you guys would have to maintain this... and also that e.g. in the case of bootstrapping Debian/Ubuntu on a Debian/Ubuntu system their own keyring packages should be rather used than what mkosi ships.
Cheers,
Chris.
The text was updated successfully, but these errors were encountered: