summaryrefslogtreecommitdiff
path: root/usr.sbin/rpki-client
AgeCommit message (Collapse)Author
2022-05-12Tidy up IP handlingTheo Buehler
Populate struct ip in the leaf functions instead of handing it through several layers and copying it along the way. Pass in the afi instead of letting struct ip carry it. ok claudio
2022-05-12Refactor parsing of autonomousSysNum. Adjust code so that the allocationClaudio Jeker
needed for append_as() is done upfront. OK tb@
2022-05-11Verify MFT and GBR objects only carry RFC 3779 extensions set to 'inherit'Job Snijders
OK claudio@ tb@
2022-05-11Zap stray spaceTheo Buehler
2022-05-11Cache X509v3 extensions as soon as we have a certTheo Buehler
X509 API functions such as X509_check_ca() or X509_get_extension_flags() can't be used reliably unless we know that X509v3 extensions are cached. Otherwise they try to cache the extensions themselves but can't report possible errors sensibly. They carry on and may return nonsense. An old trick is to call X509_check_purpose() with a purpose of -1 which is a wrapper around the internal x509v3_cache_extensions() that allows error checking. Do this when we have a new cert. This way the API functions affected by this can be relied upon. Another nice side effect of doing this is that with LibreSSL we then know that the RFC 3779 extensions are in canonical form. ok beck claudio
2022-05-11In filemode check whether ROA & RSC resources are properly containedJob Snijders
with and OK tb@ claudio@
2022-05-11Fix doc comment of sbgp_asrange()Theo Buehler
2022-05-11Move sbgp_addr() down to the other sbgp_addr_* functions.Theo Buehler
ok claudio job
2022-05-11Deserialize ASIdentifiers in libcryptoTheo Buehler
Let the RFC 3779 code in libcrypto do its job: deserialize the ASIdentifiers extension using X509V3_EXT_d2i() and then simply walk the returned struct. This replaces quite a bit of low level ASN.1 fiddling with much simpler reaching into structs with names that have some meaning. Additionally, RFC 6487, 4.8.10 forbids RDI entries, so throw an error instead of ignoring them. ok claudio
2022-05-10Fix a couple of typos in doc comments, bunch of KNF (whitespace) tweaksTheo Buehler
2022-05-10Deserialize IPAddrBlocks in libcryptoTheo Buehler
Let the RFC 3779 code in libcrypto do its job: deserialize the IPAddrBlocks extension using X509V3_EXT_d2i() and then simply walk the returned struct. This replaces quite a bit of low level ASN.1 fiddling with much simpler reaching into structs with names that have some meaning. ok claudio
2022-05-10Fix leaks due to incorrect early returns rather than proper cleanup.Theo Buehler
ok claudio job
2022-05-10Confirm the absense of the Basic Constraints extension in non-CA certsJob Snijders
with and OK tb@
2022-05-10Validate RSC filenamesTheo Buehler
Factor out POSIX portable filename check into a new valid_filename() and rename the previous valid_filename() to valid_mft_filename(). Fixes and supersedes imcomplete checks in the RSC code. Avoids truncation via strndup() in case of embedded NULs. input/ok claudio
2022-05-10Improve control flow readability by removing 'else if' stanzasJob Snijders
OK tb@ claudio@
2022-05-09Drop prototype of currently nonexistent function.Theo Buehler
2022-05-09Commit file missed in previous.Theo Buehler
2022-05-09Add preliminary support for decoding RSC objects in filemodeJob Snijders
This implements decoding support for draft-ietf-sidrops-rpki-rsc-06 There are three major outstanding issues: * The wire image might still change to conform to the more widely deployed 3779 API in libressl/openssl. IETF discussion ongoing. * Whether the resources listed in the ResourceBlock are contained within the EE's RFC 3779 extension is not hooked up yet. * There is a fair bit of duplicity between rsc.c and cert.c, look for XXX OK tb@
2022-05-04rpki-client: bypass timeout in file mode.Theo Buehler
ok claudio
2022-05-04Tweak wording of a comment to reflect current reality better.Theo Buehler
2022-05-04Remove extra empty lineClaudio Jeker
2022-04-27typo: exceded -> exceedTheo Buehler
2022-04-25Fix spelling error in warnx()Job Snijders
Thanks Marco D'Itri
2022-04-24zap extra blank lineTheo Buehler
2022-04-24Wrap two overlong linesTheo Buehler
2022-04-24trailing whitespaceTheo Buehler
2022-04-24In filemode emit the hash which uniquely identifies a given Signed ObjectJob Snijders
RPKI Signed Objects are not malleable; this means the SHA256 digest of an input file containing a signed object is a very stable identifier to associate with the decoded (validated) output shown in filemode. The SHA256 in hash_id is base64 encoded (just like hashes on manifest listings). OK tb@
2022-04-21Further refactor and cleanup filemode.c mainly remove the copies ofClaudio Jeker
proc_parser_cert_validate() and proc_parser_root_cert() adjust parse_load_certchain() and parse_load_ta() respectivly. Also cleanup the functions in parser.c and make it possible to call ta_parse and cert_parse with a NULL cert. OK tb@
2022-04-21The filemode code is enough different from the regular parser code that itClaudio Jeker
makes sense to totally split it out. Duplicate proc_parser_cert_validate() and proc_parser_root_cert() for now. The valid_x509() plus the required static functions are moved to validate.c. The crl_tree code moved into crl.c similar to the auth_tree handling in cert.c. All the proc functions are now tagged with __attribute(noreturn) which allows to remove the errx() after them. OK tb@
2022-04-20Fix mandoc -Tlint warning about trailing whitespaceTheo Buehler
2022-04-20more whitespace cleanupsTheo de Raadt
2022-04-20Fix various annoying whitespace errors.Theo Buehler
2022-04-20Print UTC time with gmtime()Theo Buehler
This replaces a strange hack that sets TZ=UTC and calls localtime(). Tweak format string to keep printing UTC. ok claudio
2022-04-20Improve proc_parser_file handling of Trust AnchorsJob Snijders
OK tb@
2022-04-20Add Concatenated JSON output in filemode (rpki-client -j -f *)Job Snijders
The schema is still work in progress. OK claudio@
2022-04-20Remove an unreachable error messageTheo Buehler
If timeout != 0 and 0 <= timeout <= 24*60*60, then timeout < 1 is impossible. ok
2022-04-19zap extra line break and extra empty lineTheo Buehler
2022-04-19Do not use a hidden global for the EVP_ENCODE_CTX to save a calloc() call.Claudio Jeker
Make this work concurrently by allocating and freeing the EVP_ENCODE_CTX for every call to base64_decode(). This is not a hot path so the impact is negligible. OK tb@
2022-04-19Avoid leaking crldp in mft_parse() if one of the crlfile checks fails.Theo Buehler
ok claudio
2022-04-19Change type of talsz and dependent code from size_t to int. Tal ids areClaudio Jeker
already stored as int and and talsz is the limit for these ids. OK tb@
2022-04-19Make it a hard error when an unknown repoistory id is passed toClaudio Jeker
parse_filepath(). If that happens something went very wrong and it is better to fail hard then to limp along. OK tb@
2022-04-19Cosmetics, add missing spaceClaudio Jeker
2022-04-19Adjust on how CRL and MFT files are verified.Claudio Jeker
Verify the CRL referenced from the mft against the mft's fileAndHash info. If the CRL matches then load it and use it to validate this mft. If the mft validated OK add the now also valid CRL to the auth store for later use. Before the newest CRL was always selected but that has negative consequences because it is common practice to revoke the previous MFT's EE cert and with that the cache is turned useless as soon as a new CRL is used. Also there was a possibility that the CRL used for validation of the MFT was not the one later used. Both RFC6486 and draft-ietf-sidrops-6486bis are unclear about this part of the validation process. We opted in favor of the chached MFT. With and OK tb@
2022-04-15Allow more than one CRL URI in certificatesTheo Buehler
The spec (RFC 6487, 4.8.6) expresses a preference for a single rsync URI but allows for other URIs in the CRL distributionPoint. This doesn't currently happen in practice but could come at some point. So look for the rsync URI and skip over others, which is more correct and might help in the future. Pointed out by & ok claudio
2022-04-12fix bad space;Jason McIntyre
2022-04-12Extend -f filemode to decode & print TAL detailsJob Snijders
"fine" claudio@ tb@
2022-04-12Add a colon to warning for consistencyTheo Buehler
2022-04-12Shuffle sbgp_sia() a bit down to a place where it makes more senseTheo Buehler
ok claudio
2022-04-12Generalize sbgp_sia_location() to x509_location()Theo Buehler
AIA and CRL URIs can reuse the code in sbgp_sia_location and thus get the same checks as the SIA locations. This eliminates some more duplication and makes the checks more stringent in that embedded NULs and "./" are no longer allowed. ok claudio
2022-04-11Refactor on how the subprocesses are started.Claudio Jeker
Move the unveil and pledges to the actuall subprocesses and put all the common code to start these into process_start(). Reduces the lenght of main() a fair bit. OK tb@