OpenBSD CVS

CVS log for src/usr.sbin/rpki-client/crl.c


[BACK] Up to [local] / src / usr.sbin / rpki-client

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.36 / (download) - annotate - [select for diffs], Fri May 31 02:45:15 2024 UTC (2 days, 10 hours ago) by tb
Branch: MAIN
CVS Tags: HEAD
Changes since 1.35: +9 -1 lines
Diff to previous 1.35 (colored)

rpki-client: check issuer for certs and CRLs

Per RFC 6487, the subject and issuer fields of a certificate and the issuer
field of a CRL are subject to the same restrictions: only a commonName and
an optional serialNumber may be present and the commonName must be an ASN.1
printable string.

So far we've only checked the subject of certificates, which covers almost
everything by relying on the verifier to check that the issuer's subject is
identical to the subject's issuer, also for CRLs per X509_V_FLAG_CRL_CHECK.
The only thing missing this way is the TA's issuer.

Since the check is cheap and simple, we're better off doing it ourselves:
Refactor the x509_vaild_subject() helper to take an X509_NAME (which is of
course the appropriate name for a type representing an X.501 distinguished
name). This checks the details of RFC 6487, section 4.4, except that we
still can't check for a printable string since afrinic has ~3000 EE certs
that don't follow the spec, which would knock out ~45% of their ROAs. We're
told that this is going to be fixed this year.

looks good to claudio
ok job

Revision 1.35 / (download) - annotate - [select for diffs], Wed May 29 13:26:24 2024 UTC (4 days ago) by tb
Branch: MAIN
Changes since 1.34: +144 -10 lines
Diff to previous 1.34 (colored)

rpki-client: rework CRL handling

There is no benefit in parsing the CRLNumber in the RPKI. It is redundant
with other mechanisms, notably the requirements on manifests. rpki-client
never did anything with the CRL number anyway so stop parsing it in the
main process.

Move CRL AKI and CRL number handling from x509.c to crl.c, slightly improve
error checking for X509_CRL_get_ext_d2i() and only check well-formedness of
the CRL number: check it's there and non-critical. Avoid double warnings.

Add some checks for the well-formedness of the list of revoked certs.
Due to bugs in rpki-rs and Krill we can't reject empty lists (because
~15% of CRL's have this). And some people still use CRLs revoking certs
at the time they expire. This latter point might change mid-2025.

Add a hook for printing CRL numbers in file mode and warn about ill-formed
numbers (negative and overlong ones).

ok claudio job

Revision 1.34 / (download) - annotate - [select for diffs], Sun Apr 21 19:27:44 2024 UTC (5 weeks, 6 days ago) by claudio
Branch: MAIN
Changes since 1.33: +2 -2 lines
Diff to previous 1.33 (colored)

P-256 support is experimental so require -x to enable it.

Also clean up the externs a little bit by moving experimental and noop
to extern.h.
Reminded by and OK tb@

Revision 1.33 / (download) - annotate - [select for diffs], Mon Apr 15 13:57:45 2024 UTC (6 weeks, 5 days ago) by job
Branch: MAIN
Changes since 1.32: +27 -2 lines
Diff to previous 1.32 (colored)

Use the manifest location as additional differentiator when comparing CRLs

OK tb@

