6291 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
56f0119814
Merge pull request #1157 from dod-ccpo/quick-fixes
Fix secrets baseline and type hint error.
2019-11-01 15:38:34 -04:00
dandds
87a2da68dc Fix secrets baseline and type hint error.
- detect-secrets was previously bumped to 0.13 but the baseline file was
  not updated.
- mypy objects to the way the Azure Subscription type was defined. Since
  the module is encapsulated for dependency injection, we can either
  declare it as a generic or remove the type hint. I did the latter,
  since I don't know that we gain anything by the former.
2019-11-01 15:06:30 -04:00
tomdds
52de1471e0
Merge pull request #1144 from dod-ccpo/azure-integration
Azure Integration
2019-10-31 13:07:11 -04: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
tomdds
1a92cd35d1 Extract service principal resolution to private method
Also made root creds a property
2019-10-30 16:43:59 -04:00
tomdds
41633417d8 Add Azure Libraries 2019-10-30 16:43:59 -04:00
dandds
06dc193c28 WIP: can add new app/SP 2019-10-30 16:43:59 -04:00
tomdds
608f988b71 First pass at process of adding admin to azure 2019-10-30 16:43:59 -04:00
tomdds
15ff4a01f1 Add Azure Graph API 2019-10-30 16:43:59 -04:00
tomdds
5cd20c650a Draft of Azure create_environment 2019-10-30 16:43:59 -04:00
dandds
06239c94ba
Merge pull request #1145 from dod-ccpo/bugfix/disallow-resent-invite-with-invalid-date
Allow submit buttons to be valid on initial render
2019-10-30 16:15:13 -04:00
dandds
b5a2e6e929
Merge pull request #1141 from dod-ccpo/consolidate-ci
Consolidate CI
2019-10-30 16:06:46 -04:00
dandds
b7c5b5ef7f
Merge pull request #1150 from dod-ccpo/remove-dispatch-environment-baseline
Remove the Celery schedule for the environment baseline task.
2019-10-30 16:05:55 -04:00
richard-dds
6910916cd8
Merge pull request #1148 from dod-ccpo/remove-aws-uploader
Remove AwsUploader
2019-10-30 15:48:09 -04:00
leigh-mil
48a90b5177
Merge pull request #1152 from dod-ccpo/env-processing-label-bugfix
Remove baseline_info column from environments table
2019-10-30 15:47:58 -04:00
leigh-mil
e64900245d Remove baseline_info column from environments table 2019-10-30 14:46:33 -04:00
richard-dds
f4e72e7173
Merge pull request #1151 from dod-ccpo/fix-suspend-migration
Fix "disabled environment role status" migration
2019-10-30 14:46:10 -04:00
richard-dds
308bad2fc8 Fix "disabled environment role status" migration 2019-10-30 14:31:27 -04:00
dandds
969293f5b2 Remove the Celery schedule for the environment baseline task. 2019-10-30 13:03:11 -04:00
dandds
23c4ba32eb CI/CD uses Docker containers exclusively and removes CircleCI Orbs.
The CircleCI Orbs were useful for getting started, but now that we only
have to deploy to one provider our pipeline should be tailored to
efficiently push to just that environment. This inlines all the relevant
pieces from the Orbs we were relying on as bash/sh commands instead.

This builds the Docker images upfront. Since we have a multi-stage
Dockerfile, it builds the first stage as a separate image and then
proceeds to build the complete image. This is done so that the first
stage (called "builder") can be used for testing. It retains executables
like pipenv that we need to install development dependencies needed for
tests.

Other notes:
- CircleCI does not persist Docker images between jobs. As a
  work-around, we use the CircleCI caching mechanism to create a named
  cache with *.tar copies of the images. Subsequent jobs use the cache
  and load the images.
- Both the test and integration-tests jobs need to make minor
  modifications to the container to run correctly. The test job needs to
  install the development Python dependencies, and the integration-tests
  job needs to rebuild the JS bundle so that it uses the mock uploader
  (the container is build to use the Azure uploader by default).
- The test and integration-tests jobs run in parallel.
- This adjusts the Dockerfile so that the TZ environment variable is set
  for both stages of the build.
2019-10-30 12:04:21 -04:00
richard-dds
36dc66504c
Merge pull request #1147 from dod-ccpo/disable-user
Implement EnvironmentRoles.disable
2019-10-30 11:35:39 -04:00
richard-dds
1746c297d1 Use deterministic "mock-test" CSP in CI 2019-10-29 16:19:53 -04:00
richard-dds
910d31df30 Remove AwsUploader 2019-10-29 16:02:48 -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
dandds
3456f37396
Merge pull request #1142 from dod-ccpo/bugfix/revoke-deleted-user
Bugfix: Invited but disabled portfolio member shouldn't be able to reactivate self
2019-10-29 11:53:58 -04:00
graham-dds
5526356938 remove TODO from admin.py 2019-10-28 15:37:50 -04:00
graham-dds
eb22d5ec1e Invitation revoking & role disabling to base class 2019-10-28 15:37:43 -04:00
graham-dds
5f5fbd2b91 Allow submit buttons to be valid on initial render 2019-10-28 15:25:18 -04:00
richard-dds
4da8c923ed Remove boto3 dependency 2019-10-28 14:01:03 -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
a0bccc64a9 Disable PortfolioRole when revoking an invite 2019-10-28 13:14:39 -04:00
leigh-mil
27df678aaf
Merge pull request #1138 from dod-ccpo/remove-scroll-revoke-button
App settings bugfixes
2019-10-28 12:52:16 -04:00
dandds
380a9beb6f
Merge pull request #1140 from dod-ccpo/azure-ci
Update CI and remove AWS config.
2019-10-28 11:34:25 -04:00
richard-dds
7c0179a108
Merge pull request #1136 from dod-ccpo/typecheck-cloud
Add mypy and add typechecking step to script/test
2019-10-28 10:24:11 -04:00
dandds
85da084cd7 Update CI and remove AWS config.
This does the following:
- Consolidates the app_setup and test jobs into one. The test job was
  only one additional step, so it's not worth separating.
- Updates the Postgres image used to reflect what we're using for the
  deployed version of the site (i.e., v 10).
- Removes some unnecessary steps from the first job.
- Removes all AWS config so that CD will only push to the Azure
  container registry, run migrations against the Azure-hosted database,
  and rotate the container images in the Azure k8s cluster.
2019-10-27 15:07:23 -04:00
dandds
d514305f26 Remove unused scripts. 2019-10-26 16:15:32 -04:00
graham-dds
854ca686c0
Merge pull request #1139 from dod-ccpo/app-invitation-modal-changes
App invitation modal step 2 changes
2019-10-25 14:47:50 -04:00
graham-dds
8d267a2a45 Remove required title and avatar icon from modal 2019-10-25 13:18:14 -04:00
graham-dds
c534dd10f2 Change text on step 2 of adding a member to an app 2019-10-25 13:17:21 -04:00
leigh-mil
a41c2edca3 add revoke invite link back 2019-10-25 13:16:12 -04:00
Jay R. Newlin (PromptWorks)
2ee30fec79
Merge pull request #1135 from dod-ccpo/readme-fix
Modified README for typo 'script' vs 'scripts' directory
2019-10-24 14:51:29 -04:00
richard-dds
c66b1ef2f9 Add mypy and add typechecking step to script/test
Only check atst/domain/csp/cloud.py for now
2019-10-24 14:44:53 -04:00
Jay R. Newlin (PromptWorks)
c21dc1cf8c Modified for typo script vs scripts directory 2019-10-24 14:18:09 -04:00