| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some test results are dependent on the kernel configuration option
CONFIG_SYSTEM_BLACKLIST_AUTH_UPDATE.
Check the kernel configuration file for its presence and expect appropriate
test results.
Function has_kernel_config is based on its xfstsests counterpart.
Signed-off-by: Pavel Reichl <preichl@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
| |
Signed-off-by: Pavel Reichl <preichl@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
| |
Signed-off-by: Daniel Hill <daniel@gluo.nz>
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/r/CAMtG=2qKrGC-QzPENXsV8_7VBbi6sEnA6joV=SL8MQP1pfV8KA@mail.gmail.com/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Resolves the following compiler error:
keyctl_watch.c: In function 'consumer':
keyctl_watch.c:177:61: error: format '%zx' expects argument of type 'size_t', but argument 3 has type 'int' [-Werror=format=]
177 | fprintf(stderr, "NOTIFY[%03zx]: ty=%06x sy=%02x i=%08x\n",
| ~~~~^
| |
| long unsigned int
| %03x
178 | p - buffer, n.n.type, n.n.subtype, n.n.info);
| ~~~~~~~~~~
| |
| int
Signed-off-by: Alyssa Ross <hi@alyssa.is>
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/r/20230301134250.301819-1-hi@alyssa.is/
|
|
|
|
|
|
|
|
|
| |
Fix a formatting and a command output on
the keyctl.1 man page in a couple of places.
Signed-off-by: Vladis Dronov <vdronov@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/r/20220510110444.14192-1-vdronov@redhat.com/
|
|
|
|
|
|
| |
Ignore the cxx.stamp file created during the build.
Signed-off-by: David Howells <dhowells@redhat.com
|
| |
|
|
|
|
|
|
|
| |
Add the ability to supply filters to watches set with "keyctl watch" and
"keyctl watch_session".
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
| |
Make the testing infrastructure do automatic checking for notifications as
tests manipulate keys.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add keyctl commands and library functions to handle the setting and removal
of watches on keys for notifications of change events. Five keyctl
commands are defined:
(1) keyctl watch <key>
Watch the specified key for changes, logging notifications to stdout.
(2) keyctl watch_session [-n <name>] <notifylog> <gclog> <fd> prog [<arg>...]
Create a new session keyring and attach a watch to it that an
auxiliary logging process monitors. The nominated program is run with
the session program with the arguments given.
The session keyring can be given a name. The logging process will log
synchronous events to file notifylog and asynchronous events to file
gclog.
The specified file descriptor will be attached to the watch_queue and
left open across the exec. This can be made use of by the next few
commands.
(3) keyctl watch_add <fd> <key>
(4) keyctl watch_rm <fd> <key>
Add/remove a watch on the specified key to/from the given watch_queue
derived from watch_session.
(5) keyctl watch_sync <fd>
Wait for the logging process that's watching the given watch_queue to
synchronise.
Commands (2) to (5) are primarily provided for the testsuite's purposes.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
| |
This reverts commit 1aafbdcf1d60c5c9eb34fe404f9a9195c8ea415e which was from
the wrong branch and expects /dev/watch_queue to be available.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
| |
This reverts commit 9419ac428efe8385cb2c19680d6b90c90e5335d1 which was from
the wrong branch and expects /dev/watch_queue to be available.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
| |
This reverts commit 5ac409b01cc4fcb69d903408da90df2d34d4f32a which was from
the wrong branch and expects /dev/watch_queue to be available.
Signed-off-by: David Howells <dhowells@redhat.com>
|
| |
|
|
|
|
| |
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
|
| |
Declare all the functions as extern "C" in keyutils.h to instruct a
C++ compiler that these functions are not mangled.
Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
| |
Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The declaration of the keyctl_dh_compute_kdf() function contains a
parameter named "private". Unfortunately, "private" is a C++ reserved
keyword. As a consequence, compiling a C++ program that includes
keyutils.h fails.
This patch renames the "private" variable to "priv" since a similar
parameter is named this way in the nearby keyctl_dh_compute()
function.
Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
| |
Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
| |
Add the ability to supply filters to watches set with "keyctl watch" and
"keyctl watch_session".
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
| |
Make the testing infrastructure do automatic checking for notifications as
tests manipulate keys.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add keyctl commands and library functions to handle the setting and removal
of watches on keys for notifications of change events. Five keyctl
commands are defined:
(1) keyctl watch <key>
Watch the specified key for changes, logging notifications to stdout.
(2) keyctl watch_session [-n <name>] <notifylog> <gclog> <fd> prog [<arg>...]
Create a new session keyring and attach a watch to it that an
auxiliary logging process monitors. The nominated program is run with
the session program with the arguments given.
The session keyring can be given a name. The logging process will log
synchronous events to file notifylog and asynchronous events to file
gclog.
The specified file descriptor will be attached to the watch_queue and
left open across the exec. This can be made use of by the next few
commands.
(3) keyctl watch_add <fd> <key>
(4) keyctl watch_rm <fd> <key>
Add/remove a watch on the specified key to/from the given watch_queue
derived from watch_session.
(5) keyctl watch_sync <fd>
Wait for the logging process that's watching the given watch_queue to
synchronise.
Commands (2) to (5) are primarily provided for the testsuite's purposes.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
| |
Open API version KEYUTILS_1.10 in the shared library.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Address records obtained from getaddrinfo() don't come with any TTL
information, even if they're obtained from the DNS, with the result that
key.dns_resolver upcall program doesn't set an expiry time on dns_resolver
records unless they include a component obtained directly from the DNS,
such as an SRV or AFSDB record.
Fix this to apply a default TTL of 10mins in the event that we haven't got
one. This can be configured in /etc/keyutils/key.dns_resolver.conf by
adding the line:
default_ttl = <number-of-seconds>
to the file.
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Ben Boeckel <me@benboeckel.net>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
|
|
|
|
|
|
|
| |
Use the rpmspec program to calculate the package name rather than trying to
substitute macros that keep changing.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
| |
Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
|
| |
The prose mentions this, but the return value section gave conflicting
information.
Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The key being added or updated likely contains secrets so it would be best
not to leave it in memory or in a core dump when no longer needed.
Glibc 2.25+ provides the explicit_bzero() function that can be used for
this purpose, let's utilize it if it is present.
Tested by redefining exit(n) to abort() and inspecting the resulting core
file for key data.
Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
| |
Use keyctl add's hex input capability for keyctl/dh_compute/bad-args rather
than an "echo -e | keyctl padd" construct.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These stanzas were essentially duplicates of the previous blocks.
Fix them to test first disabling Search on the first keyring and then the
second keyring. Also add disabling of Search on the target key and
checking searches from the session keyring.
[DH: Modified to fix the searches and add Ben's change as a separate test
in its own right]
Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
| |
This should fail because the actually found key has a type mismatch.
Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
|
| |
This comment was copied from another test. This one actually fails
because search permissions were also removed.
Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
| |
Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
|
| |
Testing the `0` ID just repeats the "BAD KEY" tests at the beginning of
the file.
Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
| |
Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
| |
Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
|
| |
Both spelling seems to be accepted, but the majority of uses agreed on
the "unparsable" variant.
Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
| |
Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
| |
Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
| |
Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
|
| |
Fold the use of expect_keyid into create_key and suchlike to make it easier
to integrate notification checks into the existing superstructure, thereby
making them happen automatically rather than having to manually code them.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
| |
Fix the determination of the version string for "make rpm" by making sure
that all otherwise unhandled %{...} variable substitutions get deleted.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
| |
The guesser for the default LIBDIR examines the libraries used by make,
looking for libc. Make uses libcrypt as well as libc, so if libcrypt
happens to come first, that matches and the sed command to extract the
library path fails.
Fix this by looking for a match on "libc." instead of "libc".
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
| |
Test kernel features like the builtin trusted keyring.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
| |
Use hex-converting padd to load data for dh_compute tests.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allow add, padd, update, pupdate, instantiate, pinstantiate and
dh_compute_kdf_oi to take hex-encoded data which is then converted into
binary before being passed to the kernel, e.g.:
$ keyctl add -x user foo 686578 @s
$ echo 686578 | keyctl padd -x user foo @s
This makes it easier to stash data in scripts.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
| |
Check that the KEYCTL_SESSION_TO_PARENT keyctl function works.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
Allow "keyctl new_session" to name the session keyring it creates and
attaches to the parent:
$ keyctl new_session fred
52095209
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a keyctl command to look up a symbolic key ID (such as "@s") or a named
reference (such as "%user:foo") and return the numeric ID for the key or
keyring, eg:
$ keyctl id @s
259509209
The command will also just convert numeric IDs to themselves.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
|
|
|
| |
Put the keyctl get_persistent command in the right place in the alphabetic
command order.
Signed-off-by: David Howells <dhowells@redhat.com>
|