1309 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
tomdds
d0746a3bf6 Cleanup imports and formatting in azure testing code 2019-10-30 16:43:59 -04:00
tomdds
3e7a720ffb Post-rebase fixes 2019-10-30 16:43:59 -04:00
tomdds
63ea7db390 Rudimentary tests to validate mocking 2019-10-30 16:43:59 -04:00
tomdds
99e306e602 First pass at mocking and testing azure integration 2019-10-30 16:43:59 -04:00
leigh-mil
e64900245d Remove baseline_info column from environments table 2019-10-30 14:46:33 -04:00
richard-dds
d1e6533824 Implement EnvironmentRoles.disable 2019-10-29 15:57:57 -04:00
richard-dds
ec44d4a560
Merge pull request #1143 from dod-ccpo/consolidate-csp-interface
Simplify CloudProviderInterface and remove AWS impl.
2019-10-29 13:47:14 -04:00
richard-dds
184b58d5d2 Remove AWSCloudProvider 2019-10-28 13:55:34 -04:00
richard-dds
6ea17bb4f8 Merge create_environment and create_environment_baseline 2019-10-28 13:39:40 -04:00
graham-dds
ccaabcaab0 Add revoke invitation logic to port. admin route 2019-10-28 13:15:42 -04:00
graham-dds
9de90d796d Rename audit log feature flag config variable 2019-10-21 11:36:53 -04:00
graham-dds
a1c672d89f Conditionally skip tests related to audit log 2019-10-21 11:36:53 -04:00
dandds
fc637e933d Specify Flask SERVER_NAME value for Celery worker.
The Celery worker cannot render URLs for the app without having a
SERVER_NAME value set. AT-AT's ability to send notifications when an
environment is ready is broken as a result.

This commit sets a null default value for SERVER_NAME in the default
config file. A setting must exist in the INI file in order to be
over-written by an environment variable, which is why we declare it as
null here. There is an additional kwarg, "allow_no_value", that must be
passed to ConfigParser to allow null values.

This also applies the correct domains as SERVER_NAME environment
variables in the Kubernetes ConfigMaps for the AWS and Azure Celery
workers.
2019-10-16 11:57:18 -04:00
richard-dds
96c1fcbe85
Merge branch 'master' into revert-user-deletion 2019-10-15 17:06:06 -04:00
leigh-mil
91ce3dda9e Disable the App Role when revoking an invite. 2019-10-15 14:25:21 -04:00
richard-dds
1bce0a1f01 Revert user deletion job 2019-10-14 16:51:19 -04:00
dandds
7949c64b9b Initial set up for Ghost Inspector integration tests.
Adds a CircleCI integration for Ghost Inspector
(https://ghostinspector.com), a headless browser testing SaaS. The
README is updated with details about how to run GI locally.

Removes the bootstrap setup for Selenium testing with BrowserStack.
2019-10-14 16:32:38 -04:00
leigh-mil
10c16cc4ef Send email after environment is provisioned 2019-10-10 09:45:01 -04:00
richard-dds
0c480ccc41 Fix tests 2019-10-08 16:42:25 -04:00
richard-dds
ed7bc33e44 Set deleted flag in do_delete_user 2019-10-08 16:42:25 -04:00
richard-dds
343e989de8 Update comments 2019-10-08 16:42:25 -04:00
richard-dds
2ad30b5fa4 Implement dispatch_delete_user job 2019-10-08 16:42:25 -04:00
richard-dds
00f76ae5af Add delete user job 2019-10-08 16:42:25 -04:00
leigh-mil
12aad96899 hard code initial invite email 2019-10-08 16:16:34 -04:00
leigh-mil
4d043363a7 Create route for resending an app invite
Replace ApplicationInvitations._update_status() with revoke() because multiple functions used _update_status() and it was causing app roles to be disabled when they shouldn't have. Now app roles are disabled within the revoke function.
Updated Invitations.resend() to accept user details so the invite info
can be changed in the new invite
2019-10-08 15:59:16 -04:00
leigh-mil
f4855c0ae3 Use validator on the field for checking that the pop dates are within the contract date range 2019-10-08 10:32:02 -04:00
leigh-mil
07b3c68422 Add min and max range values to date selector so a more accurate error message can be displayed when a date is out of the range 2019-10-08 10:32:02 -04:00
leigh-mil
875b908908 Do not change app role status when invite status changes, add assertions to tests for this 2019-10-03 14:56:38 -04:00
richard-dds
e34333a990 Fix tests 2019-10-02 16:01:23 -04:00
richard-dds
cc3de11e54 Standardize all of the AWS credentials 2019-10-02 16:01:23 -04:00
richard-dds
8b59546840 Add tests for AWSCloudProvider.create_environment_baseline 2019-10-02 16:01:12 -04:00
richard-dds
7bc5a418c9 Tests for AWSCloudProvider.create_atat_admin_user 2019-10-02 16:01:12 -04:00
richard-dds
cacb9135d1 Tests for AWSCloudProvider.create_environment
Created mock boto3 for testing
2019-10-02 16:01:12 -04:00
richard-dds
eaf1de22ba Create cloud test dir 2019-10-02 16:00:43 -04:00
graham-dds
de89bb03b0 use correct route for create member macro 2019-10-02 14:17:18 -04:00
leigh-mil
1435734969 Add monkeypatch to mock handle_error() 2019-10-02 10:45:22 -04:00
graham-dds
337c98f8cd Add / update tests
- add tests for step3 of new application
2019-10-01 15:56:18 -04:00
graham-dds
4aa0afdb67 New env role logic in filter_env_roles_form_data 2019-09-30 15:41:00 -04:00
leigh-mil
92243965ec parse contract dates into datetime objects 2019-09-26 16:22:16 -04:00
leigh-mil
789e6662a2 Add tests for pop date range vue component 2019-09-26 16:22:15 -04:00
leigh-mil
c9f654664c Update test to check that env role was deleted and that the status changed on the app role 2019-09-26 10:46:29 -04:00
leigh-mil
663fb9f288 Use ApplicationRoles.disable() instead of Applications.remove_member() 2019-09-26 09:53:20 -04:00
leigh-mil
5c54c043c0 Add route for applications.revoke_invite 2019-09-26 09:46:23 -04:00
tomdds
494978fabd
Merge pull request #1077 from dod-ccpo/cloud-provision-errors
First pass at Cloud Provision Exceptions
2019-09-24 14:00:47 -04:00
graham-dds
7e340936dc
Merge pull request #1088 from dod-ccpo/make-application-creation-multistep
Make application creation multistep
2019-09-24 13:56:36 -04:00
tomdds
ff8119acd1 Integrate errors with MockCloudProvider 2019-09-24 13:54:41 -04:00
richard-dds
d60cc58dee
Merge pull request #1083 from dod-ccpo/user-provisioning-task
Add create_user task
2019-09-24 13:50:17 -04:00
graham-dds
a96c2b3cdd Update / create new tests for application creation 2019-09-24 10:16:49 -04:00
dandds
7ea1ae5a34 Add a JS test for the clin-fields Vue component.
In order to do this, it was expedient to move the CLINFields Jinja macro
into its own file and pass in all the data it requires.
2019-09-24 09:37:30 -04:00