Skip to content

https by default#615

Open
lool wants to merge 6 commits intogo-debos:mainfrom
lool:https-by-default
Open

https by default#615
lool wants to merge 6 commits intogo-debos:mainfrom
lool:https-by-default

Conversation

@lool
Copy link
Copy Markdown
Contributor

@lool lool commented Nov 14, 2025

This avoids using https where we can and hardcoding the default mirror for debootstrap.

  • refactor(debootstrap_action): No default mirror
  • refactor(debootstrap_action): Drop APT sources gen
  • refactor(debootstrap_action): Add unit tests
  • tests: Add integration tests for debootstrap
  • fix: Use https links where possible
  • refactor: Clarify default mirror for mmdebstrap

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.

@lool
Copy link
Copy Markdown
Contributor Author

lool commented Nov 14, 2025

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.

@lool
Copy link
Copy Markdown
Contributor Author

lool commented Nov 14, 2025

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 :)

@sjoerdsimons
Copy link
Copy Markdown
Member

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

@lool
Copy link
Copy Markdown
Contributor Author

lool commented Nov 18, 2025

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 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.

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

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.

@sjoerdsimons
Copy link
Copy Markdown
Member

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 you say the suggested url, you reference the text file hosted on deb.debian.org itself?

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.

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.

Ack; it's also why debos support propagate proxy environment settings as some use that for caching.

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.

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

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. :-/

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.

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.

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?

Copy link
Copy Markdown
Member

@obbardc obbardc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

following Sjoerd's comments

Comment thread actions/debootstrap_action.go Outdated

- 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.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Comment thread actions/debootstrap_action.go Outdated
d.Components = []string{"main"}
// Set generic default mirror
d.Mirror = "http://deb.debian.org/debian"
d.Mirror = "https://deb.debian.org/debian"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use debootstrap default mirror

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but there is also the part where we write /etc/apt/sources.list using this mirror which needs some attention.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup; gave this some love

@obbardc
Copy link
Copy Markdown
Member

obbardc commented Feb 7, 2026

@lool small bump

lool added 6 commits February 14, 2026 19:52
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>
@lool
Copy link
Copy Markdown
Contributor Author

lool commented Feb 14, 2026

@lool small bump

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 :)

@lool
Copy link
Copy Markdown
Contributor Author

lool commented Feb 14, 2026

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?

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).

@lool
Copy link
Copy Markdown
Contributor Author

lool commented Feb 14, 2026

docker run --rm       -v $(pwd)/tests:/tests -w /tests      --tmpfs /scratch:exec --tmpfs /run -e TMP=/scratch      debos -v sources-list-custom/test.yaml
[...]
2026/02/14 21:07:08 Debootstrap (stage 2) | I: Configuring ca-certificates...
2026/02/14 21:13:17 Debootstrap (stage 2) | I: Base system installed successfully.
2026/02/14 21:13:32 ==== Verify sources.list contains the correct mirror and components ====
2026/02/14 21:13:33 Running command "[grep -q "^deb https://deb.debian.org/debian bookworm main contrib" /etc/apt/sources.list || (echo "ERROR: sources.list does not contain expected entry:" &&
 cat /etc/apt/sources.list &&
 exit 1)
]"
2026/02/14 21:13:36 ==== Recipe done ====

I wish I would have run both tests on each commit touching debootstrap_action.

@basak-qcom
Copy link
Copy Markdown

I can observe the software being installed on this or that system.

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.

@basak-qcom
Copy link
Copy Markdown

What HTTPS does do is reduce the attack surface though. apt has had vulnerabilities in GPG validation in the past, for example.

@obbardc obbardc added this to the v1.2.0 milestone Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

5 participants