Colin Walters [Mon, 25 Oct 2021 07:07:28 +0000 (07:07 +0000)]
prepare-root: Set up sysroot readonly in initramfs
Let's ensure things are right from the start in the initramfs;
this closes off various race conditions. Followup to
https://github.com/ostreedev/ostree/pull/2113/commits/35642259175973617da937f3cab6ce5f13c95077
Luca BRUNO [Mon, 1 Nov 2021 09:09:58 +0000 (09:09 +0000)]
prepare-root: check for read-only sysroot status early on
This moves read-only sysroot checks upfront, so that they are not
intermixed with mount operations.
It has no immediate side-effects, but allow these check to be
independent from the rest of the mounting logic (and future changes
to it).
Luca BRUNO [Tue, 26 Oct 2021 10:12:27 +0000 (10:12 +0000)]
prepare-root: make all mount operations silent
This adds a `MS_SILENT` flag to all `mount(2)` calls, reducing the
amount of kernel logs produced on each boot.
Those messages do not contain actionable details, and in the "mount
plus read-only remount" case they can easily become highly redundant.
Luca BRUNO [Tue, 19 Oct 2021 08:03:09 +0000 (08:03 +0000)]
tests/var-mount: tweak test setup
This reworks the var-mount destructive test in order to properly use
the datadir for the current stateroot instead of a duplicated one.
In turn, it ensures that the resulting `var.mount` after reboot is
correctly pointing to the same location which hosted `/var` on the
previous boot.
Colin Walters [Thu, 14 Oct 2021 14:40:39 +0000 (10:40 -0400)]
ci: Enable -fanalyzer
Followup to https://github.com/ostreedev/ostree/pull/2463
One thing I noticed here is we lost usage of `build-check.sh`
which also invokes `clang`, which doesn't speak `-fanalyzer`
and would be broken by this if we try to enable `build-check.sh`
again. But that can come later.
Colin Walters [Fri, 8 Oct 2021 12:59:52 +0000 (08:59 -0400)]
fetcher/soup: Fix gcc `-fanalyzer` warning
In general, we're probably going to need to change most of our
`g_return_if_fail` to `g_assert`. The analyzer flags that
the function can return `NULL`, but the caller isn't prepared for
this.
Colin Walters [Fri, 8 Oct 2021 12:59:52 +0000 (08:59 -0400)]
sysroot: Fix gcc `-fanalyzer` warning
In general, we're probably going to need to change most of our
`g_return_if_fail` to `g_assert`. The analyzer flags that
the function can return `NULL`, but the caller isn't prepared for
this.
Colin Walters [Fri, 8 Oct 2021 12:59:52 +0000 (08:59 -0400)]
deployment: Fix gcc `-fanalyzer` warning
In general, we're probably going to need to change most of our
`g_return_if_fail` to `g_assert`. The analyzer flags that
the function can return `NULL`, but the caller isn't prepared for
this.
Colin Walters [Fri, 8 Oct 2021 12:59:52 +0000 (08:59 -0400)]
remote: Fix gcc `-fanalyzer` warning
In general, we're probably going to need to change most of our
`g_return_if_fail` to `g_assert`. The analyzer flags that
the function can return `NULL`, but the caller isn't prepared for
this.
Luca BRUNO [Mon, 11 Oct 2021 06:52:25 +0000 (06:52 +0000)]
repo/private: move OstreeRepoAutoTransaction to a boxed type
This defines `OstreeRepoAutoTransaction` as a boxed type, in order
to support auto-generating bindings for it.
That first requires adding internal reference-counting to it, to
allow freely copying/freeing references to a single transaction guard.
Luca BRUNO [Thu, 7 Oct 2021 14:40:31 +0000 (14:40 +0000)]
prepare-root: tweak log messages to clarify errors
This rewords errors and log messages in the functions which take care
of preparing sysroot in initramfs.
Depending on the boot flow, it is possible to reach this logic
with a sysroot mounted (unexpectedly) as read-only.
In that case, let's clearly point out the problematic mountpoint.
Colin Walters [Wed, 6 Oct 2021 16:42:56 +0000 (12:42 -0400)]
Remove OstreeTlsCertInteraction bits from introspection
We filter out everything named `-private.h` from scanning,
which differs from the gtk-doc exclude. Eventually this will
be solved when we switch to the new gir-based docs.
Came up in https://github.com/ostreedev/ostree-rs/pull/34#discussion_r723337772
Luca BRUNO [Fri, 1 Oct 2021 16:04:02 +0000 (16:04 +0000)]
repo/private: allow committing/aborting through a transaction guard
This enhances the auto-transaction logic, augmenting the scope of a
transaction guard.
It allows committing or aborting a transaction through its guard.
It also supports tracking the completion status of a transaction
guard, avoiding double commits/aborts, while retaining the auto-cleanup
logic.
Colin Walters [Thu, 30 Sep 2021 19:53:18 +0000 (15:53 -0400)]
deploy: Ignore sockets, fifos in /etc during merge
https://bugzilla.redhat.com/show_bug.cgi?id=1945274 is an issue where a privileged
kubernetes daemonset is writing a socket into `/etc`. This makes ostree upgrades barf.
Now, they should clearly move it to `/run`. However, one option is for us to
just ignore it instead of erroring out. Some brief investigation shows that
e.g. `git add somesocket` is a silent no-op, which is an argument in favor of ignoring it.
Colin Walters [Tue, 28 Sep 2021 21:40:28 +0000 (17:40 -0400)]
repo: Add an API to init `OstreeSePolicy` from commit directly
This is part of `OstreeCommitModifier`, but I'm not using
that in some of the ostree-ext Rust code.
It just makes more sense as a direct policy API, where it should
have been in the first place. There's already support for
setting a policy object on a commit modifier, so that's all the
old API needs to do now.
Colin Walters [Wed, 29 Sep 2021 13:03:24 +0000 (09:03 -0400)]
bin/commit: Fix --tree=tar with --selinux-policy
The logic for `--selinux-policy` ended up in the `--tree=dir`
path, but there's no reason for that. Fix the imported
labeling with `--tree=tar`. Prep for use with containers.
We had this bug because the previous logic was trying to avoid
duplicating the code for generic `--selinux-policy` and
the case of `--selinux-policy-from-base --tree=dir`.
It's a bit more code, but it's cleaner if we dis-entangle them.
Colin Walters [Fri, 10 Sep 2021 21:07:42 +0000 (17:07 -0400)]
tests: Add new TAP APIs
Having to touch a global test counter when adding tests is
a recipe for conflicts between PRs.
The TAP protocol allows *ending* with the expected number of
tests, so the best way to do this is to have an explicit
API like our `tap_ok` which bumps a counter, then end with `tap_end`.
Colin Walters [Tue, 7 Sep 2021 22:02:24 +0000 (18:02 -0400)]
Add support for "custom remotes"
This will be helpful for the "ostree native container" work in
https://github.com/ostreedev/ostree-rs-ext/
Basically in order to reuse GPG/signapi verification, we need
to support adding a remote, even though it can't be used via
`ostree pull`. (At least, not until we merge ostree-rs-ext into ostree, but
even then I think the principle stands)
repo-pull: legacy_transaction_resuming flag ignored
for deltafiles the legacy_transaction_resuming flag is not used,
which will mark the commit as done, even if files are missing.
using already existing commitstate_is_partial function as fix
Colin Walters [Thu, 2 Sep 2021 20:59:15 +0000 (16:59 -0400)]
upgrade: Stabilize deployment staging
We're waaay overdue for this, it's been the default
in rpm-ostree for years, and solves several important bugs
around not capturing `/etc` while things are running.
Also, `ostree admin upgrade --stage` (should) become idempotent.
Luca BRUNO [Mon, 30 Aug 2021 15:55:16 +0000 (15:55 +0000)]
tests: skip a broken fsck case
There are some existing issues around fsck in unprivileged bare mode,
so this test does not really work at the moment. Leaving it as a FIXME
for the moment.
Colin Walters [Thu, 26 Aug 2021 16:47:00 +0000 (12:47 -0400)]
tests/basic: Skip --no-xattrs if we have selinux
It cannot work to use `--no-xattrs` when SELinux is enabled
because we get a `security.selinux` attribute on created files
regardless. So just skip this test if true.
Also add some `ostree fsck`s in here which helped me debug
this.
Colin Walters [Mon, 12 Apr 2021 22:42:05 +0000 (18:42 -0400)]
Add an API to verify a commit signature explicitly
We have a bunch of APIs to do GPG verification of a commit,
but that doesn't generalize to signapi. Further, they
require the caller to check the signature status explicitly
which seems like a trap.
This much higher level API works with both GPG and signapi.
The intention is to use this in things that are doing "external
pulls" like the ostree-ext tar import support. There we will
get the commitmeta from the tarball and we want to verify it
at the same time we import the commit.
Colin Walters [Thu, 26 Aug 2021 13:53:56 +0000 (09:53 -0400)]
ci: Run main GH action CI build+test as non-root
This is really the standard best practice, matching how
e.g. dpkg/rpm work, as well as most local development
environments (including mine) with e.g. `toolbox`.
Luca BRUNO [Wed, 25 Aug 2021 12:30:21 +0000 (12:30 +0000)]
lib: improve transactions auto-cleanup logic
This fixes some aspects of OstreeRepoAutoTransaction and re-aligns
it with the logic in flatpak. Specifically:
* link to the underlying repo through refcounting
* bridge internal errors to warning messages
* verify the input pointer type
This is a preparation step before exposing this logic as a public API.