ostree.git
5 years agoci: Test for clock skew
Colin Walters [Sun, 17 May 2020 14:27:45 +0000 (14:27 +0000)]
ci: Test for clock skew

I saw `tests/test-admin-deploy.none.sh` fail in one CI run, and
I want to check if it was because of clock skew, so fail
fast if we detect that.

xref https://github.com/ostreedev/ostree/pull/2099#issuecomment-629805375

5 years agoMerge pull request #2101 from cgwalters/signapi-no-explicit-on
OpenShift Merge Robot [Mon, 18 May 2020 07:06:04 +0000 (00:06 -0700)]
Merge pull request #2101 from cgwalters/signapi-no-explicit-on

pull: Only have API to disable signapi for local pulls

5 years agopull: Only have API to disable signapi for local pulls
Colin Walters [Sun, 17 May 2020 13:52:24 +0000 (13:52 +0000)]
pull: Only have API to disable signapi for local pulls

There's a lot of historical baggage associated with GPG verification
and `ostree pull` versus `ostree pull-local`.  In particular nowadays,
if you use a `file://` remote things are transparently optimized
to e.g. use reflinks if available.

So for anyone who doesn't trust the "remote" repository, you should
really go through through the regular
`ostree remote add --sign-verify=X file://`
path for example.

Having a mechanism to say "turn on signapi verification" *without*
providing keys goes back into the "global state" debate I brought
up in https://github.com/ostreedev/ostree/issues/2080

It's just much cleaner architecturally if there is exactly one
path to find keys: from a remote config.

So here in contrast to the GPG code, for `pull-local` we explictily
disable signapi validation, and the `ostree_repo_pull()` API just
surfaces flags to disable it, not enable it.

5 years agoMerge pull request #2100 from cgwalters/make-install-kola-tests
OpenShift Merge Robot [Fri, 15 May 2020 21:38:00 +0000 (14:38 -0700)]
Merge pull request #2100 from cgwalters/make-install-kola-tests

ci: Install kola tests

5 years agoci: Install kola tests
Colin Walters [Thu, 14 May 2020 23:50:40 +0000 (23:50 +0000)]
ci: Install kola tests

This builds on
https://github.com/coreos/coreos-assembler/pull/1441
to install our tests rather than running them from the source
directory.  This model will more cleanly allow us to ship
our tests along with a test container or elsewhere, separate
from the source directory.

Also prep for https://github.com/ostreedev/ostree/pull/2048

5 years agoMerge pull request #2099 from jlebon/pr/timestamp-check-from-rev
OpenShift Merge Robot [Fri, 15 May 2020 15:16:38 +0000 (08:16 -0700)]
Merge pull request #2099 from jlebon/pr/timestamp-check-from-rev

lib/pull: Add `timestamp-check-from-rev`

5 years agolib/upgrader: Pull with `timestamp-check-from-rev`
Jonathan Lebon [Thu, 14 May 2020 19:05:45 +0000 (15:05 -0400)]
lib/upgrader: Pull with `timestamp-check-from-rev`

For the same reason as https://github.com/coreos/rpm-ostree/pull/2094.
What we care most about is that the new commit we pull is newer than the
one we're currently sitting on, not necessarily that it's newer than the
branch itself, which it might not be if e.g. we're trying to deploy a
commit older than the tip but still newer than the deployment (via
`--override-commit`).

5 years agolib/pull: Add `timestamp-check-from-rev`
Jonathan Lebon [Thu, 14 May 2020 17:44:32 +0000 (13:44 -0400)]
lib/pull: Add `timestamp-check-from-rev`

The way `timestamp-check` works might be too restrictive in some
situations. Essentially, we need to support the case where users want to
pull an older commit than the current tip, but while still guaranteeing
that it is newer than some even older commit.

This will be used in Fedora CoreOS. For more information see:
https://github.com/coreos/rpm-ostree/pull/2094
https://github.com/coreos/fedora-coreos-tracker/issues/481