Revision 1.32 / (download) - annotate - [select for diffs], Thu Feb 1 15:11:38 2024 UTC (4 months ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5
Changes since 1.31: +2 -3 lines
Diff to previous 1.31 (colored)

Normalize the nid printing

OBJ_nid2* can return NULL if the gloriously consistent objects.txt
database doesn't specify a long or a short name. So try the long name
first, fall back to the short name, and if both fail, use "unknown".
Always include the nid as a decimal.

ok claudio

Revision 1.31 / (download) - annotate - [select for diffs], Thu Jan 18 14:34:26 2024 UTC (4 months, 2 weeks ago) by job
Branch: MAIN
Changes since 1.30: +2 -2 lines
Diff to previous 1.30 (colored)

The CRL's purported signing time actually is called thisUpdate, not lastUpdate

OK tb@ claudio@

Revision 1.30 / (download) - annotate - [select for diffs], Sun Dec 10 14:18:23 2023 UTC (5 months, 3 weeks ago) by job
Branch: MAIN
Changes since 1.29: +2 -2 lines
Diff to previous 1.29 (colored)

Since errno isn't used here, use warnx() instead of warn()

OK tb@

Revision 1.29 / (download) - annotate - [select for diffs], Thu Nov 16 11:17:52 2023 UTC (6 months, 2 weeks ago) by tb
Branch: MAIN
Changes since 1.28: +17 -3 lines
Diff to previous 1.28 (colored)

Improve CRL extension checking

RFC 6487 section 5 requires AKI and CRL Number and no other numbers to be
present in a CRL. We only checked for AKI and ignored other extensions.

Pointed out by Haya Schulmann et al

ok claudio

Revision 1.28 / (download) - annotate - [select for diffs], Thu Oct 19 17:05:54 2023 UTC (7 months, 1 week ago) by job
Branch: MAIN
Changes since 1.27: +6 -2 lines
Diff to previous 1.27 (colored)

Add experimental support for secp256r1 aka P-256 aka prime256v1

ECDSA signatures are much smaller than RSA signatures while offering
similar security. Adding support for P-256 now allows CA developers
to test their implementations, and paving the way for signers in the
production environment in the future to take advantage of ECDSA.

OK tb@

Revision 1.27 / (download) - annotate - [select for diffs], Thu Jun 29 10:28:25 2023 UTC (11 months ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.26: +3 -3 lines
Diff to previous 1.26 (colored)

Retire log.c

Convert all cryptowarnx() and cryptoerrx() to appropriate versions of
warn() and err{,x}(). Neither users nor developers benefit from them.
If we need better errors, we need to do some thinking. libcrypto won't
do that for us.

suggested by claudio
ok job

Revision 1.26 / (download) - annotate - [select for diffs], Tue Jun 20 12:48:32 2023 UTC (11 months, 1 week ago) by job
Branch: MAIN
Changes since 1.25: +6 -1 lines
Diff to previous 1.25 (colored)

Ensure CRLs carry the correct version

OK tb@

Revision 1.25 / (download) - annotate - [select for diffs], Mon May 22 15:07:02 2023 UTC (12 months, 1 week ago) by tb
Branch: MAIN
Changes since 1.24: +3 -3 lines
Diff to previous 1.24 (colored)

Convert x509_get_time() to ASN1_TIME_to_tm()

Instead of using the LibreSSL-specific ASN1_time_parse(), we can use
OpenSSL's ASN1_TIME_to_tm() which LibreSSL provides since 3.6.0. The
latter has a few API quirks such as silently falling back to being a
timegm() replacement if called with a NULL ASN1_TIME. We don't want
that, so just return an error instead.

rpki-client portable now needs LibreSSL >= 3.6. This is a small price
to pay for rather significant smiplifications in regress and portable
(which will be possible after the next commit).

Also adjust a couple of error strings.

ok claudio job

Revision 1.24 / (download) - annotate - [select for diffs], Fri Mar 10 12:44:56 2023 UTC (14 months, 3 weeks ago) by job
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.23: +3 -3 lines
Diff to previous 1.23 (colored)

mechanical change, rename struct members to match the original X509 names

OK tb@

Revision 1.23 / (download) - annotate - [select for diffs], Mon Mar 6 16:58:41 2023 UTC (14 months, 4 weeks ago) by job
Branch: MAIN
Changes since 1.22: +19 -2 lines
Diff to previous 1.22 (colored)

Ensure .cer and .crl outside-TBS signatures are sha256WithRSAEncryption

Note: there is a potential for confusion in RFC 7935, the specification
differentiates between 2 contexts: "in the certificate" and "CMS SignedData".

In the CMS context, either rsaEncryption or sha256WithRSAEncryption can
appear (and both *do* appear in the wild).

However, RFC 7935 section 2 fourth paragraph starting with "In certificates,
CRLs, ..." mandates that sha256WithRSAEncryption is used to sign .cer and
.crl files:

    "The Object Identifier (OID) sha256WithRSAEncryption from RFC4055 MUST
    be used in these products."

The above requirement matches observations on existing RPKI deployments.

OK tb@

Revision 1.22 / (download) - annotate - [select for diffs], Tue Feb 21 10:18:47 2023 UTC (15 months, 1 week ago) by tb
Branch: MAIN
Changes since 1.21: +10 -4 lines
Diff to previous 1.21 (colored)

rpki-client: ensure there is no trailing garbage in signed objects

The d2i functions are designed in such a way that the caller is responsible
to check if the entire buffer was consumed. Add checks on deserializing a
signed object to ensure the entire file has been consumed. Reject the file
if it has trailing garbage.

found by & ok job, ok claudio

Revision 1.21 / (download) - annotate - [select for diffs], Wed Nov 30 09:03:44 2022 UTC (18 months ago) by job
Branch: MAIN
Changes since 1.20: +1 -3 lines
Diff to previous 1.20 (colored)

Remove unused includes

OK claudio@

Revision 1.20 / (download) - annotate - [select for diffs], Wed Nov 30 08:17:21 2022 UTC (18 months ago) by job
Branch: MAIN
Changes since 1.19: +1 -3 lines
Diff to previous 1.19 (colored)

Remove unused sys/socket.h include

OK claudio@

Revision 1.19 / (download) - annotate - [select for diffs], Tue Nov 29 20:41:32 2022 UTC (18 months ago) by job
Branch: MAIN
Changes since 1.18: +1 -2 lines
Diff to previous 1.18 (colored)

Only include stdarg.h, if we call any of va_{start,end}()

OK tb@

Revision 1.18 / (download) - annotate - [select for diffs], Tue Nov 29 20:26:22 2022 UTC (18 months ago) by job
Branch: MAIN
Changes since 1.17: +1 -2 lines
Diff to previous 1.17 (colored)

Only include assert.h if we call assert()

OK tb@

Revision 1.17 / (download) - annotate - [select for diffs], Wed Nov 2 10:04:41 2022 UTC (19 months ago) by tb
Branch: MAIN
Changes since 1.16: +3 -3 lines
Diff to previous 1.16 (colored)

Fix x509_get_time() error checks

Like most x509_* functions, x509_get_time() returns 0/1 on error/success,
not -1/0.

ok claudio job

Revision 1.16 / (download) - annotate - [select for diffs], Sat Sep 3 21:24:02 2022 UTC (20 months, 4 weeks ago) by job
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.15: +12 -1 lines
Diff to previous 1.15 (colored)

Properly free() crl & auth tree in parser process

OK claudio@

Revision 1.15 / (download) - annotate - [select for diffs], Thu Apr 21 09:53:07 2022 UTC (2 years, 1 month ago) by claudio
Branch: MAIN
Changes since 1.14: +22 -2 lines
Diff to previous 1.14 (colored)

The filemode code is enough different from the regular parser code that it
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@

Revision 1.14 / (download) - annotate - [select for diffs], Thu Feb 10 15:33:47 2022 UTC (2 years, 3 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.13: +3 -11 lines
Diff to previous 1.13 (colored)

Implement some code to print crls with -f.
For this introduce x509_get_time() that converts a ASN1_TIME to time_t.
Also move time2str() to print.c where it makes more sense.
This needs more work but that will happen in tree.
OK tb@

Revision 1.13 / (download) - annotate - [select for diffs], Tue Feb 8 14:53:03 2022 UTC (2 years, 3 months ago) by tb
Branch: MAIN
Changes since 1.12: +15 -2 lines
Diff to previous 1.12 (colored)

Check CRLs also for manifests

There is a chicken-egg here since manifests reference the CRL themselves.
We may also have two CRLs available, in which case we check against the
one with the newer thisUpdate time.

The RFC situation is a bit of a mess with abundant complexity, unclear
recommendations and requirements and draft specs that also need to be
considered. This is a first version that works with future improvements
to be landed later.

Joint work with claudio, prompted by a question by job

ok claudio job

Revision 1.12 / (download) - annotate - [select for diffs], Tue Feb 8 11:51:51 2022 UTC (2 years, 3 months ago) by tb
Branch: MAIN
Changes since 1.11: +35 -9 lines
Diff to previous 1.11 (colored)

Move the guts of proc_parser_crl() into crl_parse(). This is actually
parsing the CRL, so it makes more sense to have it there. It will also
make an upcoming change easier. While there, rename free_crl() into
crl_free() for consistency with all other *_free() functions.

input/ok claudio

Revision 1.10.2.1 / (download) - annotate - [select for diffs], Tue Nov 9 13:41:19 2021 UTC (2 years, 6 months ago) by benno
Branch: OPENBSD_6_9
Changes since 1.10: +6 -16 lines
Diff to previous 1.10 (colored) next main 1.11 (colored)

rpki-client(8) should handle CA misbehaviours as soft-errors.

This is a merge of usr.sbin/rpki-client and usr.bin/rsync from current
and includes all commits in rpki-client 7.5 up to Tue Nov 9 11:03:40
2021 and to openrsync up to Wed Nov 3 14:42:13 2021, including:

* Make rpki-client more resilient regarding untrusted input:
  - fail repository synchronisation after 15min runtime
  - limit the number of publication points per TAL
  - don't allow DOCTYPE definitions in RRDP XML files
  - fix detection of HTTP redirect loops.
* limit the number of concurrent rsync processes.
* fix CRLF in tal files.

This is patches/6.9/common/021_rpki.patch.sig

Revision 1.10.6.1 / (download) - annotate - [select for diffs], Tue Nov 9 13:40:32 2021 UTC (2 years, 6 months ago) by benno
Branch: OPENBSD_7_0
Changes since 1.10: +6 -16 lines
Diff to previous 1.10 (colored) next main 1.11 (colored)

rpki-client(8) should handle CA misbehaviours as soft-errors.

This is a merge of usr.sbin/rpki-client and usr.bin/rsync from current
and includes all commits in rpki-client 7.5 up to Tue Nov 9 11:03:40
2021 and to openrsync up to Wed Nov 3 14:42:13 2021, including:

* Make rpki-client more resilient regarding untrusted input:
  - fail repository synchronisation after 15min runtime
  - limit the number of publication points per TAL
  - don't allow DOCTYPE definitions in RRDP XML files
  - fix detection of HTTP redirect loops.
* limit the number of concurrent rsync processes.
* fix CRLF in tal files.

This is patches/7.0/common/004_rpki.patch.sig

Revision 1.11 / (download) - annotate - [select for diffs], Tue Oct 26 10:52:49 2021 UTC (2 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.10: +6 -16 lines
Diff to previous 1.10 (colored)

Change CMS and CRL d2i functions from their BIO version to passing the
der buffer instead. The file are loaded early in the entity processing
loop.
OK tb@

Revision 1.10 / (download) - annotate - [select for diffs], Fri Jan 29 10:13:16 2021 UTC (3 years, 4 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_6_9_BASE
Branch point for: OPENBSD_7_0, OPENBSD_6_9
Changes since 1.9: +4 -44 lines
Diff to previous 1.9 (colored)

A while ago rpki-client was changed to validate the sha256 hashes of
files referenced in MFT files during the validation of the MFT file.
An MFT is only valid if all files are present and their hashes are valid.
Because of this there is no longer the need to check the hash when
these files are parsed later on. Remove these checks for CRT, ROA and CRL
files. Use the presence of the pkey when parsing cert files to decide
if it is a root cert or not.
OK tb@

Revision 1.9 / (download) - annotate - [select for diffs], Sat Sep 12 15:46:48 2020 UTC (3 years, 8 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.8: +1 -3 lines
Diff to previous 1.8 (colored)

Include openssl/x509.h in extern.h since it uses a few of the typedefs from
there in structs and prototypes. Remove the openssl/ssl.h and other strange
openssl includes in the .c files that don't use openssl specific functions.
OK beck@ and tb@

Revision 1.8 / (download) - annotate - [select for diffs], Thu Apr 2 09:16:43 2020 UTC (4 years, 2 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.7: +8 -2 lines
Diff to previous 1.7 (colored)

Use fopen() and BIO_new_fd() instead of BIO_new_file so that a possible
open error can be better logged to the operator. The cryptowarnx function
logs warnings is a less optimal way (mainly because of OpenSSL error stacks).
OK benno@ deraadt@

Revision 1.7 / (download) - annotate - [select for diffs], Fri Nov 29 04:40:04 2019 UTC (4 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.6: +3 -3 lines
Diff to previous 1.6 (colored)

Use the AKI embedded in the CRL to store the crls. This way the AKI from
the cert can be used to load the correct CRL. This simplifies the code
even further.
OK benno@, beck@ agrees that this is the right way to do it

Revision 1.6 / (download) - annotate - [select for diffs], Thu Nov 28 03:22:59 2019 UTC (4 years, 6 months ago) by benno
Branch: MAIN
Changes since 1.5: +16 -1 lines
Diff to previous 1.5 (colored)

To verify a manifest, a roa, or a certificate, we check its signature
against the CA one layer above it. This check just needs to use the
certificate revocation list published by that CA.

Instead of loading all CRLs we find into the trust store, we create a
STACK_OF(X509_CRL), push the onto it and use it with
X509_STORE_CTX_set0_crls(ctx, crls);

The x509_get_crl() function to retrieve a crl path from an X509 object
is written by claudio@.
ok claudio@

Revision 1.5 / (download) - annotate - [select for diffs], Tue Aug 13 13:27:26 2019 UTC (4 years, 9 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.4: +5 -3 lines
Diff to previous 1.4 (colored)

Show the most common warnings only if verbose is set. Most of these warnings
were shown because of an inconsistent rpki database and is no real problem.
OK florian@

Revision 1.4 / (download) - annotate - [select for diffs], Wed Jun 19 16:30:36 2019 UTC (4 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.3: +1 -1 lines
Diff to previous 1.3 (colored)

use $OpenBSD$ headers

Revision 1.3 / (download) - annotate - [select for diffs], Wed Jun 19 04:21:43 2019 UTC (4 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.2: +3 -3 lines
Diff to previous 1.2 (colored)

indentation adjustments, in particular near warn statements
ok claudio

Revision 1.2 / (download) - annotate - [select for diffs], Mon Jun 17 15:04:59 2019 UTC (4 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.1: +1 -2 lines
Diff to previous 1.1 (colored)

Don't do -portable in base.  It is better done outside the tree.
Imagine if we did it throughout the tree, how many copies of strlcpy
would we have, and how much time would all the configure shell scripts
and includes take?  It would be ludicrous.

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Mon Jun 17 14:31:30 2019 UTC (4 years, 11 months ago) by job
Branch: job
CVS Tags: job_20190617
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

Import Kristaps Dzonsons' RPKI validator into the tree

rpki-client(1) is an implementation of the Resource Public Key
Infrastructure (RPKI), specified by RFC 6480. The client is responsible
for downloading, validating and converting Route Origin Authorisations
(ROAs) into Validated ROA Payloads (VRPs). The client's output (VRPs)
can be used by bgpd(8) to perform BGP Origin Validation (RFC 6811).

The current rpki-client(1) version depends on the CMS functions in
OpenSSL, this of course needs to be addressed urgently.

Thanks to NetNod, IIS.SE, SUNET & 6connect for supporting this effort!

OK deraadt@

Revision 1.1 / (download) - annotate - [select for diffs], Mon Jun 17 14:31:30 2019 UTC (4 years, 11 months ago) by job
Branch: MAIN

Initial revision

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.