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

Transparent mechanism for migrating packages from current-testing to current #2573

Closed
marmarek opened this Issue Jan 13, 2017 · 6 comments

Comments

3 participants
@marmarek
Member

marmarek commented Jan 13, 2017

Current state

This is mostly about:

Currently - as mentioned in this document, it's done from command line of build machine(s), and more importantly - without any integrated method to check if package have known bugs. The only thing enforced by the script is to prevent uploading to current if package wasn't for at least 7 days in current-testing. But then, it's for release manager to check/remember if particular package is really tested and reported to be working (or at least - not reported to be broken). As with all manual steps, this is a weak spot... It's also easy to forget about some packages in current-testing.

Goal

It would be nice to have some public (web?) service for this, but lets keep in mind assumption of untrusted infrastructure. So, for example compromise of such service should not allow any control over the repository - especially not migrating (possibly broken) packages from current-testing to current. Probably DoS could not be mitigated, but in such a case we can always revert to the command line method.

Related to #1818

Proposal

  1. Create new repository on github, and use it's issues module.
  2. When uploading a package to current-testing, open an issue in that repository (similar to how builder-github currently add comments), with information on the package (target Qubes release, package name, version, changelog, related issues etc).
  3. Use this issue to note test results of the package (like 👍, 👎 or more elaborate forms).
  4. When release manager decide to move package to current repository, he needs to add a gpg inline-signed comment with that request - containing unambiguous identification of the package - at least Qubes release, package name (or actually - Qubes component name), version.
  5. Github hook would be invoked (similar to #1818) and execute request - of course only if properly signed with trusted key.

Few details about step 5, to make it reasonably secure:

  • all gihub API processing should be done in untrusted VM (probably sys-net, as this is the only place reachable from the outside to receive github hook)
  • only gpg signed command should be transferred (using qrexec service) to the VM actually having power of migrating package, the first step would be verifying that signature, and do that better than apt...

I think this workflow would allow to have it reasonably secure, while also quite convenient. Especially it will be trivial to see if any package is still in current-testing, easily collect related bug reports etc. This is still prone to some attacks - for example someone who control github could hide bug reports and trick the release manager to migrate buggy package. But the same could be done at any other bug reporting phase - like attacking mail server to filter out emails, or hide issues/notifications in QubesOS/qubes-issues. So, I think it isn't worse than the current setup.

A nice thing here is ability to delegate release manager role to someone, without handing over package signing keys. While release manager role still comes with a great power, at least it will be more transparent and possible to audit.

@marmarek marmarek added this to the Release 4.0 milestone Jan 13, 2017

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Jan 13, 2017

Member

If the above proposal looks good, some more details to discuss:
Technically, package for each target template is a separate package (qubes-core-agent v3.2.1 for Debian jessie is separate from qubes-core-agent v3.2.1 for Debian stretch). But I think it would be tedious to track them separately. This means if package has bug affecting one template, it will be delayed also for other templates (like bug affecting Debian jessie would prevent migrating package also for Debian stretch and Fedora 25). This is some trade-off, but I think a sensible one.

Somehow related issue - what to do if package build fails for some target templates - for example for one Fedora version - should the package be hold until build succeed for all templates, or (if work for other templates) - should allow to migrate successfully built packages?

/cc (for the whole issue) @adrelanos @andrewdavidwong @woju

Member

marmarek commented Jan 13, 2017

If the above proposal looks good, some more details to discuss:
Technically, package for each target template is a separate package (qubes-core-agent v3.2.1 for Debian jessie is separate from qubes-core-agent v3.2.1 for Debian stretch). But I think it would be tedious to track them separately. This means if package has bug affecting one template, it will be delayed also for other templates (like bug affecting Debian jessie would prevent migrating package also for Debian stretch and Fedora 25). This is some trade-off, but I think a sensible one.

Somehow related issue - what to do if package build fails for some target templates - for example for one Fedora version - should the package be hold until build succeed for all templates, or (if work for other templates) - should allow to migrate successfully built packages?

/cc (for the whole issue) @adrelanos @andrewdavidwong @woju

@adrelanos

This comment has been minimized.

Show comment
Hide comment
@adrelanos

adrelanos Jan 13, 2017

Member
Member

adrelanos commented Jan 13, 2017

@andrewdavidwong

This comment has been minimized.

Show comment
Hide comment
@andrewdavidwong

andrewdavidwong Jan 13, 2017

Member

It sounds like a good proposal to me:

  • There needs to be a more reliable way to migrate packages from current-testing to current in a timely fashion, and this fits the bill.
  • I don't like the reliance on GitHub, but as you point out, it's not worse than the current setup, and we have to start somewhere.

A nice thing here is ability to delegate release manager role to someone, without handing over package signing keys. While release manager role still comes with a great power, at least it will be more transparent and possible to audit.

This is a nice feature, especially since we're looking for a release manager (hint, hint to any trustworthy community members reading this 😉).

Somehow related issue - what to do if package build fails for some target templates - for example for one Fedora version - should the package be hold until build succeed for all templates, or (if work for other templates) - should allow to migrate successfully built packages?

I am inclined to say that successfully built packages should be allowed to migrate, but if the delay would be reasonable, the other way is also fine.

Member

andrewdavidwong commented Jan 13, 2017

It sounds like a good proposal to me:

  • There needs to be a more reliable way to migrate packages from current-testing to current in a timely fashion, and this fits the bill.
  • I don't like the reliance on GitHub, but as you point out, it's not worse than the current setup, and we have to start somewhere.

A nice thing here is ability to delegate release manager role to someone, without handing over package signing keys. While release manager role still comes with a great power, at least it will be more transparent and possible to audit.

This is a nice feature, especially since we're looking for a release manager (hint, hint to any trustworthy community members reading this 😉).

Somehow related issue - what to do if package build fails for some target templates - for example for one Fedora version - should the package be hold until build succeed for all templates, or (if work for other templates) - should allow to migrate successfully built packages?

I am inclined to say that successfully built packages should be allowed to migrate, but if the delay would be reasonable, the other way is also fine.

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Jan 13, 2017

Member

What about uploading packages to unstable first? So they are very briefly tested on some dev / release manager machine?

This step is done before uploading them anywhere - or even before committing stuff. Mostly using some local repository on LAN. See here: https://www.qubes-os.org/doc/development-workflow/#sending-packages-to-different-vm

But if test require someone else to run it (for example fix for some hardware-specific bug) - indeed we use unstable repository for this. There is no formal workflow on putting packages there. For example it is allowed to upload package built from non-standard branch, which will never be merged.

I would suggest this for Qubes repository metadata also. The author of reprepro recommended against to upload the reprepro 'db' folder, otherwise I would be happy to upload that whole '.git' folder. Perhaps we'll gitignore the db folder (and have a private separate git folder there) and also upload that git folder for better transparency? (The 'db' folder under git control might help to diagnose eventual bugs in reprepro. Not a trivial piece of software.)

Yes, keeping repository metadata in git sounds like a good idea. Excluding db should be trivial (as well as deb files itself - to have .git in manageable size). It will be somehow harder for Fedora, as repository metadata contains also binary files (like generated sqlite database). And for yum repository, by default only packages are signed, not metadata itself. Theoretically there is support for signed metadata, but apparently no one is using it (so, I'd expect it being buggy...). Actually, we leverage this currently, to generate metadata on the server, to not be forced to keep all the packages locally (all rpm files are needed to regenerate yum metadata - there is no equivalent of db directory).

gpg verification on the command line is indeed hard.

I think the first and most important step is to use gpgv2 instead of gpg2...

Member

marmarek commented Jan 13, 2017

What about uploading packages to unstable first? So they are very briefly tested on some dev / release manager machine?

This step is done before uploading them anywhere - or even before committing stuff. Mostly using some local repository on LAN. See here: https://www.qubes-os.org/doc/development-workflow/#sending-packages-to-different-vm

But if test require someone else to run it (for example fix for some hardware-specific bug) - indeed we use unstable repository for this. There is no formal workflow on putting packages there. For example it is allowed to upload package built from non-standard branch, which will never be merged.

I would suggest this for Qubes repository metadata also. The author of reprepro recommended against to upload the reprepro 'db' folder, otherwise I would be happy to upload that whole '.git' folder. Perhaps we'll gitignore the db folder (and have a private separate git folder there) and also upload that git folder for better transparency? (The 'db' folder under git control might help to diagnose eventual bugs in reprepro. Not a trivial piece of software.)

Yes, keeping repository metadata in git sounds like a good idea. Excluding db should be trivial (as well as deb files itself - to have .git in manageable size). It will be somehow harder for Fedora, as repository metadata contains also binary files (like generated sqlite database). And for yum repository, by default only packages are signed, not metadata itself. Theoretically there is support for signed metadata, but apparently no one is using it (so, I'd expect it being buggy...). Actually, we leverage this currently, to generate metadata on the server, to not be forced to keep all the packages locally (all rpm files are needed to regenerate yum metadata - there is no equivalent of db directory).

gpg verification on the command line is indeed hard.

I think the first and most important step is to use gpgv2 instead of gpg2...

@andrewdavidwong

This comment has been minimized.

Show comment
Hide comment
@andrewdavidwong

andrewdavidwong Jan 14, 2017

Member

I think the first and most important step is to use gpgv2 instead of gpg2...

👍

Member

andrewdavidwong commented Jan 14, 2017

I think the first and most important step is to use gpgv2 instead of gpg2...

👍

@adrelanos

This comment has been minimized.

Show comment
Hide comment
@adrelanos

adrelanos Jan 15, 2017

Member

Excluding db should be trivial (as well as deb files itself - to have .git in manageable size).

I think having also the deb folder under version control is useful. Even if just private and not published. In case something gets added to that folder by accident, then it's easy to rewind. And since the folder is private, it's easy to sometimes wipe the .git folder and re git init it to save space.

Member

adrelanos commented Jan 15, 2017

Excluding db should be trivial (as well as deb files itself - to have .git in manageable size).

I think having also the deb folder under version control is useful. Even if just private and not published. In case something gets added to that folder by accident, then it's easy to rewind. And since the folder is private, it's easy to sometimes wipe the .git folder and re git init it to save space.

marmarek added a commit to marmarek/qubes-builder-github that referenced this issue Feb 12, 2017

marmarek added a commit to marmarek/qubes-builder-github that referenced this issue Feb 12, 2017

marmarek added a commit to marmarek/qubes-builder-github that referenced this issue Feb 12, 2017

marmarek added a commit to marmarek/qubes-builder-github that referenced this issue Feb 12, 2017

Send notifications to dedicated repository also about 'security-testing'
Comments in affected issues are only about 'stable' and 'testing'
uploads (which makes sense). But tracking packages in issues dedicated
for package tracking should be more detailed - which include
'security-testing' uploads.

QubesOS/qubes-issues#2573

marmarek added a commit to marmarek/qubes-builder that referenced this issue Feb 12, 2017

update-repo: plug date check before any plugin-defined prerequisite
Make sure that if updates weren't long enough in testing repository,
we'll abort moving them to stable early enough.
Previously, if builder plugin add actual code as another prerequisite
(like builder-github for example), it was run before checking the date.

QubesOS/qubes-issues#2573

@marmarek marmarek referenced this issue in QubesOS/qubes-builder-github Feb 12, 2017

Merged

Trigger builds/uploads on github actions #7

marmarek added a commit to marmarek/qubes-builder-github that referenced this issue Feb 24, 2017

marmarek added a commit to marmarek/qubes-builder-github that referenced this issue Feb 24, 2017

marmarek added a commit to marmarek/qubes-builder-github that referenced this issue Feb 24, 2017

Use single quotes around awk script
This will avoid confusion about handling '$' and other shell special
characters. Pass needed variables using -v to awk.

Suggested by @woju
QubesOS/qubes-issues#2573

marmarek added a commit to marmarek/qubes-builder-github that referenced this issue Feb 24, 2017

Reject any field separator in component name, not only space
In theory white characters will be rejected anyway a moment later -
while checking for directory existence. But to be on a safe side, make
it explicit earlier.

Suggested by @woju
QubesOS/qubes-issues#2573

marmarek added a commit to marmarek/qubes-builder-github that referenced this issue Feb 24, 2017

Move target repository sanity check earlier
Have it besides other context-less checks.

Suggested by @woju
QubesOS/qubes-issues#2573

marmarek added a commit to marmarek/qubes-builder-github that referenced this issue Feb 24, 2017

Do not use 'echo' to strip white characters
Shell command 'echo' may consume some parameters, for example '-e' or
'-n'. While it shouldn't happen here right now, make sure it will not
hurt anyway.

Suggested by @woju
QubesOS/qubes-issues#2573

marmarek added a commit to marmarek/qubes-builder-github that referenced this issue Feb 24, 2017

marmarek added a commit to marmarek/qubes-builder-github that referenced this issue Feb 26, 2017

Make github webooks importable scripts.
Wrap actual code under "if __name__ == '__main__'". Also fix print
syntax.
This allows having one dispatcher script calling appropriate function,
instead of starting new process each time.

QubesOS/qubes-issues#2573

marmarek added a commit to marmarek/qubes-builder-github that referenced this issue Feb 26, 2017

github-webhooks: use just component name, not full repository name
qubesbuilder.TriggerBuild do not allow '/' in input argument. Better
strip repository owner name in hook script, than weaken check in qrexec
service running in build VM. In case of ambiguity, some builder
instances will notice that nothing new is there to build.

QubesOS/qubes-issues#2573

marmarek added a commit to marmarek/qubes-builder-debian that referenced this issue Feb 28, 2017

update-repo: move actual update repo code to internal target
This will enable builder-github plugin to schedule itself after moving
packages.

QubesOS/qubes-issues#2573

marmarek added a commit to QubesOS/qubes-infrastructure that referenced this issue Mar 5, 2017

marmarek added a commit to QubesOS/qubes-infrastructure that referenced this issue Mar 5, 2017

Add handy builder-github.conf
github-specific settings for easy inclusion in actual builder.conf

QubesOS/qubes-issues#2573

marmarek added a commit to QubesOS/qubes-infrastructure that referenced this issue Mar 19, 2017

Populate keys accepted for commands using pillar
Instead of manually importing those keys, let salt do that and have keys
configured using pillar. This is especially useful if all/most
environments use the same set of trusted keys.

QubesOS/qubes-issues#2573

@qubesos-bot qubesos-bot referenced this issue in QubesOS/updates-status Mar 19, 2017

Closed

infrastructure v1.0.2 (r3.2) #14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment