Commit Graph

28910 Commits

Author SHA1 Message Date
Nicolas Williams
d657528e91 asn1: work around OpenSSL conflict 2019-10-07 21:32:00 -05:00
Nicolas Williams
93e48f8fba hxtool: Add OID symbol resolution 2019-10-07 21:32:00 -05:00
Nicolas Williams
5465b2ddec libasn1: Add OID symbol resolution
This commit adds functions for finding OIDs by symbolic name, meaning by
their symbolic names given in the ASN.1 modules that define them.

TBD:

 - Resolve OIDs to names.
 - Support a file in /etc for additional OID resolution.
 - Add support for resolving OID arc names.
2019-10-07 21:32:00 -05:00
Nicolas Williams
6471fcaa54 Move ASN.1 modules from lib/hx509 to lib/asn1
This will help us generate a directory of OIDs from all the ASN.1
modules in lib/asn1, which will then help us create an hx509 API for
resolving OIDs to/from friendly names, which ultimately will help us
make hxtool more user-friendly.
2019-10-07 21:32:00 -05:00
Nicolas Williams
120619dbd0 asn1: use rfc2459.opt 2019-10-07 21:32:00 -05:00
Viktor Dukhovni
6f2b52bc97 Expose new Heimdal 8 KRB5_PLUGIN_COMMON_SPI_VERSION macro 2019-10-07 20:17:59 -04:00
Viktor Dukhovni
d0211ef475 Refactor send_diffs making it progressive
When a slave is many diffs behind, send these in batches of up to
50, then handle other slaves.

This also implements a fast-path that makes incremental diffs faster
when the log has not rolled over.

Related code cleanup.
2019-10-03 15:52:15 -05:00
Viktor Dukhovni
96fd393d29 Disable Nagle in iprop master and slave 2019-10-03 15:52:15 -05:00
Nicolas Williams
0334472ab5 ipropd-master: use async I/O
If a slave is slow to consume what the master sends it, the master can
block and all iprop operations with it.

With minimal effort we make the master async oriented.
2019-10-03 15:52:15 -05:00
Nicolas Williams
9de1728850 ipropd-slave: don't send I_HAVE in response to AYT
ipropd-master sends AYT messages often as a result of a possibly-
transient error, but if the slave responds to such an AYT with I_HAVE,
then the same code path that failed will be executed on the master, and
if the error wasn't transient then we'll loop hard.  So don't send an
I_HAVE in response to an AYT.
2019-10-03 15:52:15 -05:00
Nicolas Williams
c6d0793e63 Do not recover log in kadm5_get_principal() 2019-10-03 15:52:15 -05:00
Nicolas Williams
afaaf3d89d Add krb5_cc_configured_default_name()
Refactor krb5_cc_set_default_name() by splitting out the part that looks
for a configured default ccache name.  This will allow one to check if a
given ccache is a default ccache for a process ignoring KRB5CCNAME,
which might prove useful in the kx509 client.
2019-10-03 13:09:18 -05:00
Nicolas Williams
375dd8897f klist: partial fix of -v --json
It's still not supported, but at least it generates valid JSON now.

Note that --json w/o -v is functional but has issues, specifically the
rtbl_add_column_entry() does not encode strings properly for output as JSON
strings.  Fixing this will take significantly more effort.  One wonders if it
might not be better to use a proper JSON library instead of the rtbl stuff.
2019-10-03 13:09:18 -05:00
Nicolas Williams
697c6462cf klist: fix verbose printing of config entries 2019-10-03 13:09:18 -05:00
Nicolas Williams
941dfd95a3 pkinit: fix leak in client 2019-10-03 13:09:18 -05:00
Nicolas Williams
37b55e1fdb pkinit: fix memory leak in libkrb5 2019-10-03 13:09:18 -05:00
Nicolas Williams
6deb2a6bae kdc: improve HTTP parsing 2019-10-03 13:09:18 -05:00
Nicolas Williams
fe5c0a907c unparse_principal: reject embedded NULs 2019-10-03 13:09:18 -05:00
Nicolas Williams
621c68abea Improve krb5_cc_remove_cred() test 2019-10-03 13:09:18 -05:00
Nicolas Williams
e163bfd81b Make ccache init atomic 2019-10-03 13:09:18 -05:00
Nicolas Williams
ec84667763 Fix krb5_cc_move() issues
Move init/copy/destroy fallback sequence from fcc_move() to
krb5_cc_move().

Make sure all backends's move() method calls krb5_cc_destroy() on the
source on success (and only on success).

