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

234 Commits

Author SHA1 Message Date
claudio
0102fb1b97 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@
2020-09-12 15:46:48 +00:00
claudio
cfc09c7b83 Move the proc_rsync and with that the rsync processing into rsync.c
main.c is too crowded
OK deraadt@
2020-09-12 10:02:01 +00:00
claudio
3d81c3df19 One tiny step towards adding RRDP support in rpki-client.
Extract the notify URL from the cert if it is available and pass it back to
the parent process. The parent process can then use this info to load the
repo via RRDP instead of rsync.
OK benno@ (some long time ago)
2020-07-28 07:35:04 +00:00
job
91da860ac5 Remove -f (force) option.
The -f option existed for some initial debugging work.

Thanks Weerd for review

OK claudio@
2020-06-30 12:52:44 +00:00
claudio
74f3d1527d Stop using rsync --delete when syncing up with the CA repos. Instead
use the files referenced in the manifests to build up a list of files
to keep and remove anything that is not in the list after doing the
full computation.
OK job@ benno@
2020-06-24 14:39:21 +00:00
deraadt
b0404f1fdb Place elapsed, user, and system time for processing in the comment headers.
ok job benno claudio
2020-04-30 13:46:39 +00:00
deraadt
0ee5ab88e4 Print statistics as comments at the top of the files which can take
comments.
ok claudio job
2020-04-28 13:41:35 +00:00
claudio
630e12ade6 Split the mft file and hash check from the mft parsing. This makes it easier
to check all files in a mft before failing and also the check is now done
after the embedded cert was checked.
This refactor was triggered because of a bug in mft_parse_econtent().
check_validity() altered rc but later failure code assumed that goto out
is good enough to return an error (rc == -1) but since rc was 1 success
was returned. This bug is now also fixed.
Bug report and OK job@
2020-04-01 14:15:49 +00:00
jca
bfe2257568 Narrow the visibility of some functions and variables local to output.c
Also make the outputs table const.
Based on a suggestion from claudio@, ok deraadt@ claudio@
2020-03-10 14:22:26 +00:00
jca
70ba94e50d Ensure that we properly flush, close and rename temporary output files
Makes sure we don't feed an incomplete/garbage file to consumers.
Input and ok claudio@ deraadt@
2020-03-09 23:50:01 +00:00
benno
2e60d9e89d generate 3 different outputs for BIRD:
- bird v1 with IPv4 routes
- bird v1 with IPv6 routes
- bird v2
when using command line option -B.
BIRD v2 output from Robert Scheck, robert AT fedoraproject DOT org
time_t cast hint from jca@, and tested by job@
ok deraadt@ claudio@
2020-03-06 17:36:42 +00:00
claudio
5b613a61b6 Don't hardcode the cache directory for rpki-client. If started as root
rpki-client will use the defaults for cache and output directory. If not
started as root users need to provide both directories as arguments.
While there switch from absolute path names to relative ones. For this
the parser and rsync process do a chdir(2) to the cache directory on startup.
OK benno@
2019-12-06 09:27:12 +00:00
deraadt
1f9a8b9481 split output management code into seperate file. iterate over output
methods using a table.  detect output truncation (for instance filesystem
full) and don't overwrite previous output
ok claudio
2019-12-04 12:40:17 +00:00
deraadt
747ff6ba73 output_createtmp() remembers the true name, so output_finish() does not
need to replay it.
2019-12-02 02:11:13 +00:00
deraadt
ed26e04b57 Tweak rpki-client to create all 4 output file formats from a single
compute, based upon flags.  OpenBGPD compatible format by default if
no options, to integrate with bgpd.conf and bgpctl reload.  Adapt
mtree and stuff.  This will receive further refactoring...
ok benno job
2019-11-30 02:31:12 +00:00
claudio
e669621f7c 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
2019-11-29 04:40:04 +00:00
deraadt
43dfc6a83c If run as root, priv-drop to _rpki-client.
If no output file is specified, output to the bgpd/bgpd.conf-compatible
/var/db/rpki-client/roa file.
ok claudio and benno
2019-11-29 04:04:08 +00:00
claudio
a079bbf85d Convert the auths array into an RB tree indexed by SKI. For fast lookups
the parent auth struct is stored as a pointer so walking up the certificate
chain remains simple. Doing this replaces a few slow lookups and speeds up
rpki-client by a factor of 2.
OK benno@
2019-11-28 20:36:17 +00:00
deraadt
4cefd9474e Output to a temporary file, which gets renamed on success. This will
work much better with bgpd.conf include automation.
ok claudio benno
2019-11-28 20:23:09 +00:00
benno
51b3988bb8 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@
2019-11-28 03:22:59 +00:00
benno
4f1d433364 whitespace 2019-11-27 17:14:20 +00:00
benno
730721603a Only store ta certs in the trust store and build chains of the
intermediate certificates for use in X509_STORE_CTX_init(). To do that
save the X509 cert in struct cert.
claudio sees > 2x speed increase.

