Commit Graph

1972 Commits

Author SHA1 Message Date
Matthew Barnes
aeab9df4fe Add OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER
Indicates the command requires superuser privilege.  Fails early with
a more helpful message than would otherwise be returned by libostree.

Currently all admin commands except 'status' require superuser.
2015-03-25 17:24:06 -04:00
Matthew Barnes
e48ea0ba05 Add OstreeAdminBuiltinFlags for admin commands
Only OSTREE_ADMIN_BUILTIN_FLAG_NONE so far; does nothing.
2015-03-25 17:24:06 -04:00
Matthew Barnes
6b16aba5f9 tests: Add a test case for unwritable repos 2015-03-25 17:24:06 -04:00
Matthew Barnes
1d5e2682fd Check repo permission prior to attempting to modify it
Fail early with a helpful message if the user does not have sufficient
permission to modify an OSTree repository.
2015-03-25 17:24:05 -04:00
Matthew Barnes
7941189dfd Add ostree_ensure_repo_writable()
Commands that need to write files within the repo directory can call
this early to ensure the directory is writable for the current user.
If not, it fails with a helpful "You need to be root to perform this
command" message.
2015-03-25 17:24:05 -04:00
Matthew Barnes
a25c7fab12 Add ostree_repo_is_writable() 2015-03-25 17:24:05 -04:00
Colin Walters
f89032f581 Release 2015.4 2015-03-25 12:50:50 -04:00
Colin Walters
6c787093e8 gpg-sign: Add missing NULL terminator in options 2015-03-24 09:57:52 -04:00
Alexander Larsson
74f4fc2bc8 Fix build with !HAVE_LIBSOUP
Fix up ostree_repo_pull to match the new declaration
2015-03-23 14:26:01 +01:00
Matthew Barnes
bf69c4b44a gpg-sign: Update man page for --delete option 2015-03-20 12:57:45 -04:00
Colin Walters
b11d0e5f52 libglnx: Update to latest
Just on general principle.  Newer is better.
2015-03-20 10:56:45 -04:00
Colin Walters
64ff3444f8 build: ostree-gpg-verify-result.h is a public header, install it 2015-03-20 10:56:23 -04:00
Alexander Larsson
d26359f823 Fix build failure on g_autoptr(gchar) with glib master
This was removed in favour of g_autofree
2015-03-20 15:36:56 +01:00
Matthew Barnes
da918a74d5 gpg: Regenerate test data for test-gpg-verify-result
Turns out the expired signature case was failing because the signature
itself was corrupted.  Reconstructed the test data and updated the test
code.  Note, an expired signature is still counted as valid.

Also, handy debugging trick for setting a key or signature expiry: the
CLI makes it appear the shortest expiry is 1 day, but it also secretly
recognizes "seconds=N".
2015-03-19 12:43:04 -04:00
Matthew Barnes
f9e95e2cd3 gpg: Link to GPGME bug about GPGME_SIGSUM_KEY_REVOKED 2015-03-19 10:21:08 -04:00
Matthew Barnes
9b8bad3c2e tests: Update test-gpg-signed-commit.sh
Utilize and test new CLI capabilities:

  - Signature count in 'ostree show' result
  - Duplicate signatures now rejected
  - Ability to delete signatures
2015-03-18 11:53:26 -04:00
Matthew Barnes
e48fd5e6bb show: Print a blurb for each signature on a commit
Roughly mimics the output of "gpg --verify".
2015-03-18 11:53:20 -04:00
Matthew Barnes
d886c9ccb5 gpg-sign: Add a --delete option to delete signatures 2015-03-18 11:53:13 -04:00
Matthew Barnes
9033cf5da1 repo: Reject duplicate signatures when signing commit
Uses OstreeGpgVerifyResult to catch duplicate signatures.

If the commit has already been signed with the given GPG key ID, fail
with a G_IO_ERROR_EXISTS error code.
2015-03-18 11:53:04 -04:00
Matthew Barnes
8d127b9dcb repo: Add ostree_repo_verify_commit_ext()
Similar to ostree_repo_verify_commit(), but returns more verification
details by way of an OstreeGpgVerifyResult object instead of a boolean.
2015-03-18 11:52:47 -04:00
Matthew Barnes
4a2733f9e7 gpg: Add OstreeGpgVerifyResult
Wrappers a referenced gpgme_verify_result_t so detailed verify results
can be examined independently of executing a verify operation.

_ostree_gpg_verifier_check_signature() now returns this object instead
of a single valid/invalid boolean, but the idea is for OstreeRepo to also
return this object for commit signature verification so it can be utilized
at the CLI layer (and possibly by other programs).
2015-03-18 11:52:22 -04:00
Dan Nicholson
553d7840d5 fsck: Fix object count output
The object count comes from g_hash_table_size(), so it's not a 0 based
index. In order to maintain the mod calculations correctly, just print
out index + 1.

https://bugzilla.gnome.org/show_bug.cgi?id=746360
2015-03-18 09:31:07 -04:00
Matthew Barnes
f47693440d OstreeGpgVerifier: Take the signed data as a GBytes
Similar to c2b01ad.  For some reason I was thinking the commit data
still needed to be written to disk prior to verifying, but it's just
another artifact of spawning gpgv2 (predates using GPGME).

Makes for a nice cleanup in fetch_metadata_to_verify_delta_superblock()
as well.
2015-03-16 16:37:11 -04:00
Matthew Barnes
c4998ab33f OstreeGpgVerifier: Don't add trustdb.gpg to the keyring list
In case someone like me is mucking around in $OSTREE_GPG_HOME and
accidentally creates a trust database there.
2015-03-16 10:06:43 -04:00
Giuseppe Scrivano
ccbb10d107 ostree-repo.c: fix typo
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-16 11:34:48 +01:00
Matthew Barnes
5a3300fe5b repo: Delete .commitmeta file on empty metadata
The API docs for ostree_repo_write_commit_detached_metadata() were
written as though it already behaved that way.

