pull: Add support for sign-verify=<list>
The goal here is to move the code towards a model where the *client* can explicitly specify which signature types are acceptable. We retain support for `sign-verify=true` for backwards compatibility. But in that configuration, a missing public key is just "no signatures found". With `sign-verify=ed25519` and no key configured, we can explicitly say `No keys found for required signapi type ed25519` which is much, much clearer. Implementation side, rather than maintaining `gboolean sign_verify` *and* `GPtrArray sign_verifiers`, just have the array. If it's `NULL` that means not to verify. Note that currently, an explicit list is an OR of signatures, not AND. In practice...I think most people are going to be using a single entry anyways.
This commit is contained in:
1 parent
8801e38bba
commit
5cb9d0df38
4 files changed
+174
-83
No files matched your search
@@ -23,7 +23,7 @@ set -euo pipefail
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
echo "1..16"
|
||||
echo "1..20"
|
||||
|
||||
# This is explicitly opt in for testing
|
||||
export OSTREE_DUMMY_SIGN_ENABLED=1
|
||||
@@ -102,6 +102,31 @@ test_signed_pull "dummy" ""
|
||||
repo_init --sign-verify=dummy=inline:${DUMMYSIGN}
|
||||
test_signed_pull "dummy" "from remote opt"
|
||||
|
||||
# And now explicitly limit it to dummy
|
||||
repo_init
|
||||
${CMD_PREFIX} ostree --repo=repo config set 'remote "origin"'.sign-verify dummy
|
||||
${CMD_PREFIX} ostree --repo=repo config set 'remote "origin"'.verification-dummy-key "${DUMMYSIGN}"
|
||||
test_signed_pull "dummy" "explicit value"
|
||||
|
||||
# dummy, but no key configured
|
||||
repo_init
|
||||
${CMD_PREFIX} ostree --repo=repo config set 'remote "origin"'.sign-verify dummy
|
||||
if ${CMD_PREFIX} ostree --repo=repo pull origin main 2>err.txt; then
|
||||
assert_not_reached "pull with nosuchsystem succeeded"
|
||||
fi
|
||||
assert_file_has_content err.txt 'No keys found for required signapi type dummy'
|
||||
echo "ok explicit dummy but unconfigured"
|
||||
|
||||
# Set it to an unknown explicit value
|
||||
repo_init
|
||||
${CMD_PREFIX} ostree --repo=repo config set 'remote "origin"'.sign-verify nosuchsystem;
|
||||
${CMD_PREFIX} ostree --repo=repo config set 'remote "origin"'.verification-dummy-key "${DUMMYSIGN}"
|
||||
if ${CMD_PREFIX} ostree --repo=repo pull origin main 2>err.txt; then
|
||||
assert_not_reached "pull with nosuchsystem succeeded"
|
||||
fi
|
||||
assert_file_has_content err.txt 'Requested signature type is not implemented'
|
||||
echo "ok pull failure for unknown system"
|
||||
|
||||
repo_init
|
||||
if ${CMD_PREFIX} ostree --repo=repo remote add other --sign-verify=trustme=inline:ok http://localhost 2>err.txt; then
|
||||
assert_not_reached "remote add with invalid keytype succeeded"
|
||||
|
||||
Reference in new issue
Block a user