ok claudio@ and feedback from jsing@ and beck@.
2019-11-27 17:08:12 +00:00
benno
cbcd0d1ab6 knf, make types grepable. ok claudio@ 2019-11-27 04:32:09 +00:00
claudio
6a48a44272 Refactor tal code a bit. Move the file reader back into tal.c so that the
regress test is able to use it.
OK deraadt@
2019-11-04 09:35:43 +00:00
claudio
397f8a58d6 Handle the TAL files in the master process and pass them as buffer to the
parser process. This way the parser never needs to read outside of the
cache directory which makes the unveil simpler. Additionally rsync_uri_parse
no longer needs to know about .tal files so there is now no chance to sneak
in a .tal file later on.
OK deraadt@
2019-10-31 08:36:43 +00:00
claudio
5a1f8137e2 Add an output format for bird and one doing CSV. Also update the manpage
to include all the changes.
2019-10-16 17:43:29 +00:00
claudio
a382efa298 Rewrite the output handling of rpki-client and add an option to dump the
data in JSON format. To make the JSON output the same as the output of the
RIPE rpki-validator the basename of the TAL had to be added and passed around
in rpki-client. Additinally the VRPs are now stored in an RB tree in the
main process instead of keeping them per ROA object. This changes the sort
order to be in network order and no longer just lexographical.
Agreed by job@ deraadt@
2019-10-08 10:04:36 +00:00
claudio
2d3101137f Change the arguments to rpki-client a bit. Instead of listing all TAL files
as arguments rpki-client will now load the TAL installed in /etc/rpki by
default. For debug reasons an option -t tal is added to pass in TAL files
by hand. The argument is now instead the filename of the output file.
Now `rpki-client roa.conf` will do what you need which is a lot nicer.
Agreed by deraadt@ job@ to be a step in the right direction.
2019-08-20 16:01:52 +00:00
claudio
8825d98844 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@
2019-08-13 13:27:26 +00:00
deraadt
23c49d5288 use $OpenBSD$ headers 2019-06-19 16:30:36 +00:00
claudio
22bf19692e Instead of the strange ASN.1 encoding of IP addresses with a size in bytes
and a count of how many bits of the last byte are unused switch to a much
more normal prefixlen in bits encoding for internal use. This makes the
code easier to understand. Also switch to inet_ntop() for converting a
struct ip_addr into a string.
OK job@
2019-06-19 15:47:34 +00:00
deraadt
80272c4992 indentation adjustments, in particular near warn statements
ok claudio
2019-06-19 04:21:43 +00:00
deraadt
e1e433b451 This portable code knocking out pledge or unveil is better done
as a C stub, rather than #define.
Anyways, this "-portable by default" approach is not the OpenBSD way.
2019-06-17 15:02:39 +00:00
job
9a7e9e7f88 ../../../logmessage 2019-06-17 14:31:30 +00:00