https://bugzilla.gnome.org/746123
2015-03-13 12:34:19 -04:00
Colin Walters
c732178a43 build: Use both pkg-config and AM_PATH_GPGME
Apparently OpenEmbeddeded only supports pkg-config (and includes
gpgme.pc in its content), and Fedora only has the latter.  So do both.
2015-03-11 16:22:52 -04:00
Matthew Barnes
187e8d632e configure.ac: Make gpgme a hard dependency
In anticipation of API enhancements for GPG signature verification, which
would otherwise require a non-functional stub version were GPGME excluded.

GPGME is a pretty lightweight dependency, and the motivation to exclude
it is not clear.
2015-03-11 12:03:33 -04:00
Colin Walters
8724adc193 README.md: Note make check 2015-03-10 21:51:20 -04:00
Colin Walters
9630d06ec7 sysroot: Port some deployment reading code to fd-relative APIs
More low hanging fruit in the sysroot department.
2015-03-10 10:47:47 -04:00
Colin Walters
6ac880c959 deployment: Add an API to get relative origin path
This will be used for fd-relative cleanups.
2015-03-10 10:47:47 -04:00
Colin Walters
c86a86f742 sysroot: Drop unnecessary new sysroot object
We're asserting that "/" is the same as our path, so we don't need to
make a new object.
2015-03-10 08:41:04 -04:00
Daniel Drake
5c1839c4db ostree-prepare-root: log informational messages to stdout
ostree-prepare-root was logging normal, informational messages
to stderr which the systemd unit points to the console.

To achieve silent boot, log these ordinary messages to stdout only.
2015-03-09 21:26:13 -04:00
Colin Walters
40385c9874 glnx: Update 2015-03-09 21:25:06 -04:00
Colin Walters
a282f94f5d sysroot: Make origin parsing code fd-relative
Just more API conversion.
2015-03-09 14:29:14 -04:00
Colin Walters
68ce554202 sysroot: Read the bootloader configuration with fd-relative API
Another piece of the conversion.
2015-03-09 14:29:14 -04:00
Colin Walters
a5ffaca9d7 sysroot: Read some bootloader state with fd-relative API
This is the start of migrating the deployment path to fd-relative
code.
2015-03-09 14:29:14 -04:00
Giuseppe Scrivano
3f3096a65c tests: Add tests for test-ot-tool-util
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-06 18:45:38 +01:00
Giuseppe Scrivano
ab39f59249 src: Drop unused argument "value" from ot_parse_boolean
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-06 18:45:38 +01:00
Giuseppe Scrivano
c70abfd43c src: Move ot-tool-util from ostree/ to libotutil/
These utilities are not actually specific to the ostree commandline.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-06 18:45:38 +01:00
Giuseppe Scrivano
479b5ab4fc libotutil: remove ot-waitable-queue.
The module is not not used anymore.  It can be restored from git if
needed again.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-06 18:45:38 +01:00
Giuseppe Scrivano
c1c34c601a tests: add test for test-ot-opt-utils.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-06 18:45:38 +01:00
Giuseppe Scrivano
50c69c3392 keyfile-utils: add tests
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-06 18:45:37 +01:00
Giuseppe Scrivano
021c55f430 ot_keyfile_copy_group: return FALSE on invalid inputs
The function returns a gboolean, replace g_return_if_fail with
g_return_val_if_fail.

Add similar checks to the other functions.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-06 18:45:37 +01:00
Giuseppe Scrivano
bfd92653c3 ostree-repo-refs: Drop unused function "parse_rev_file".
If it will be needed in future, it can be retrieved from the git
history.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-06 18:45:37 +01:00
Giuseppe Scrivano
150048f9b8 src: drop some dead assignments
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-06 18:45:37 +01:00
Matthew Barnes
c2b01adbf0 OstreeGpgVerifier: Take the signature as a GBytes
The signature data is in memory to begin with, so there's no need to
write it to disk only to immediately read it back.

Also, because the GPGME multi-keyring workaround is somewhat expensive
to setup and teardown, concatenate all signatures into a single GBytes
so _ostree_gpg_verifier_check_signature() is only called once.  We're
currently only looking for one valid signature anyway.
2015-03-06 08:22:44 -05:00
Matthew Barnes
70cabcea0a gpg: Rewrite OstreeGpgVerifier to use GPGME
This sets the stage for more advanced signature management.

(Also, talking to GPG over pipes sucks.)

Previously we were spawning gpgv2 with a bunch of --keyring options
for /usr/share/ostree/trusted.gpg.d/ and whatever other keyring files
were explicitly added.  GPGME has no public API for multiple keyrings,
so we work around the issue by setting up a temp directory to serve as
a fake "home" directory for the crypto engine and then concatenate all
the keyring files into a single public keyring (pubring.gpg).

Unfortunately at present we do this on every signature verification.
There's a desire to cache this concatenation, but the problem is the
user may be unprivileged.  So it seems the cache would have to be per
user under $XDG_CACHE_HOME, which OSTree doesn't otherwise use.  I'm
open to suggestions.

We do at least clean up the temp directory when finished, and I have
further API changes planned to OstreeGpgVerifier to help mitigate the
performance impact.
2015-03-06 08:22:44 -05:00
Giuseppe Scrivano
d414ee5852 tests: add tests for mutable tree.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-04 17:52:17 -05:00
Colin Walters
191d78ebfc repo: Fix assertion to allow NULL options
Spotted by Adam Coldrick.
2015-03-03 21:18:40 -05:00