Commit Graph

4611 Commits

Author SHA1 Message Date
Colin Walters b7f48a74c0 lib: Move internal binding verification API to repo.c
`ostree-repo-pull.c` is rather monstrous; I plan to split it
up a bit.  There's actually already a `pull-private.h` but
that's just for the binding verification API.  I think that one
isn't really pull specific.  Let's move it into the "catchall"
`repo.c`.
2020-04-17 01:16:51 +00:00
OpenShift Merge Robot 388c3033bc
Merge pull request #2070 from cgwalters/travis-libsodium
travis: Add some libsodium coverage
2020-04-16 15:08:44 -07:00
Denis Pynkin a17cdec936 Add the same config options for distcheck
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
2020-04-16 17:34:09 -04:00
Denis Pynkin 0807f100e2 Fix the lost line separator
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
2020-04-16 17:34:09 -04:00
Denis Pynkin 735b03dbf9 Add ci_pkgs to travis-install.sh
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
2020-04-16 17:34:09 -04:00
OpenShift Merge Robot 5092a8feac
Merge pull request #2072 from cgwalters/feature-ed25519
Use `sign-ed25519` for the feature name
2020-04-16 13:29:36 -07:00
Colin Walters e63647c6d0 travis: Add some libsodium coverage
As far as I can tell we're not gating on this right now.  From
a quick glance, it looks like Debian stable has `libsodium-dev`
but only Ubuntu eoan does which we're not testing right now.
2020-04-16 17:19:51 +00:00
Colin Walters d1e5ed379e Use `sign-ed25519` for the feature name
`libsodium` is an implementation detail.  In particular, I'd like
to consider using OpenSSL for ed25519 (if libsodium isn't configured
and openssl is).

So switch the name of the exposed feature and adjust the tests.
2020-04-16 16:43:43 +00:00
OpenShift Merge Robot eae41ea203
Merge pull request #2071 from cgwalters/ci-min-check
ci: Build minimal without libsodium too
2020-04-16 08:47:45 -07:00
Colin Walters a6efae909f ci: Build minimal without libsodium too
The goal is to test "no options" build - and eventually tests.
(We're not actually including libsodium in the cosa buildroot right
 now, but we may in the future)
2020-04-16 14:15:28 +00:00
OpenShift Merge Robot 9e30b0f8f5
Merge pull request #2063 from cgwalters/sig-cleanups-2
pull: Cleanup signature verification functions
2020-04-16 01:38:12 -07:00
Colin Walters 8e7aea4473 Change signature opts to include type, cleanup error handling
Previously we would pass the `verification-key` and `verification-file`
to all backends, ignoring errors from loading keys until we
found one that worked.

Instead, change the options to be `verification-<engine>-key`
and `verification-<engine>-file`, and then
rework this to use standard error handling; barf explicitly if
we can't load the public keys for example.  Preserve
the semantics of accepting the first valid signature.  The
first signature error is captured, the others are currently
compressed into a `(and %d more)` prefix.

And now that I look at this more closely there's a lot of
duplication between the two code paths in pull.c for verifying;
will dedup this next.
2020-04-15 22:07:11 +00:00
OpenShift Merge Robot fd55deb0f7
Merge pull request #2068 from cgwalters/pull-cosmetic-renames
lib/pull: Two cosmetic internal function renames
2020-04-15 10:30:18 -07:00
Colin Walters e035230c6b lib/pull: Two cosmetic internal function renames
I'm mainly doing this to sanity check the CI state right now.

However, I also want to more cleanly/clearly distinguish
the "sign" code from the "gpg" code.

Rename one function to include `gpg`.

For the other...I think what it's really doing is using the remote
config, so change it to include `remote` in its name.
2020-04-15 17:06:14 +00:00
OpenShift Merge Robot 2b739ce431
Merge pull request #2069 from jlebon/pr/tweak-ci
ci: Adapt to use new fcosKola semantics
2020-04-15 19:01:40 +02:00
Jonathan Lebon 452840f283 ci: Adapt to use new fcosKola semantics
This was changed recently and broke us since we do explicitly call
`fcosKola` instead of implicitly via `fcosBuild`. Adapt to the new
semantics.
2020-04-15 12:37:54 -04:00
Denis Pynkin 73d527dee3
Merge pull request #2064 from cgwalters/dummy-only-when-testing
Only enable "dummy" signature type with opt-in env variable
2020-04-15 12:28:52 +03:00
Colin Walters b6040143e5 Only enable "dummy" signature type with opt-in env variable
I don't want to even have to think about people using
this in production.
2020-04-14 22:18:13 +00:00
OpenShift Merge Robot 8baee5cd04
Merge pull request #2058 from cgwalters/signing-cleanups
pull: Update key loading function to match error style
2020-04-07 20:49:04 +02:00
OpenShift Merge Robot e88835e29d
Merge pull request #2061 from cgwalters/add-d4s
OWNERS: add d4s to reviewers
2020-04-07 19:45:17 +02:00
OpenShift Merge Robot dd44f6f941
Merge pull request #2060 from d4s/ostree_repo_pull_with_options-gpg_check
lib/repo-pull: fix GPG check while pulling remote
2020-04-07 16:04:22 +02:00
OpenShift Merge Robot 4a57204c60
Merge pull request #2044 from martinezjavier/duplicated-entries
grub2: Don't add menu entries if GRUB supports parsing BLS snippets
2020-04-07 15:54:08 +02:00
Colin Walters 248596465c OWNERS: add d4s to reviewers
He did a lot of work on signing and will continue that.
2020-04-07 13:07:55 +00:00
Denis Pynkin ef1aeb7458 lib/repo-pull: fix GPG check while pulling remote
If GPG support is disabled in a build time we should to check if any of
options "gpg_verify" or "gpg_verify_summary" is set to TRUE instead
of checking if they are passed via options while pulling from remote.

