1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00
Commit Graph

103 Commits

Author SHA1 Message Date
claudio
87c7c78d66 Alter valid_filehash() to take a file descriptor instead of a path.
This is needed so that callers can allow a file to be in multiple
locations. Also move mft_check() from mft.c to parser.c.
OK tb@
2022-01-13 13:46:03 +00:00
claudio
264f4ef9cf Implement a RRDP_CLEAR message that instructs the parent to cleanup
the rrdp directory. This is used before a snapshot download to ensure
that the snapshot is applied to a clean repo.
Similar cleanup happens if the transfer fails. In that case remove the
temp directory contents only.
This uses a new function remove_contents() to remove everything below
a base directory (a bit like rm -r X/*).
OK tb@
2022-01-13 13:18:41 +00:00
claudio
100ded9e8b Change the way the parser accesses files. It now builds the file path
based on information from the repository, a local path and the filename.
This simplifies some code both in the main process and the parser.
For this to work repositories are passed to the parser before any other
entity of this repository is passed. Struct entity is extended to include
the repoid and the path along the file(name).
Input and OK tb@ & job@
2022-01-11 13:06:07 +00:00
claudio
08df5e84f3 Cleanup struct entity. Remove the unneeded has_data field, the same
information can be figured out by looking at the data pointer itself.
It is NULL when there is no data and not-NULL if there is data.
OK benno@
2021-12-29 11:37:57 +00:00
claudio
b6884e9f8f Replace two questionable size_t types. For the repo id use a unsigned int
and for the roa maxlength use unsigned char (like the prefixlen in struct
ip_addr).
With input and OK job@
2021-12-22 09:35:14 +00:00
job
cecb080267 Replace MAX_REPO_TIMEOUT with repo_timeout, which is set to 1/4th of
timeout, or if timeout is disabled set to 24 hours.

OK claudio@
2021-11-25 14:03:40 +00:00
claudio
aef00ae0fc Move some functions from rrdp.c to rrdp_util.c and hex_decode to encoding.c.
This will make it easier to write a RRDP regress test.
OK job@ deraadt@
2021-11-24 15:24:16 +00:00
job
9f2d8e54a0 Increase maximum filesize of RPKI objects to 4MB
Based on feedback from Ties de Kock

OK tb@
2021-11-10 08:34:48 +00:00
claudio
7af68c5c1d Limit the number of publication points under a given TAL.
Introduce an additional timeout for each publication point.

The limits are large enough to accomodate normal operating levels.

With and OK benno@ job@ tb@ beck@ deraadt@
2021-11-09 11:03:39 +00:00
claudio
4ef6f69353 Simplify how IP addresses and AS numbers are passed between processes.
Since they are stored in an array just blast the full array in and out
of the io buffers at once instead of iterating element by element.
It also allows to remove a lot of extra code.
OK benno@ job@
2021-11-05 10:50:41 +00:00
claudio
2cc3b5f121 Move and promote getmonotime() to an internal API function. 2021-11-04 14:24:41 +00:00
claudio
4120df8f0f Use the same spacing for all defines. 2021-11-04 14:21:19 +00:00
claudio
dc508150ce Instead of passing tal descriptions around just pass a tal id and
use a small lookup table to print the description in the output path.
OK tb@
2021-11-04 11:32:55 +00:00
claudio
36dac55ee8 Limit the number of rsync processes being spawned by stopping to accept
new requests when over the limit. Use a generous limit of 16.
OK deraadt@
2021-11-03 14:59:37 +00:00
claudio
86832a4c4e Move the MAX_CERT_DEPTH to extern.h and adjust the comments of all limits
a bit.
2021-11-03 10:50:18 +00:00
claudio
198a05209c Further simplify cert and auth handling. Move common code into auth_insert
and skip this distinction between invalid and failed certificates.
The difference between the to is getting more and more blurry.
OK tb@
2021-11-01 17:00:34 +00:00
claudio
cebe825985 Cleanup struct auth a bit. The tal description is also stored in the cert
and the filename is only used in tracewarn which is not that helpful.
OK tb@
2021-11-01 09:12:18 +00:00
claudio
93d9375cd8 Ensure that RRDP snapshot and delta files are fetched from the same host
as the notification file.
OK tb@ job@
2021-10-29 09:27:36 +00:00
job
ac69bfd295 Limit how many FileAndHash entries a single manifest may contain
OK claudio@
2021-10-28 13:51:42 +00:00
claudio
1aea4e0e02 Limit the size of the base64 blob inside the RRDP XML to be less than
MAX_FILE_SIZE after base64 decoding it. This way hostile RRDP servers
do less damage.
OK beck@ tb@
2021-10-28 11:57:00 +00:00
beck
61c641a85a Don't exit in certain cases on failures to parse x509 objects.
In most cases we already warn and continue if someone sends us malformed
x509 objects. This makes this consistent behaviour in all places
so that if someone passes in bogus X509, We end up failing their entry
and continuing rather than exiting.

We still exit on memory/system failures so that a future run of rpki
client can simply do better when the machine is perhaps less hammered
on

ok job@ claudio@
2021-10-28 09:02:19 +00:00
beck
1c69962622 Add limits on size of certain untrusted inputs
ok job@
2021-10-27 21:56:58 +00:00
claudio
2cfd2d3bd9 Move load_file() to encoding.c so that regress can use the function. 2021-10-26 16:59:19 +00:00
claudio
41edc6705a Refactor the tal parsing code to use the same load_file() and buffer
passing as done for the other parsers.
OK job@ tb@
2021-10-26 16:12:54 +00:00
claudio
803d3b9acd Also move the cert parser code away from using BIO.
OK beck@
2021-10-26 13:31:05 +00:00
claudio
cabf3a3b92 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@
2021-10-26 10:52:49 +00:00
claudio
714f4e3f5f Move the various print functions from the regress tests into print.c.
OK tb@
2021-10-24 17:53:07 +00:00
job
dbcbf67572 Restrict the characterset for filenames on Manifests
feedback from benno@

OK claudio@
2021-10-24 12:06:16 +00:00
claudio
25f7afeed8 Rename io_buf_new to io_new_buffer and io_buf_close to io_close_buffer.
With this the write functions are all of the form io_xyz_buffer.
Remove some prototypes of functions I forgot to remove in previous commit.
OK benno@
2021-10-23 20:01:16 +00:00
claudio
7eb79a4a63 Finnally move away from blocking reads in rpki-client. The code was a
mish mash of poll, non-blocking writes and blocking reads. Using the
introduced ibuf size header in io_buf_new()/io_buf_close() the read
side can be changed to pull in a full ibuf and only start the un-marshal
once all data has been read.
OK benno@
2021-10-23 16:06:04 +00:00
claudio
2defcb5299 First step of cleanup in the io land. Introduce io_buf_new() and
io_buf_close(). These function will inject a size of the the buffer
at the beginning of the buffer and will allow the read size to be
switched to proper async IO.
OK benno@
2021-10-22 11:13:06 +00:00
job
17304ed1d4 Emit SKI in the JSON output and improve flow in x509_get_pubkey()
OK claudio@
2021-10-12 15:16:45 +00:00
job
6b83d8e365 Add support for BGPsec Router Certificates (RFC 8209)
BGPsec router keys are extracted from RPKI certificates and
emitted via the JSON output in base64 encoded form.

OK tb@ claudio@
2021-10-11 16:50:03 +00:00
job
dc8afe7e46 Make style consistent and remove an unused code path
OK tb@
2021-10-10 21:57:43 +00:00
claudio
7fd566d895 Add x509_get_expire() to extract the not-after time from a certificate
as a epoch time_t. Store the expire time for certs, crls will follow after.
OK tb@
2021-10-07 08:30:39 +00:00
job
fdfddccf0d Add rudimentary support for BGPsec router certificates
OK claudio@
2021-10-05 11:20:46 +00:00
claudio
d2e465bb28 Rework how various OIDs are compared in the code.
Instead of converting the ASN1_OBJECT into a string and comparing the
strings, convert the string into an ASN1_OBJECT once and then compare
these objects with OBJ_cmp().

Makes the code a bit easier to read and removes some repetitive conversions.
With input and OK tb@
2021-09-09 14:15:49 +00:00
claudio
6f704872d7 Add http_proxy support to rpki-client's http handler.
OK tb@
2021-09-01 08:09:41 +00:00
job
59470c3fe1 Add more checks for eContent 'version' fields.
Input from deraadt@, tb@, claudio@

OK deraadt@ claudio@ tb@
2021-07-13 18:39:39 +00:00
job
a66158d7f8 Add an 'expires' column to CSV & JSON output
The 'expires' value contains a reasonable earliest moment a VRP would expire,
in light of the currently available set of CAs and CRLs. The 'expires' value
can be used to avoid route selection based on stale data when generating VRP
sets, when faced with loss of communication between consumer and valdiator,
or validator and CA repository.

OK claudio@
2021-05-06 17:03:57 +00:00
benno
0bef1a86f2 move the RPKI_VERSION define into its own version.h file, helps portable.
ok claudio@
2021-04-14 18:05:47 +00:00
claudio
8ecbadc116 Initial commit of RRDP (The RPKI Repository Delta Protocol - RFC8182) support
in rpki-client. For now it is off by default.

All XML processing is done in its own process with minimal pledge rights.
It uses the already present https process to fetch the xml files and uses
the master porcess to handle the file IO into the repositories.
RRDP data is stored in the cache under ./rrdp/ and the first directory
is the SHA256 hash of the notify URI.

Fetching snapshots and deltas works to bring the cache up to date.
If something goes wrong rpki-client will fall back to rsync.

RRDP was implemented by Nils Fisher and integrated into rpki-client by myself.
"Time to get it in" deraadt@
2021-04-01 16:04:48 +00:00
claudio
155f32c368 Do a better job at cleaning up. Remove empty directories, scan not only the
known repositories but also clean up no longer known repositories.
With this rpki-client keeps its cache nice and shiny.
With and OK job@
2021-04-01 06:53:49 +00:00
claudio
087c464339 Move base64 and hex encoding functions into their own place.
OK tb@
2021-04-01 06:43:23 +00:00
claudio
1a998f47f2 Introduce hex_encode() to transform the aki/ski values to a string.
OK tb@
2021-03-29 12:41:34 +00:00
tb
1f25fa5db5 Inline x509_get_extensions() and remove it
Since aia, aki and ski are all represented by char *, this is an
error-prone interface - as found by job. The function doesn't do
much anyway.

ok claudio
2021-03-29 06:50:44 +00:00
job
ab5c69fdbf Add some restrictions to manifest object profile
OK tb@, feedback from claudio@
2021-03-28 16:22:17 +00:00
claudio
09b708f572 Adjust HTTP client code a bit. Add support for 304 Not Modified responses,
remove handling of 206 Partial Content (the client does not use range
headers). Report the Last-Modified timestamp back to the requestor and
switch OK to a enum value for (FAIL, OK and NOT MODIFIED).
OK tb@
2021-03-25 12:18:45 +00:00
claudio
c4f4bcd576 Add an -V option to show the version of rpki-client. For the base version
it will show just OpenBSD while -portable will show the portable version.
OK sthen@, tb@, kn@
2021-03-19 13:56:10 +00:00
claudio
8a3c435df6 Since the entity queues are per repo there is no need to store the repo id
anymore.
OK job@ tb@
2021-03-18 14:03:42 +00:00