pull: Verify commits with gpg signatures from detached metadata
This uses gpgv for verification against DATADIR/ostree/pubring.gpg by default. The keyring can be overridden by specifying OSTREE_GPG_HOME. Add a unit test for commit signing with gpg key and verifying on pull; to implement this we ship a test GPG key generated with no password for Ostree Tester <test@test.com>. Change all of the existing tests to disable GPG verification.
This commit is contained in:
1 parent
b064581577
commit
7f9eefb62d
19 files changed
+657
-10
No files matched your search
@@ -91,6 +91,8 @@ typedef struct {
|
||||
gboolean transaction_resuming;
|
||||
volatile gint n_scanned_metadata;
|
||||
SoupURI *fetching_sync_uri;
|
||||
|
||||
gboolean gpg_verify;
|
||||
|
||||
GThread *metadata_thread;
|
||||
GMainContext *metadata_thread_context;
|
||||
@@ -747,6 +749,19 @@ scan_commit_object (OtPullData *pull_data,
|
||||
goto out;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GPGME
|
||||
if (pull_data->gpg_verify)
|
||||
{
|
||||
if (!ostree_repo_verify_commit (pull_data->repo,
|
||||
checksum,
|
||||
NULL,
|
||||
NULL,
|
||||
cancellable,
|
||||
error))
|
||||
goto out;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!ostree_repo_load_variant (pull_data->repo, OSTREE_OBJECT_TYPE_COMMIT, checksum,
|
||||
&commit, error))
|
||||
goto out;
|
||||
@@ -1234,6 +1249,14 @@ ostree_repo_pull (OstreeRepo *self,
|
||||
goto out;
|
||||
pull_data->base_uri = soup_uri_new (baseurl);
|
||||
|
||||
#ifdef HAVE_GPGME
|
||||
if (!ot_keyfile_get_boolean_with_default (config, remote_key, "gpg-verify",
|
||||
TRUE, &pull_data->gpg_verify, error))
|
||||
goto out;
|
||||
#else
|
||||
pull_data->gpg_verify = FALSE;
|
||||
#endif
|
||||
|
||||
if (!ot_keyfile_get_boolean_with_default (config, remote_key, "tls-permissive",
|
||||
FALSE, &tls_permissive, error))
|
||||
goto out;
|
||||
|
||||
Reference in new issue
Block a user