5 years agoMerge pull request #2098 from cgwalters/finalize-requires-mounts
OpenShift Merge Robot [Wed, 13 May 2020 19:21:14 +0000 (12:21 -0700)]
Merge pull request #2098 from cgwalters/finalize-requires-mounts

finalize: Add RequiresMountsFor=/boot too

5 years agofinalize: Add RequiresMountsFor=/boot too
Colin Walters [Tue, 12 May 2020 22:04:53 +0000 (22:04 +0000)]
finalize: Add RequiresMountsFor=/boot too

In https://bugzilla.redhat.com/show_bug.cgi?id=1827712
some OpenShift CI is seeing `/boot` being unmounted before
`ostree-finalize-staged.service` runs or completes.

We finally tracked this down to a bug elsewhere, but
I think we should add this because it clearly shows
our requirements.

5 years agoMerge pull request #2097 from cgwalters/sign-verifier
OpenShift Merge Robot [Tue, 12 May 2020 18:38:58 +0000 (11:38 -0700)]
Merge pull request #2097 from cgwalters/sign-verifier

pull: Further cleanup signapi verification

5 years agoMerge pull request #2096 from cgwalters/test-staged-delay
OpenShift Merge Robot [Tue, 12 May 2020 17:41:29 +0000 (10:41 -0700)]
Merge pull request #2096 from cgwalters/test-staged-delay

tests/staged-delay.sh: New test

5 years agopull: Further cleanup signapi verification
Colin Walters [Tue, 12 May 2020 01:26:00 +0000 (01:26 +0000)]
pull: Further cleanup signapi verification

Previously in the pull code, every time we went to verify
a commit we would re-initialize an `OstreeSign` instance
of each time, re-parse the remote configuration
and re-load its public keys etc.

In most cases this doesn't matter really because we're
pulling one commit, but if e.g. pulling a commit with
history would get a bit silly.

This changes things so that the pull code initializes the
verifiers once, and reuses them thereafter.

This is continuing towards changing the code to support
explicitly configured verifiers, xref
https://github.com/ostreedev/ostree/issues/2080

5 years agotests/staged-delay.sh: New test
Colin Walters [Mon, 11 May 2020 21:21:54 +0000 (21:21 +0000)]
tests/staged-delay.sh: New test

Attempting to reproduce
https://bugzilla.redhat.com/show_bug.cgi?id=1827712
but no dice yet.

5 years agoMerge pull request #2095 from cgwalters/sign-get-all
OpenShift Merge Robot [Mon, 11 May 2020 16:41:35 +0000 (18:41 +0200)]
Merge pull request #2095 from cgwalters/sign-get-all

signing: Change API to create instances directly

5 years agosigning: Change API to create instances directly
Colin Walters [Sun, 10 May 2020 13:20:50 +0000 (13:20 +0000)]
signing: Change API to create instances directly

