summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Allow retrieval of raw data with "keyctl supports"David Howells2019-08-192-9/+31
| | | | | | | Allow "keyctl supports" to be given a "--raw" flag to request a hexdump of the data retrieved. Signed-off-by: David Howells <dhowells@redhat.com>
* Add namespace-related capability tagsDavid Howells2019-08-194-0/+27
| | | | | | | Add missing ns_keyring_name and ns_key_tag capability tags to "keyctl supports". Signed-off-by: David Howells <dhowells@redhat.com>
* test: Test all possible type, description and payload lengths to add_keyDavid Howells2019-08-195-20/+310
| | | | | | | | | | | Test all possible type, description and payload lengths to add_key() to make sure that the kernel doesn't crash when handling them. The bulk of this test is implemented in C in the keyctl command so that it completes in a reasonable amount of time (testing over a million different sizes of payload from shell script is just too slow). Signed-off-by: David Howells <dhowells@redhat.com>
* Move to version 1.6.1v1.6.1David Howells2019-08-021-1/+7
|
* test: Use capabilities query function in test scriptsDavid Howells2019-06-191-36/+42
| | | | Signed-off-by: David Howells <dhowells@redhat.com>
* Provide the ability to query subsystem capabilitiesDavid Howells2019-06-1910-0/+355
| | | | | | Provide the ability to query the capabilities of the keyrings subsystem. Signed-off-by: David Howells <dhowells@redhat.com>
* Add support for KEYCTL_MOVEDavid Howells2019-06-1913-2/+755
| | | | Signed-off-by: David Howells <dhowells@redhat.com>
* Make key=value argument list optional for pkey_{encrypt,decrypt,sign}Lennert Buytenhek2019-06-191-3/+3
| | | | | | | | | | | | | keyctl's help message suggests that including a key=value style list of arguments is optional for the pkey_* operations, and for pkey_query and pkey_verify it indeed seems to be optional, but the other three operations require that at least one key=value pair be passed in. This patch changes the logic to make key=value lists optional for all pkey_* operations. Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org> Signed-off-by: David Howells <dhowells@redhat.com>
* Fix syscall signature for KEYCTL_PKEY_QUERYLennert Buytenhek2019-06-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, running 'keyctl pkey_query' (or pkey_{encrypt,decrypt,sign}, due to those using pkey_query internally) will always return: keyctl_pkey_query: Invalid argument This is because we invoke KEYCTL_PKEY_QUERY as: return keyctl(KEYCTL_PKEY_QUERY, key_id, info, result); While the kernel code (security/keys/keyctl.c) does this: [...] case KEYCTL_PKEY_QUERY: if (arg3 != 0) return -EINVAL; return keyctl_pkey_query((key_serial_t)arg2, (const char __user *)arg4, (struct keyctl_pkey_query __user *)arg5); [...] In other words, there is supposed to be an argument between 'key_id' and 'info' (presumably for the (currently unsupported) key password field?) which is supposed to be NULL. Adding a NULL argument seems to make things happy. Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org> Signed-off-by: David Howells <dhowells@redhat.com>
* Fix 'keyctl pkey_query' argument parsingLennert Buytenhek2019-06-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | keyctl's pkey_* operations each have an argument that allows specifying a key password, but since that feature isn't currently supported, it is supposed to always be passed in as "0": if (strcmp(argv[2], "0") != 0) { fprintf(stderr, "Password passing is not yet supported\n"); exit(2); } However, act_keyctl_pkey_query() has an off-by-one that makes it start parsing key=value style option pairs at the password argument, which causes the following error if the password argument is not in key=value format: $ keyctl pkey_query 541826697 0 Option not in key=val form $ And this error if the password argument is in key=value format: $ keyctl pkey_query 541826697 a=b Password passing is not yet supported $ This patch fixes act_keyctl_pkey_query() to start parsing key=value pairs from the right place in its argument list, which gets it a little further. Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org> Signed-off-by: David Howells <dhowells@redhat.com>
* man: keyctl_pkey_verify(3) should point to keyctl_pkey_sign(3)Dominik Brodowski2019-05-031-1/+1
| | | | | | | | This fixes man(1) and mandb(8) complaining that keyctl_pkey_verify.3.gz is self referencing. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: David Howells <dhowells@redhat.com>
* man: do not include keyctl_pkey_sign(3) in its own 'see also' sectionDominik Brodowski2019-05-031-1/+0
| | | | | | | | This fixes an endless manual recursion in the "see also" section of keyctl_pkey_sign(3). Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: David Howells <dhowells@redhat.com>
* TEST: Add requirementDavid Howells2019-04-261-1/+2
| | | | | | | The testsuite now requires lsb_release, so we need to make sure we require the package that supplies it when inside the RH test farm. Signed-off-by: David Howells <dhowells@redhat.com>
* TEST: Apply test exclusions for RHEL-8David Howells2019-04-171-1/+4
| | | | | | | RHEL-8 doesn't enable the DH/KDF code, so disable the tests on all RHEL distributions for now. Signed-off-by: David Howells <dhowells@redhat.com>
* Handle %{?distprefix} in rpm buildDavid Howells2019-03-041-3/+4
| | | | | | | Handle %{?distprefix} cropping up in the release string used to generate the src.rpm name. Signed-off-by: David Howells <dhowells@redhat.com>
* keyctl: use keyctl_read_alloc() in dump_key_tree_aux()Eric Biggers2019-01-161-17/+6
| | | | | | | | | | | | | | | | dump_key_tree_aux() (part of 'keyctl show') was racy: it allocated a buffer for the keyring contents, then read the keyring. But it's possible that keys are added to the keyring concurrently. This is problematic for two reasons. First, when keyctl_read() is passed a buffer that is too small, it is unspecified whether it is filled or not. Second, even if the buffer is filled, some keys (not necessarily even the newest ones) would be omitted from the listing. Switch to keyctl_read_alloc() which handles the "buffer too small" case correctly by retrying the read. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: David Howells <dhowells@redhat.com>
* man: keyctl_read(3): fix documentation for short buffer caseEric Biggers2019-01-161-4/+4
| | | | | | | | | | | | When keyctl_read() is passed a buffer that is too small, the behavior is inconsistent. Some key types will fill as much of the buffer as possible, while others won't copy anything. Moreover, the in-kernel documentation contradicted the man page on this point. Update the man page to say that this point is unspecified. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: David Howells <dhowells@redhat.com>
* Move to version 1.6v1.6David Howells2018-11-132-2/+23
| | | | Signed-off-by: David Howells <dhowells@redhat.com>
* keyutils: Add pkg-config file for keyutils libraryDave Jiang2018-11-133-1/+32
| | | | | | | | | | | This is needed so that other projects can add a dependency on libkeyutils via PKG_CHECK_MODULES([KEYUTILS], [libkeyutils]). This enabling makes 'make install' do the right thing, and of course individual distros will need to add enabling to their associated packages (rpm, deb, etc.) so the package manager installs do the right thing. Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: David Howells <dhowells@redhat.com>
* Add man pages for asymmetric key type and opsDavid Howells2018-11-088-0/+691
| | | | | | | Add manual pages for the asymmetric key type and its specialised keyctl operations. Signed-off-by: David Howells <dhowells@redhat.com>
* Add public key operations for encrypt, decrypt, sign and verifyDavid Howells2018-11-024-0/+377
| | | | | | | | | | | | | | | | | Add encryption, decryption, signature creation and signature verification public key operations. Example usage: j=`openssl pkcs8 -in ~/pkcs7/firmwarekey2.priv -topk8 -nocrypt -outform DER | \ keyctl padd asymmetric foo @s` echo -n abcdefghijklmnopqrst >/tmp/data keyctl pkey_encrypt $j 0 /tmp/data enc=pkcs1 >/tmp/enc keyctl pkey_decrypt $j 0 /tmp/enc enc=pkcs1 >/tmp/dec cmp /tmp/data /tmp/dec keyctl pkey_sign $j 0 /tmp/data enc=pkcs1 hash=sha1 >/tmp/sig keyctl pkey_verify $j 0 /tmp/data /tmp/sig enc=pkcs1 hash=sha1 Signed-off-by: David Howells <dhowells@redhat.com> Acked-and-tested-by: Denis Kenzior <denkenz@gmail.com>
* typos: fix various typosBen Boeckel2018-11-026-6/+6
| | | | | Signed-off-by: Ben Boeckel <mathstuf@gmail.com> Signed-off-by: David Howells <dhowells@redhat.com>
* keyctl_dh_compute.3: mention /proc/crypto for hashnamesBen Boeckel2018-11-021-1/+3
| | | | | | | | The kernel does not have a set of known hashnames available. Instead, /proc/crypto contains the information for the running system. Signed-off-by: Ben Boeckel <mathstuf@gmail.com> Signed-off-by: David Howells <dhowells@redhat.com>
* keyctl: fix error path message namesBen Boeckel2018-11-021-3/+3
| | | | | Signed-off-by: Ben Boeckel <mathstuf@gmail.com> Signed-off-by: David Howells <dhowells@redhat.com>
* Remove the dependency on MIT KerberosDavid Howells2018-11-023-235/+37
| | | | | | | | | | | | | Remove the dependency on MIT Kerberos as not everyone has it available. With the "use best match" change to /sbin/request-key, the kafs-client package can install a more specific handler for dns_resolver afsdb:* requests in front of the default one. This means that the dns resolver program only needs to look up DNS records and can ignore any static kafs configuration. Signed-off-by: David Howells <dhowells@redhat.com>
* request-key: Find best match rather than first matchDavid Howells2018-09-133-167/+267
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an upcall happens currently, either a file by the name "/etc/request-key.d/<type>.conf" is scanned or the default file "/etc/request-key.conf" is scanned and then the first match (including wildcards) is selected. Change this to read all the files in the conf directory and then read the default file. The best rule is then chosen and executed. "Best" is defined as the rule with the least number of characters that are skipped by matching a wildcard (e.g. string "foo:bar" matches pattern "foo:*" with the number of characters being skipped being 3). Further, the operation, type, description and callout_info columns are matched individually and in order, so that a skip of 1 in the operation column, say, is less preferable than an exact match there and a skip of 2 in the type column. For example, take: create dns_resolver afsdb:* * /sbin/key.afsdb %k create dns_resolver afsdb:* hello* /sbin/key.xxxx %k if both lines match, the second one will be picked, but, on the other hand, with: create dns_resolver afsdb:* * /sbin/key.afsdb %k creat* dns_resolver afsdb:* hello* /sbin/key.xxxx %k the first will be picked. Signed-off-by: David Howells <dhowells@redhat.com> Tested-by: Dave Jiang <dave.jiang@intel.com>
* request-key: Provide a command line option to suppress executionDavid Howells2018-09-131-33/+45
| | | | | | | | | Allow "-x" to be passed on the command line to the request-key program to suppress side effects and target execution. This makes it easier to debug the program and its configuration by allowing it to be driven from the command line. Signed-off-by: David Howells <dhowells@redhat.com>
* spec: Port cleanups from FedoraDavid Howells2018-08-281-22/+8
| | | | | | | | | | | | | | | | | | | Port cleanups from Fedora: Igor Gnatenko <ignatenkobrain@fedoraproject.org> - Switching to %ldconfig_scriptlets - Fixing the licence directory specs - Removing unneeded %defattr specs - Escaping macros in changelogs - Remove buildroot definition and deletion Peter Robinson <pbrobinson@gmail.com> - Add explicit gcc requirement - Remove Group specs Signed-off-by: David Howells <dhowells@redhat.com> cc: Igor Gnatenko <ignatenkobrain@fedoraproject.org> cc: Peter Robinson <pbrobinson@gmail.com>
* TEST: Add a missing backslashDavid Howells2018-08-211-1/+1
| | | | | | Add a missing backslash into a regular expression in the toolbox. Signed-off-by: David Howells <dhowells@redhat.com>
* Move to version 1.5.11v1.5.11David Howells2018-05-111-1/+6
|
* DNS: Support AFS SRV records and cell db config filesDavid Howells2018-05-095-208/+645
|
* tests/bz1031154: skip if selinux is disabledArtem Savkov2017-06-272-0/+10
| | | | | | | | | With selinux disabled the test currently fails trying to setenforce, it should be skipped instead. Found while trying to run in a container where selinux always appears disabled. Signed-off-by: Artem Savkov <asavkov@redhat.com> Signed-off-by: David Howells <dhowells@redhat.com>
* TEST: Add KDF leading zero testMat Martineau2017-06-081-0/+10
| | | | | | | | | | Diffie-Hellman results used as input to a KDF algorithm can have leading zero bytes, and the current kernel DH implementation truncates leading zero bytes. This test confirms that the KDF code correctly handles DH results with leading zeros. Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: David Howells <dhowells@redhat.com>
* Add the interface logic to support DH with KDF handling support.Stephan Müller2017-06-089-0/+456
| | | | | | | | | | | | | | | | | | | | The dh_compute code now allows the following options: - no KDF support / output of raw DH shared secret: dh_compute <private> <prime> <base> - KDF support without "other information" string: dh_compute_kdf <private> <prime> <base> <output length> <hash_type> - KDF support with "other information string: dh_compute_kdf_oi <private> <prime> <base> <output length> <hash_type> where the OI string is provided on STDIN. The test to verify the code is based on a test vector used for the CAVS testing of SP800-56A. Signed-off-by: Stephan Mueller <smueller@chronox.de> Signed-off-by: David Howells <dhowells@redhat.com>
* Doc: Update man pages for KEYCTL_RESTRICT_KEYRINGMat Martineau2017-06-083-0/+100
| | | | | | | | | Created a new manual page for the new keyctl_restrict_keyring function and added 'keyctl restrict_keyring' information for the keyctl command line utility. Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: David Howells <dhowells@redhat.com>
* TEST: Add tests for restricted keyring configurationMat Martineau2017-06-084-0/+593
| | | | | | | Test keyring restrict options using keyctl_restrict() Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: David Howells <dhowells@redhat.com>
* Add keyring restrictionMat Martineau2017-04-044-0/+42
| | | | | Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: David Howells <dhowells@redhat.com>
* lib: Begin the 1.7 library APIDavid Howells2017-04-042-1/+5
| | | | | | New symbols go into the libkeyutils.so.1.7 API. Signed-off-by: David Howells <dhowells@redhat.com>
* spec: Fix licence handlingDavid Howells2017-03-151-2/+5
| | | | | | Fix the handling of licence files in the specfile. Signed-off-by: David Howells <dhowells@redhat.com>
* spec: Pass global ldflags into buildDavid Howells2017-03-151-1/+2
| | | | | | Pass global ldflags into build so that hardening works. Signed-off-by: David Howells <dhowells@redhat.com>
* Move to version 1.5.10v1.5.10David Howells2017-03-151-1/+8
|
* Merge branch 'man_page_layout_fixes' of ↵David Howells2017-03-1527-396/+321
|\ | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/mtk/keyutils into next "Here are some more man page layout fixes. The biggest change is reformatting or keyctl(1) so that it's prettier and more readable." Signed-off-by: David Howells <dhowells@redhat.com>
| * man: various pages: Use real minus signsMichael Kerrisk2016-12-1725-45/+45
| | | | | | | | Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
| * man: keyutils(7): Fix layout glitchMichael Kerrisk2016-12-171-3/+6
| | | | | | | | | | | | I introduced this problem with an earlier commit. Sorry! Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
| * man: keyutils(7): Better layoutMichael Kerrisk2016-12-171-6/+2
| | | | | | | | Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
| * man: keyutils(7): Use real minus signsMichael Kerrisk2016-12-171-7/+7
| | | | | | | | Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
| * man: keyutils(7): typo fixMichael Kerrisk2016-12-171-1/+1
| | | | | | | | Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
| * man: keyctl(1): SEE ALSO: add a few missing entriesMichael Kerrisk2016-12-171-1/+5
| | | | | | | | Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
| * man: keyctl(1) Use real minus signesMichael Kerrisk2016-12-171-25/+25
| | | | | | | | | | | | | | Use real minus signs in places where they should be used (e..g, shell command and shell output). Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
| * man: keyctl(1): Remove unneeded .P tagsMichael Kerrisk2016-12-171-98/+91
| | | | | | | | | | | | This make s the source much easier to read. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>