In text_cc make sure that we can find in the destination the cred
stored into the source.
2019-10-03 13:09:18 -05:00
Nicolas Williams
cf16e60f3b Fix off by one in KEYRING krcc_remove_cred() 2019-10-03 13:09:18 -05:00
Nicolas Williams
96d1e80bda roken: add mkostemp() 2019-10-03 13:09:18 -05:00
Nicolas Williams
f31cdc30b2 roken: add rk_memmem() 2019-10-03 13:09:18 -05:00
Nicolas Williams
d3ef0ee743 kdc: fix leaks 2019-10-03 13:09:18 -05:00
Nicolas Williams
75b5c94a62 kdc: fix invalid free at exit time 2019-10-03 13:09:18 -05:00
Nicolas Williams
5e270a8914 Fix missing error checking in lib/krb5/pkinit.c 2019-10-03 13:09:18 -05:00
Nicolas Williams
44677c01ae hxtool print: fix output device bugs 2019-10-03 13:09:18 -05:00
Nicolas Williams
63ccdca137 hx509: _hx509_certs_keys_free() should not require gate 2019-10-03 13:09:18 -05:00
Nicolas Williams
d13f89cb11 hx509: expose hx509_request_parse*() 2019-10-03 13:09:18 -05:00
Nicolas Williams
87eb05df6a hx509: always verify CSR signature 2019-10-03 13:09:18 -05:00
Nicolas Williams
f2776ce841 hx509: make hx509_get_error_string(NULL, ...) work
If hx509_context_init() fails we should still be able to do something
with its return code.
2019-10-03 13:09:18 -05:00
Nicolas Williams
eaebb892b8 hx509: hx509_context_free(&null_var) should work 2019-10-03 13:09:18 -05:00
Nicolas Williams
41fcafd20c hx509: add hx509_certs_destroy() 2019-10-03 13:09:18 -05:00
Nicolas Williams
e4b35ba13f hx509: create files with safe mode_t 2019-10-03 13:09:18 -05:00
Nicolas Williams
5a0d85e423 hx509: Add PKCS#8 private key format option 2019-10-03 13:09:18 -05:00
Nicolas Williams
63116100a8 hx509: do not crash on missing FILE: name 2019-10-03 13:09:18 -05:00
Nicolas Williams
cc8a5c59a8 hxtool: add generate-key command
This will help us not commit private keys in-tree for testing as we can now
more easily generate them as needed.
2019-10-03 13:09:18 -05:00
Nicolas Williams
049d817c66 Fix hx509_ca_tbs_free() segfault 2019-10-03 13:09:18 -05:00
Nicolas Williams
a2db5caebf Add note about racy tests 2019-10-03 13:09:18 -05:00
Nicolas Williams
859c587dc2 Add more hxtool EKU options, and KeyUsage too
This is necessary in order to have more control over, e.g., template
certificates for kx509.  But also it's good to have this more generally.

Some batteries not included.  Specifically: no attempt is made to validate that
given KeyUsage values are compatible with the subjectPublicKey's alrogithm and
parameters.
2019-10-03 13:09:18 -05:00
Nicolas Williams
005ba36b83 hxtool request-create: fix --key argument handling
```
    hxtool request-create --subject=... \
                          --generate-key=... \
                          --key-bits=... \
                          --key=STORE \
                          store
```

wants to generate a key, store it in the location specified by the --key
argument, then read it back, then generate the CSR, and store it in
`store`.

But it didn't work because for generating a key this really wants the
`--key` argument to be a file path into which a raw DER-encoded RSA key
will be written (only RSA is supported, ay!), but for reading the key
back it uses `hx509_certs_init()`, which wants `TYPE:name` keystore
specification.  A deadly embrace.

Now that we have improved libhx509 functionality for reading/writing
private keys from/to PEM files we use this functionality and require a
store type in the `--key=STORE` argument.
2019-10-03 13:09:18 -05:00
Nicolas Williams
252487dfe4 hx509: support reading private keys from PEM files
This commit adds:

 - hx509_cert_init_private_key() for creating an hx509_cert object that
   has just a private key

 - hx509_cert_have_private_key_only() for checking whether an hx509_cert
   object has just a private key

This also generalizes the get_key() internal function in hxtool, which
is tasked with reding or generating a private key for use in signing
CSRs.  Now hxtool request-create can read/write private keys to/from PEM
files, not just DER files.

This is needed to support key types other than just RSA for CSRs and
certificates.
2019-10-03 13:09:18 -05:00
Nicolas Williams
8d232aa87d hx509: export hx509_parse_private_key (Windows) 2019-10-03 13:09:18 -05:00
Nicolas Williams
1ee136ce40 autoconf: look for unlinkat() 2019-10-03 13:09:18 -05:00
Nicolas Williams
34728ce79e rk_base64_encode(): set errno in all error cases 2019-10-03 13:09:18 -05:00
Nicolas Williams
1ae941af9b roken_detach_prep() should return fd 2019-10-03 13:09:18 -05:00
Nicolas Williams
5859bc3bdf kadmin: add --hdb / -H argument
Makes it possible to

 $ kadmin -l -H /tmp/hdb init FOO.EXAMPLE

rather than being able to only init /var/heimdal/heimdal.
2019-10-03 13:09:18 -05:00
Nicolas Williams
338d47120b Fix Appveyor Windows build 2019-10-03 13:09:18 -05:00
Viktor Dukhovni
989422e0fc Install kuserok-plugin.h and update docs
The header file was not installed, and the manpage had the wrong
name for the plugin load function, it is "krb5_plugin_kuserok_plugin_load",
not "kuserok_plugin_load".
2019-09-26 20:18:00 -04:00