Fixed the failure with assertion of `ostree find-remotes --pull --mirror`
calling (`tests/test-pull-collections.sh`) if libostree has been compiled
without GPG support.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
2020-04-07 01:11:29 +03:00
OpenShift Merge Robot 0638d1ea86
Merge pull request #2057 from cgwalters/test-sizes-error
tests/pull-sizes: Disable xattrs everywhere
2020-04-06 22:33:43 +02:00
OpenShift Merge Robot 1b0eec02d4
Merge pull request #2059 from cgwalters/commit-from-base-tree
commit: Add --base argument
2020-04-06 22:18:49 +02:00
OpenShift Merge Robot eefb5241c8
Merge pull request #2055 from cgwalters/gtkdoc-warnings
lib: Squash two gtk-doc warnings
2020-04-06 21:54:13 +02:00
Colin Walters 329a82c57e commit: Add --base argument
I was trying to followup the `--selinux-policy-from-base` work
to add a `cosa build --fast=overlay` for coreos-assembler,
but hit on the fact that using e.g. `--owner-uid` disables
commit optimizations.

A while ago, https://github.com/ostreedev/ostree/pull/1643 landed
which optimized this for the case where no modifications are provided.
But, we really need the SELinux policy bits, and it's super convenient
to run `ostree commit` as non-root.

It's fairly surprising actually that it's taken us so long to
iterate on a good interface for this "commit changes on top of a base"
model.  In practice, many nontrivial cases really end up needing
to do a (hardlink) checkout, and that case is optimized.

But for this coreos-assembler work I want to directly overlay onto
a commit object another commit object.

That previous PR above added exactly the API we need, so let's
expose it in the CLI.

What you can see happening in the test is that we provide
`--owner-uid 42`, but that only applies to directories/files
that were added in the commit.

And now that I look at this, I think what we really want here
is to avoid changing directories that exist in the base, but
eh; in practice the main use here is for `--owner-uid 0` while
committing as non-root; and that works fine with this since
the baseline uid will be zero as well.
2020-04-06 19:28:51 +00:00
Javier Martinez Canillas 768eee87f6
grub2: Don't add menu entries if GRUB supports parsing BLS snippets
This is another attempt to avoid having duplicated menu entries caused by
GRUB having support to parse BLS snippets and the 15_ostree script adding
menu entries as well.

