https by default#615
Conversation
|
For mmdebstrap, we could actually override its defaults to have debos guarantee https sources.list in its default configuration – let me know if you want me to send that change. |
|
I realize this PR might seem petty, I'm sending this because of the result of an actual cybersecurity assessment of an image based of qcom-deb-images :) |
|
The suggested url by deb.debian.org is http, not https ; I'd be curious to know what the assesments is, in the end the signing/validation is done by the gpg checks tracking back to the packages file, not by the network transport. when building for non-native architectures using https can also cause image builds to be quite a bit slower as the whole encryption is emulated |
When you say the suggested url, you reference the text file hosted on deb.debian.org itself? Pretty much all Debian tools had defaulted to http in the past, it's the only effective way to get caching: with https, apt has to establish an end to end encryption to a hostname with that cert's subject name, so either one has some use some tricks like http://HTTPS/// (apt-cacher-ng) or setup a root CA to do SSL interception. Yes, the debian archive is securely delivered over http as the indices are GPG signed and there is a timestamp (valid until) to prevent replay attacks. What was brought up in the security assessment that trigger my proposed changes is a lack of confidentiality: I can observe the software being installed on this or that system. It's minor, but valid, and http traffic will generally trigger alerts.
Yeah, SSL at a large scale is costly for client and server (I guess we don't care too much about Fastly), good point about QEMU. I guess it's a classical example of security vs practicality: http is generally nice for performance and caching, but will trigger security reviews and leak some data about systems. :-/ One thing we discussed with Robie for qcom-deb-images is to have an easy flag to override the mirror at build time, but keep https in the target images. |
Yeah; Also:
The reason we set a default mirror for debootstrap is mostly historical as some versions would misbehave without it (iirc invalid apt sources list). That's something we could probably drop now so we just use the defaults for mmdebstrap/debootstrap.
Ack; it's also why debos support propagate proxy environment settings as some use that for caching.
Agreed; This is one of those fuzzy areas and i can see both sides of. Though I'd prefer Debian to take the lead here and debos following the defaults.
That makes total sense!. For this PR, we can merge the non-debootstrap commits. Is not setting a default debootstrap mirror something you'd like to look at? |
|
|
||
| - mirror -- URL with Debian-compatible repository | ||
| If no mirror is specified debos will use http://deb.debian.org/debian as default. | ||
| If no mirror is specified debos will use https://deb.debian.org/debian as default. |
There was a problem hiding this comment.
| If no mirror is specified debos will use https://deb.debian.org/debian as default. | |
| If no mirror is specified the default mirror of debootstrap will be used |
| d.Components = []string{"main"} | ||
| // Set generic default mirror | ||
| d.Mirror = "http://deb.debian.org/debian" | ||
| d.Mirror = "https://deb.debian.org/debian" |
There was a problem hiding this comment.
but there is also the part where we write /etc/apt/sources.list using this mirror which needs some attention.
There was a problem hiding this comment.
yup; gave this some love
|
@lool small bump |
debos doesn't actually set a default if the user doesn't provide one; clarify that the current default mirror for mmdebstrap is defined in that tool and avoid referring to the current effective default as it might change in mmdebstrap. Signed-off-by: Loïc Minier <loic.minier@oss.qualcomm.com>
Use secure https:// links instead of http:// links wherever possible. Update bmaptool URL to a working one. Signed-off-by: Loïc Minier <loic.minier@oss.qualcomm.com>
Test with default components and mirror, and test overring default mirror and components. Signed-off-by: Loïc Minier <loic.minier@oss.qualcomm.com>
Split debootstrap command generation in a separate function to add unit tests. Signed-off-by: Loïc Minier <loic.minier@oss.qualcomm.com>
debootstrap already generates sources.list and this requires hardcoding the default mirror in debos, so just leave it to debootstrap. Signed-off-by: Loïc Minier <loic.minier@oss.qualcomm.com>
Rely on debootstrap's default mirror instead of adding our own. Matches mmdebstrap's behavior. Signed-off-by: Loïc Minier <loic.minier@oss.qualcomm.com>
22db1a9 to
1ecdc2e
Compare
Thanks for the ping @obbardc! Here's an updated set of commits; perhaps the unit and integration tests are a bit overkill. I've ran debootstrap manually to verify proper behavior, but while I started running the integration tests locally, they take a very long time with qemu (without kvm). I'm hoping the CI will do its magic :) |
Did this in the updated PR. TBH, I kind of feel that debos is not consistent between setting a default component (main) but not setting a default mirror, but with the proposed changes at least mmdebstrap and debootstrap actions have similar expectations and we're not hardcoding the debootstrap default mirror. I was tempted to remove the default main component (also debootstrap's default) and even the "unstable" debootstrap script (the default for all supported suites). |
I wish I would have run both tests on each commit touching debootstrap_action. |
FWIW, I don't think that HTTPS actually provides real confidentiality in the apt use case. The sizes of packages are well known, and so are their dependency chain. I reckon that traffic analysis based purely on size and knowledge of the underlying apt repository would be enough to reveal what apt over HTTPS downloaded. |
|
What HTTPS does do is reduce the attack surface though. apt has had vulnerabilities in GPG validation in the past, for example. |
This avoids using https where we can and hardcoding the default mirror for debootstrap.
The only remaining file with http:// URLs is the Apache 2.0 license, but it's probably a bad idea to patch it for compliance tooling to work.