This cleans up the verification code; it was weird how
we'd get the list of known names and then try to create
an instance from it (and throw an error if that failed, which
couldn't happen).

5 years agoMerge pull request #2092 from cgwalters/sign-verify-ed25519-explicit
OpenShift Merge Robot [Sun, 10 May 2020 12:22:41 +0000 (14:22 +0200)]
Merge pull request #2092 from cgwalters/sign-verify-ed25519-explicit

remote-add: Add --sign-verify=KEYTYPE=[inline|file]:PUBKEYREF

5 years agoremote-add: Add --sign-verify=KEYTYPE=[inline|file]:PUBKEYREF
Colin Walters [Thu, 7 May 2020 19:43:10 +0000 (19:43 +0000)]
remote-add: Add --sign-verify=KEYTYPE=[inline|file]:PUBKEYREF

Per https://github.com/ostreedev/ostree/issues/2080#issuecomment-623614483

A huge benefit of ed25519 (and ECC in general) is that keys are very
short - short enough that it's completely reasonable to inline
them into a command line argument.

And I think that's a good model; it makes the keys very visible.

For example, someone could easily copy-paste a commandline
argument from a webpage (secured via TLS) that says to run
`ostree remote add --sign-verify=ed25519=inline:KEY`.

5 years agoMerge pull request #2093 from cgwalters/sysroot-requires
OpenShift Merge Robot [Fri, 8 May 2020 19:54:51 +0000 (21:54 +0200)]
Merge pull request #2093 from cgwalters/sysroot-requires

ostree-prepare-root: Requires=sysroot.mount

5 years agoostree-prepare-root: Requires=sysroot.mount
Colin Walters [Fri, 8 May 2020 12:49:55 +0000 (12:49 +0000)]
ostree-prepare-root: Requires=sysroot.mount

With just `After=` we'll still try to run in the scenario
where `sysroot.mount` fails because the rootfs didn't appear.
And this will end up spewing an error which can confuse people
into thinking something is wrong at the ostree level.

This has come up numerous times w/{Fedora,RHEL} CoreOS, most
recently while looking at
https://bugzilla.redhat.com/show_bug.cgi?id=1803130

5 years agoMerge pull request #2091 from cgwalters/commit-w-xor-x
OpenShift Merge Robot [Wed, 6 May 2020 20:11:45 +0000 (22:11 +0200)]
Merge pull request #2091 from cgwalters/commit-w-xor-x

commit: Add --mode-ro-executables

5 years agocommit: Add --mode-ro-executables option
Colin Walters [Wed, 6 May 2020 18:31:53 +0000 (18:31 +0000)]
commit: Add --mode-ro-executables option

I think we should encourage removing the writable bits from
executables.  This has happened to me:
https://thomask.sdf.org/blog/2019/11/09/take-care-editing-bash-scripts.html

And not having the writable bit may help prevent hardlink
corruption with OSTree in some cases.

We can't do this by default, but add a convenient CLI flag
for it.

5 years agoMerge pull request #2090 from cgwalters/sign-default-type
OpenShift Merge Robot [Mon, 4 May 2020 12:55:23 +0000 (14:55 +0200)]
Merge pull request #2090 from cgwalters/sign-default-type

signing: Add #define OSTREE_SIGN_NAME_ED25519

5 years agosigning: Add #define OSTREE_SIGN_NAME_ED25519
Colin Walters [Sun, 3 May 2020 17:04:27 +0000 (17:04 +0000)]
signing: Add #define OSTREE_SIGN_NAME_ED25519

Using `#define` or constants instead of strings helps avoid
typos and encourages documentation.

5 years agoMerge pull request #2089 from dbnicholson/flags-enums-as-bitfields
OpenShift Merge Robot [Fri, 1 May 2020 20:29:37 +0000 (22:29 +0200)]
Merge pull request #2089 from dbnicholson/flags-enums-as-bitfields

lib: Coerce flags enums to GIR bitfields

5 years agoMerge pull request #2087 from cgwalters/test-staged-deploy-cleanup
OpenShift Merge Robot [Fri, 1 May 2020 20:10:53 +0000 (22:10 +0200)]
Merge pull request #2087 from cgwalters/test-staged-deploy-cleanup

tests/staged-deploy: Cleanup initial state

5 years agolib: Coerce flags enums to GIR bitfields
Dan Nicholson [Thu, 30 Apr 2020 20:28:20 +0000 (14:28 -0600)]
lib: Coerce flags enums to GIR bitfields

The GI scanner decides if an `enum` is really a `bitfield` if it finds
any values that have left shifts. With an `enumeration`, the
introspecting language may error or convert to a different type if the
user tries to combine values. Change all Flags `enum`s to use
left-shifted values so that they're represented as `bitfield`s in the
GIR.

The primary bug here is that you can't combine `REFS_ONLY` and
`NO_PRUNE` when calling `OSTree.Repo.prune()` from an introspected
language.

This is an IABI break since the typelib will change from `enumeration`
to `bitfield`. `OstreeRepoImportFlags` is internal but the change is
included here to prepare for a subsequent name that would require bit
shifting to operate correctly as a flag.

5 years agotests/staged-deploy: Cleanup initial state
Colin Walters [Wed, 29 Apr 2020 01:45:48 +0000 (01:45 +0000)]
tests/staged-deploy: Cleanup initial state

I'm using [cosa build-fast](https://github.com/coreos/coreos-assembler/pull/1371)
and this test doesn't like starting out with two deployments.  Clean
things up to one at the start just to simplify things.

5 years agoMerge pull request #2084 from d4s/wip/d4s/expose_signapi_metadata
OpenShift Merge Robot [Wed, 29 Apr 2020 01:19:11 +0000 (03:19 +0200)]
Merge pull request #2084 from d4s/wip/d4s/expose_signapi_metadata

signapi: expose metadata format and key

5 years agosignapi: expose metadata format and key
Denis Pynkin [Fri, 24 Apr 2020 16:34:50 +0000 (16:34 +0000)]
signapi: expose metadata format and key

Explicitly expose functions for querying the metadata format
and key name used by OstreeSign object:
 - ostree_sign_metadata_format
 - ostree_sign_metadata_key

This allows to use the same metadata format and key name
by 3-rd party applications using signapi.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
5 years agoMerge pull request #2083 from agners/doc-updates
OpenShift Merge Robot [Fri, 24 Apr 2020 12:07:52 +0000 (14:07 +0200)]
Merge pull request #2083 from agners/doc-updates

Doc updates

5 years agodocs: extend repository types
Stefan Agner [Fri, 24 Apr 2020 11:12:47 +0000 (13:12 +0200)]
docs: extend repository types

Clarify where metadata are stored exactly in the `bare-user` case.
Make the first sentence of `bare-user` and `bare-user-only` paragraph
symetric to make it easier to jump to the right paragraph for readers
in a hury. Stree out that `bare-user-only` may loose metadata.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
5 years agodocs: extend object type documentation
Stefan Agner [Fri, 24 Apr 2020 11:05:15 +0000 (13:05 +0200)]
docs: extend object type documentation

Extend the object type documentation with file endings used for the
individual type. Also clarify in which situation content type objects
are used and why they do not match the SHA256 hash today.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
5 years agodocs: clarify archive repo type
Stefan Agner [Fri, 24 Apr 2020 11:02:05 +0000 (13:02 +0200)]
docs: clarify archive repo type

Today `archive-z2` is still used as the default string to indicate
a `archive` type repository. Make clear that this is the way it is
intended. Otherwise users might think they use an no longer supported
OSTree repository since the mode string is still `archive-z2`.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
5 years agoMerge pull request #2082 from cgwalters/finalize-sandbox
OpenShift Merge Robot [Wed, 22 Apr 2020 16:51:15 +0000 (18:51 +0200)]
Merge pull request #2082 from cgwalters/finalize-sandbox

finalize-staged: Add ProtectHome=yes and ReadOnlyPaths=/etc

5 years agoMerge pull request #2081 from cgwalters/deploy-etc
OpenShift Merge Robot [Wed, 22 Apr 2020 14:34:57 +0000 (16:34 +0200)]
Merge pull request #2081 from cgwalters/deploy-etc

deploy: Add --no-merge

5 years agofinalize-staged: Add ProtectHome=yes and ReadOnlyPaths=/etc
Colin Walters [Wed, 22 Apr 2020 14:26:23 +0000 (14:26 +0000)]
finalize-staged: Add ProtectHome=yes and ReadOnlyPaths=/etc

Same motivation as
https://github.com/coreos/rpm-ostree/pull/2060

I tried `InaccessiblePaths=/var` first and was very sad to find
out we have one tiny exception that breaks it.  Otherwise it'd
be so elegant.  Maybe in the future we split out that one thing
to a separate `ostree-finalized-stage-var.service` that's just
`ExecStart=/bin/rm -vf /var/.updated` and is otherwise
`ProtectSystem=strict` etc.

5 years agodeploy: Add --no-merge
Colin Walters [Tue, 21 Apr 2020 19:25:40 +0000 (19:25 +0000)]
deploy: Add --no-merge

All of the underlying libostree APIs have supported passing `NULL`
for a merge deployment for...a long time.  But we never plumbed
it up into the CLI.

Add a `--no-merge` option to aid people who want to do a "factory reset":
https://github.com/ostreedev/ostree/issues/1793

5 years agoMerge pull request #2079 from cgwalters/pull-split-sign-verify
OpenShift Merge Robot [Sat, 18 Apr 2020 17:57:08 +0000 (13:57 -0400)]
Merge pull request #2079 from cgwalters/pull-split-sign-verify

 lib: Move gpg/signapi bits into ostree-repo-pull-verify.c

5 years agolib: Move gpg/signapi bits into ostree-repo-pull-verify.c
Colin Walters [Fri, 17 Apr 2020 01:13:51 +0000 (01:13 +0000)]
lib: Move gpg/signapi bits into ostree-repo-pull-verify.c

`ostree-repo-pull.c` is huge; separate some of the GPG/signing
verification functions into their own file so they're more easily seen.

5 years agolib: Move pull struct definition into repo-pull-private.h
Colin Walters [Fri, 17 Apr 2020 01:20:28 +0000 (01:20 +0000)]
lib: Move pull struct definition into repo-pull-private.h

Prep for further splitting up `ostree-repo-pull.c`.

5 years agoMerge pull request #2077 from jlebon/pr/transaction-cleanup
OpenShift Merge Robot [Fri, 17 Apr 2020 19:15:12 +0000 (15:15 -0400)]
Merge pull request #2077 from jlebon/pr/transaction-cleanup

lib/commit: Check that dirent is a directory before cleaning

5 years agolib/commit: Check that dirent is a directory before cleaning
Jonathan Lebon [Fri, 17 Apr 2020 18:29:13 +0000 (14:29 -0400)]
lib/commit: Check that dirent is a directory before cleaning

I've only noticed this by inspection. But I think it's possible for
`cleanup_txn_dir` to get called with the `staging-...-lock` file since
it matches the prefix.

Make the checking here stronger by verifying that it's a directory. If
it's not a directory (lockfile), then follow the default pruning expiry
logic so that we still cleanup stray lockfiles eventually.

5 years agolib: Rename function for staging dir check
Jonathan Lebon [Fri, 17 Apr 2020 18:20:25 +0000 (14:20 -0400)]
lib: Rename function for staging dir check

Rename the function to more accurately reflect what it does, which is to
check whether the filename has the `staging-` prefix.

5 years agolib/commit: Add more error prefixing
Jonathan Lebon [Fri, 17 Apr 2020 18:18:28 +0000 (14:18 -0400)]
lib/commit: Add more error prefixing

We think we're hitting an error in that function in the Fedora infra.
Add some more error prefixing to help debugging.

5 years agoMerge pull request #2076 from d4s/wip/d4s/rename_with-libsodium_opt
OpenShift Merge Robot [Fri, 17 Apr 2020 17:30:36 +0000 (13:30 -0400)]
Merge pull request #2076 from d4s/wip/d4s/rename_with-libsodium_opt

sign: rename option for enabling ed25519

5 years agosign: rename option for enabling ed25519
Denis Pynkin [Fri, 17 Apr 2020 16:22:37 +0000 (19:22 +0300)]
sign: rename option for enabling ed25519

Use option `--with-ed25519-libsodium` instead of
`--with-libsodium` to enable ed25519 signature engine.

This allows to use later different implementations of ed25519
signing/verification. For instance, based on openssl.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
5 years agoMerge pull request #2073 from cgwalters/pull-private-cleanup
OpenShift Merge Robot [Fri, 17 Apr 2020 15:49:59 +0000 (11:49 -0400)]
Merge pull request #2073 from cgwalters/pull-private-cleanup

lib: Move internal binding verification API to repo.c

5 years agoMerge pull request #2075 from d4s/wip/d4s/test_system-wide_sign_conf
OpenShift Merge Robot [Fri, 17 Apr 2020 14:53:37 +0000 (10:53 -0400)]
Merge pull request #2075 from d4s/wip/d4s/test_system-wide_sign_conf

tests/signed-commit: fix the test of well-known places

5 years agotests/signed-commit: fix the test of well-known places
Denis Pynkin [Fri, 17 Apr 2020 13:46:49 +0000 (16:46 +0300)]
tests/signed-commit: fix the test of well-known places

Commit e474033e removed the redirection of incorrect public keys
aimed to generate a lot of files without correct public signature.

Fix the test by returning back the creation of files containing
incorrect public keys for ed25519.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
5 years agolib: Move internal binding verification API to repo.c
Colin Walters [Fri, 17 Apr 2020 01:16:51 +0000 (01:16 +0000)]
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`.

5 years agoMerge pull request #2070 from cgwalters/travis-libsodium
OpenShift Merge Robot [Thu, 16 Apr 2020 22:08:44 +0000 (15:08 -0700)]
Merge pull request #2070 from cgwalters/travis-libsodium

travis: Add some libsodium coverage

5 years agoAdd the same config options for distcheck
Denis Pynkin [Thu, 16 Apr 2020 19:29:55 +0000 (22:29 +0300)]
Add the same config options for distcheck

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
5 years agoFix the lost line separator
Denis Pynkin [Thu, 16 Apr 2020 19:12:51 +0000 (22:12 +0300)]
Fix the lost line separator

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
5 years agoAdd ci_pkgs to travis-install.sh
Denis Pynkin [Thu, 16 Apr 2020 18:57:51 +0000 (21:57 +0300)]
Add ci_pkgs to travis-install.sh

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
5 years agoMerge pull request #2072 from cgwalters/feature-ed25519
OpenShift Merge Robot [Thu, 16 Apr 2020 20:29:36 +0000 (13:29 -0700)]
Merge pull request #2072 from cgwalters/feature-ed25519

Use `sign-ed25519` for the feature name

5 years agotravis: Add some libsodium coverage
Colin Walters [Wed, 15 Apr 2020 22:16:58 +0000 (22:16 +0000)]
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.

5 years agoUse `sign-ed25519` for the feature name
Colin Walters [Thu, 16 Apr 2020 16:43:43 +0000 (16:43 +0000)]
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.

5 years agoMerge pull request #2071 from cgwalters/ci-min-check
OpenShift Merge Robot [Thu, 16 Apr 2020 15:47:45 +0000 (08:47 -0700)]
Merge pull request #2071 from cgwalters/ci-min-check

ci: Build minimal without libsodium too

5 years agoci: Build minimal without libsodium too
Colin Walters [Thu, 16 Apr 2020 14:15:04 +0000 (14:15 +0000)]
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)

5 years agoMerge pull request #2063 from cgwalters/sig-cleanups-2
OpenShift Merge Robot [Thu, 16 Apr 2020 08:38:12 +0000 (01:38 -0700)]
Merge pull request #2063 from cgwalters/sig-cleanups-2

pull: Cleanup signature verification functions

5 years agoChange signature opts to include type, cleanup error handling
Colin Walters [Sun, 12 Apr 2020 18:04:06 +0000 (18:04 +0000)]
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.

5 years agoMerge pull request #2068 from cgwalters/pull-cosmetic-renames
OpenShift Merge Robot [Wed, 15 Apr 2020 17:30:18 +0000 (10:30 -0700)]
Merge pull request #2068 from cgwalters/pull-cosmetic-renames

lib/pull: Two cosmetic internal function renames

5 years agolib/pull: Two cosmetic internal function renames
Colin Walters [Wed, 15 Apr 2020 14:46:08 +0000 (14:46 +0000)]
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.

5 years agoMerge pull request #2069 from jlebon/pr/tweak-ci
OpenShift Merge Robot [Wed, 15 Apr 2020 17:01:40 +0000 (19:01 +0200)]
Merge pull request #2069 from jlebon/pr/tweak-ci

ci: Adapt to use new fcosKola semantics

5 years agoci: Adapt to use new fcosKola semantics
Jonathan Lebon [Wed, 15 Apr 2020 16:36:52 +0000 (12:36 -0400)]
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.

5 years agoMerge pull request #2064 from cgwalters/dummy-only-when-testing
Denis Pynkin [Wed, 15 Apr 2020 09:28:52 +0000 (12:28 +0300)]
Merge pull request #2064 from cgwalters/dummy-only-when-testing

Only enable "dummy" signature type with opt-in env variable

5 years agoOnly enable "dummy" signature type with opt-in env variable
Colin Walters [Tue, 14 Apr 2020 22:18:13 +0000 (22:18 +0000)]
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.

5 years agoMerge pull request #2058 from cgwalters/signing-cleanups
OpenShift Merge Robot [Tue, 7 Apr 2020 18:49:04 +0000 (20:49 +0200)]
Merge pull request #2058 from cgwalters/signing-cleanups

pull: Update key loading function to match error style

5 years agoMerge pull request #2061 from cgwalters/add-d4s
OpenShift Merge Robot [Tue, 7 Apr 2020 17:45:17 +0000 (19:45 +0200)]
Merge pull request #2061 from cgwalters/add-d4s

OWNERS: add d4s to reviewers

5 years agoMerge pull request #2060 from d4s/ostree_repo_pull_with_options-gpg_check
OpenShift Merge Robot [Tue, 7 Apr 2020 14:04:22 +0000 (16:04 +0200)]
Merge pull request #2060 from d4s/ostree_repo_pull_with_options-gpg_check

lib/repo-pull: fix GPG check while pulling remote

5 years agoMerge pull request #2044 from martinezjavier/duplicated-entries
OpenShift Merge Robot [Tue, 7 Apr 2020 13:54:08 +0000 (15:54 +0200)]
Merge pull request #2044 from martinezjavier/duplicated-entries

grub2: Don't add menu entries if GRUB supports parsing BLS snippets

5 years agoOWNERS: add d4s to reviewers
Colin Walters [Tue, 7 Apr 2020 13:07:55 +0000 (13:07 +0000)]
OWNERS: add d4s to reviewers

He did a lot of work on signing and will continue that.

5 years agolib/repo-pull: fix GPG check while pulling remote
Denis Pynkin [Mon, 6 Apr 2020 22:11:29 +0000 (01:11 +0300)]
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>
5 years agoMerge pull request #2057 from cgwalters/test-sizes-error
OpenShift Merge Robot [Mon, 6 Apr 2020 20:33:43 +0000 (22:33 +0200)]
Merge pull request #2057 from cgwalters/test-sizes-error

tests/pull-sizes: Disable xattrs everywhere

5 years agoMerge pull request #2059 from cgwalters/commit-from-base-tree
OpenShift Merge Robot [Mon, 6 Apr 2020 20:18:49 +0000 (22:18 +0200)]
Merge pull request #2059 from cgwalters/commit-from-base-tree

commit: Add --base argument

5 years agoMerge pull request #2055 from cgwalters/gtkdoc-warnings
OpenShift Merge Robot [Mon, 6 Apr 2020 19:54:13 +0000 (21:54 +0200)]
Merge pull request #2055 from cgwalters/gtkdoc-warnings

lib: Squash two gtk-doc warnings

5 years agocommit: Add --base argument
Colin Walters [Sun, 5 Apr 2020 22:23:39 +0000 (22:23 +0000)]
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.

5 years agogrub2: Don't add menu entries if GRUB supports parsing BLS snippets
Javier Martinez Canillas [Thu, 26 Mar 2020 16:20:08 +0000 (17:20 +0100)]
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 985a1410029 ("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.

5 years agopull: Update key loading function to match error style
Colin Walters [Sun, 5 Apr 2020 18:22:49 +0000 (18:22 +0000)]
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.

5 years agotests/pull-sizes: Disable xattrs everywhere
Colin Walters [Sun, 5 Apr 2020 18:37:54 +0000 (18:37 +0000)]
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.

5 years agoMerge pull request #1878 from d4s/wip/d4s/no_gpg
OpenShift Merge Robot [Sat, 4 Apr 2020 17:46:12 +0000 (19:46 +0200)]
Merge pull request #1878 from d4s/wip/d4s/no_gpg

Alternative signing system

5 years agolib: Squash two gtk-doc warnings
Colin Walters [Sat, 4 Apr 2020 17:05:56 +0000 (17:05 +0000)]
lib: Squash two gtk-doc warnings

Just noticed these while doing a build.

5 years agoMerge pull request #2051 from fkrull/repo_finder_avahi
OpenShift Merge Robot [Wed, 1 Apr 2020 22:34:59 +0000 (00:34 +0200)]
Merge pull request #2051 from fkrull/repo_finder_avahi

lib: fix typo in function docs

5 years agolib: fix typo in function docs
Felix Krull [Wed, 1 Apr 2020 21:06:19 +0000 (23:06 +0200)]
lib: fix typo in function docs

5 years agoMerge pull request #2049 from cgwalters/sysroot-refactor
OpenShift Merge Robot [Wed, 1 Apr 2020 13:18:06 +0000 (15:18 +0200)]
Merge pull request #2049 from cgwalters/sysroot-refactor

sysroot: Reorganize sysroot load code a bit

5 years agosysroot: Reorganize sysroot load code a bit
Colin Walters [Wed, 22 Jan 2020 19:44:31 +0000 (19:44 +0000)]
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.

5 years agoMerge pull request #1973 from mwleeds/avoid-extraneous-summary-copy
OpenShift Merge Robot [Sun, 29 Mar 2020 00:04:57 +0000 (01:04 +0100)]
Merge pull request #1973 from mwleeds/avoid-extraneous-summary-copy

Don't copy summary for collection-ref mirror subset pulls

5 years agoMerge pull request #2045 from cgwalters/sysroot-load-err
OpenShift Merge Robot [Sat, 28 Mar 2020 17:44:49 +0000 (18:44 +0100)]
Merge pull request #2045 from cgwalters/sysroot-load-err

lib: Add error prefixing for sysroot load and repo open

5 years agoDon't copy summary for collection-ref mirror subset pulls
Matthew Leeds [Thu, 14 Nov 2019 02:30:58 +0000 (18:30 -0800)]
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.

5 years agofind-remotes: Add a --mirror option
Matthew Leeds [Thu, 14 Nov 2019 02:29:45 +0000 (18:29 -0800)]
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().

5 years agolib: Add error prefixing for sysroot load and repo open
Colin Walters [Sat, 28 Mar 2020 14:07:00 +0000 (14:07 +0000)]
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).

5 years agoostree-repo: improve error handling
Denis Pynkin [Mon, 23 Mar 2020 12:54:06 +0000 (15:54 +0300)]
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>
5 years agosign-pull: improve error handling
Denis Pynkin [Thu, 20 Feb 2020 00:59:05 +0000 (03:59 +0300)]
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>
5 years agolib/sign: return false for non-implemented functions
Denis Pynkin [Thu, 20 Feb 2020 00:24:14 +0000 (03:24 +0300)]
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>
5 years agotests/sign: check pull failure with invalid remote options
Denis Pynkin [Wed, 19 Feb 2020 23:43:36 +0000 (02:43 +0300)]
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>
5 years agolib/sign: convert ostree_sign_summary to new style
Denis Pynkin [Mon, 17 Feb 2020 21:50:21 +0000 (00:50 +0300)]
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>
5 years agosign-dummy: optimize ostree_sign_dummy_data_verify
Denis Pynkin [Mon, 17 Feb 2020 21:46:51 +0000 (00:46 +0300)]
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>
5 years agosign-ed25519: Convert functions to new style
Denis Pynkin [Mon, 17 Feb 2020 21:11:38 +0000 (00:11 +0300)]
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>
5 years agotests/sign: added check with file and single key on pull
Denis Pynkin [Fri, 31 Jan 2020 10:00:59 +0000 (13:00 +0300)]
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>