15 Commits

Author SHA1 Message Date
dandds
0b5acde4c4 Stream-parse CRLs for caching file locations.
AT-AT needs to maintain a key-value CRL cache where each key is the DER
byte-string of the issuer and the value is a dictionary of the CRL file
path and expiration. This way when it checks a client certificate, it
can load the correct CRL by comparing the issuers. This is preferable to
loading all of the CRLs in-memory. However, it still requires that AT-AT
load and parse each CRL when the application boots. Because of the size
of the CRLs and their parsed, in-memory size, this leads to the
application spiking to use nearly 900MB of memory (resting usage is
around 50MB).

This change introduces a small function to ad-hoc parse the CRL and
obtain the information in the CRL we need: the issuer and the
expiration. It does this by reading the CRL byte-by-byte until it
reaches the ASN1 sequence that corresponds to the issuer, and then looks
ahead to find the nextUpdate field (i.e., the expiration date). The
CRLCache class uses this function to build its cache and JSON-serializes
the cache to disk. If another AT-AT application process finds the
serialized version, it will load that copy instead of rebuilding it. It
also entails a change to the function signature for the init method of
CRLCache: now it expects the CRL directory as its second argument,
instead of a list of locations.

The Python script invoked by `script/sync-crls` will rebuild the
location cache each time it's run. This means that when the Kubernetes
CronJob for CRLs runs, it will refresh the cache each time. When a new
application container boots, it will get the refreshed cache.

This also adds a nightly CircleCI job to sync the CRLs and test that the
ad-hoc parsing function returns the same result as a proper parsing
using the Python cryptography library. This provides extra insurance
that the function is returning correct results on real data.
2019-11-04 08:36:03 -05:00
dandds
caa633c3db Fix more tests broken by expiring CRL.
There are still a few tests that rely on physical certificate files.
These are slightly more complicated to replace with pytest fixtures.
Updated the script for generating a CRL chain so that the CRL is good
for roughly ten years and regenerated the certs and CRL.
2019-08-21 05:47:54 -04:00
dandds
bd8a469e93 Fix tests that were broken by a fixture CRL expiring.
Adjust the broken tests to use our dynamic fixtures for PKI files. Some
tests still rely on these fixtures, but this is a minimal patch to get
the test suite passing again. Eventually all tests should use the pytest
fixtures.
2019-07-10 11:11:49 -04:00
George Drummond
f2ae591c87
Verify PDF signatures 2019-03-20 13:11:12 -04:00
Patrick Smith
6a9290619d Update funding form to handle uploading pdf/png 2019-01-23 11:16:54 -05:00
richard-dds
de0e9ee705 Fix PDF clearing bug 2018-11-12 10:37:26 -05:00
dandds
6a03664b51 get CLIN info from EDA XML 2018-10-17 15:59:20 -04:00
richard-dds
6eaa8b5c51 Update ssl crl config and certs. See you in a year 2018-08-30 11:11:04 -04:00
dandds
ef2e97713a initial uploader and some form work 2018-08-27 13:04:41 -04:00
dandds
c8bcde48ec fix multi-step certificate chain bug in CRL check 2018-08-20 12:37:33 -04:00
dandds
2db84fb19a build individual x509 stores for each CRL 2018-08-16 14:21:03 -04:00
dandds
52fc5a9414 readme for regenerating client cert fixtures 2018-08-09 15:02:09 -04:00
dandds
c0d72cd0d6 utility function for getting user email from x509 certificate 2018-08-09 15:01:06 -04:00
dandds
ac95bf371e implement CRL checking from authnid 2018-08-06 11:12:58 -04:00
dandds
f0a7bfcd0e add CRL functionality from authnid 2018-08-06 10:44:00 -04:00