The previous attempt was in commit 985a141002 ("grub2: Exit gracefully if
the configuration has BLS enabled") but that lead to users not having menu
entries at all, due having an old GRUB version that was not able to parse
the BLS snippets.

This happened because the GRUB bootloader is never updated in the ESP as
a part of the OSTree upgrade transaction.

The logic is similar to the previous commit, the 15_ostree script exits if
able to determine that the bootloader can parse the BLS snippets directly.

But this time it will not only check that a BLS configuration was enabled,
but also that a /boot/grub2/.grub2-blscfg-supported file exists. This file
has to be created by a component outside of OSTree that also takes care of
updating GRUB to a version that has proper BLS support.
2020-04-06 20:44:19 +02:00
Colin Walters 47539874b8 pull: Update key loading function to match error style
This code wasn't written with idiomatic GError usage; it's not standard
to construct an error up front and continually append to its
message.  The exit from a function is usually `return TRUE`,
with error conditions before that.

Updating it to match style reveals what I think is a bug;
we were silently ignoring failure to parse key files.
2020-04-05 18:49:25 +00:00
Colin Walters 6d89b969ed tests/pull-sizes: Disable xattrs everywhere
I am getting SELinux xattrs committed in local development (inside
https://github.com/cgwalters/coretoolbox ), which
throws off the hardcoded sizes in this test.
2020-04-05 18:38:26 +00:00
OpenShift Merge Robot a16fe86b36
Merge pull request #1878 from d4s/wip/d4s/no_gpg
Alternative signing system
2020-04-04 19:46:12 +02:00
Colin Walters c4d519733d lib: Squash two gtk-doc warnings
Just noticed these while doing a build.
2020-04-04 17:05:56 +00:00
OpenShift Merge Robot 08ebf5ae5a
Merge pull request #2051 from fkrull/repo_finder_avahi
lib: fix typo in function docs
2020-04-02 00:34:59 +02:00
Felix Krull 7091e1b5ca lib: fix typo in function docs 2020-04-01 23:06:19 +02:00
OpenShift Merge Robot 62632511f1
Merge pull request #2049 from cgwalters/sysroot-refactor
sysroot: Reorganize sysroot load code a bit
2020-04-01 15:18:06 +02:00
Colin Walters 40a60f1e83 sysroot: Reorganize sysroot load code a bit
No functional changes; prep for a future patch
which will load the "live" deployment rather than
reading the bootloader configs.
2020-03-31 21:42:21 +00:00
OpenShift Merge Robot 5b4c97511f
Merge pull request #1973 from mwleeds/avoid-extraneous-summary-copy
Don't copy summary for collection-ref mirror subset pulls
2020-03-29 01:04:57 +01:00
OpenShift Merge Robot 1003a2dbde
Merge pull request #2045 from cgwalters/sysroot-load-err
lib: Add error prefixing for sysroot load and repo open
2020-03-28 18:44:49 +01:00
Matthew Leeds 164b2aa35b Don't copy summary for collection-ref mirror subset pulls
When we're only pulling a subset of the refs available in the remote, it
doesn't make sense to copy the remote's summary (which may not be valid
for the local repo). This makes the check here match the one done
several lines above when we decide whether to error out if there's no
remote summary available.

This extends the fix in https://github.com/ostreedev/ostree/pull/935 for
the case of collection-refs.

Also, add a unit test for this issue, based on the existing one in
pull-test.sh.
2020-03-28 10:35:19 -07:00
Matthew Leeds cd37293b5a find-remotes: Add a --mirror option
This will be useful in the unit test added by the next commit. It just
passes OSTREE_REPO_PULL_FLAGS_MIRROR to the call to
ostree_repo_pull_from_remotes_async().
2020-03-28 10:35:19 -07:00
Colin Walters 9cb148c9b9 lib: Add error prefixing for sysroot load and repo open
Noticed this while writing tests for a core `ostree_sysroot_load()`
entrypoint.  And decided to do the same for `ostree_repo_open()`,
and while there also noted we had a duplicate error prefixing
for the open (more recently `glnx_opendirat()` automatically
prefixes with the path).
2020-03-28 14:08:51 +00:00
Denis Pynkin e2c601687b ostree-repo: improve error handling
Correctly return "error" from `ostree_repo_sign_commit()`
in case if GPG is not enabled.

Use glnx_* functions in signature related pull code for clear
error handling if GPG isn't enabled.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
2020-03-25 15:23:55 +03:00
Denis Pynkin cce3864160 sign-pull: improve error handling
Use glnx_* functions in signature related pull code for clear
error handling.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
2020-03-25 15:23:55 +03:00
Denis Pynkin 584ad40549 lib/sign: return false for non-implemented functions
Do not mask implementation anymore since we have a working
engines integrated with pulling mechanism.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
2020-03-25 15:23:55 +03:00
Denis Pynkin 5a39281fbe tests/sign: check pull failure with invalid remote options
Pull should to fail if no known signature available in remote's
configuration or well-known places.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
2020-03-25 15:23:55 +03:00
Denis Pynkin e16faa58f4 lib/sign: convert ostree_sign_summary to new style
The "new style" code generally avoids `goto err` because it conflicts
with `__attribute__((cleanup))`.  This fixes a compiler warning.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
2020-03-25 15:23:55 +03:00
Denis Pynkin 1e3bdef285 sign-dummy: optimize ostree_sign_dummy_data_verify
Return TRUE as soon as any signature verified.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
2020-03-25 15:23:55 +03:00
Denis Pynkin aaf73f6afc sign-ed25519: Convert functions to new style
The "new style" code generally avoids `goto err` because it conflicts
with `__attribute__((cleanup))`.  This fixes a compiler warning.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
2020-03-25 15:23:55 +03:00
Denis Pynkin 09d5b475af tests/sign: added check with file and single key on pull
Additional test of signatures check behavior during the pull
with keys file containing wrong signatures and correct verification
key. Both are set as a part of remote's configuration.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
2020-03-25 15:23:55 +03:00