Commit Graph

2508 Commits

Author SHA1 Message Date
leigh-mil
6569bbd135 Merge pull request #1165 from dod-ccpo/ccpo-users-order
Sort ccpo users
2019-11-05 10:43:15 -05:00
dandds
d5bc49a7b9 Merge pull request #1156 from dod-ccpo/crl-issuer-cache
CRL Issuer Cache
2019-11-05 09:59:43 -05:00
leigh-mil
35b2718e18 Sort ccpo users by last name 2019-11-05 09:48:54 -05:00
richard-dds
daa0f81dd5 Merge pull request #1149 from dod-ccpo/lgtm-fixes
LGTM Fixes
2019-11-04 15:35:03 -05:00
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
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
richard-dds
e3c9105270 Fix some LGTM errors 2019-10-31 13:46:04 -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
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
5cd20c650a Draft of Azure create_environment 2019-10-30 16:43:59 -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
leigh-mil
e64900245d Remove baseline_info column from environments table 2019-10-30 14:46:33 -04:00
dandds
969293f5b2 Remove the Celery schedule for the environment baseline task. 2019-10-30 13:03:11 -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
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
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
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
graham-dds
9de90d796d Rename audit log feature flag config variable 2019-10-21 11:36:53 -04:00
graham-dds
c27e0e618e apply feature flag to /activity-history route 2019-10-21 11:36:53 -04:00
graham-dds
1ac9243749 edit create_audit_event method of AuditableMixin
- create dictonary of log data and log it. Only create insance of
AuditEvent if AUDIT_LOG_FEATURE_TOGGLE is set to True
2019-10-21 11:36:40 -04:00
graham-dds
8e0ce0519d Add AUDIT_LOG_FEATURE_TOGGLE to flask app settings
- set in ini config
2019-10-21 10:32:58 -04:00
dandds
efcb9681d3 Make Postgres SSL connection configurable.
This will allow us to force SSL connections to the database in
production by setting two values:

- PGSSLMODE should be set to "verify-full". This forces the client to
  verify the server against a known CA: https://www.postgresql.org/docs/10/libpq-ssl.html
- PGSSLROOTCERT should be set to the path of the public cert for the
  relevant CA.

When the database connection is made, these values are passed to the
adapter. For local development, PGSSLMODE is set to "prefer" and
PGSSLROOTCERT is left unset.

Kubernetes config has been added to maintain the root CAs for both Azure
and AWS as k8s ConfigMap objects. These are mounted into the containers
and referenced by PGSSLROOTCERT in the container environment.
2019-10-17 16:05:19 -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
59ae5a6b12 Merge pull request #1118 from dod-ccpo/revoke-app-invite_2
Disable the App Role when revoking an invite.
2019-10-15 16:41:51 -04:00
leigh-mil
1eecf19459 Update flash message for resending an invite 2019-10-15 14:35:13 -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
graham-dds
e8595e592a Merge pull request #1111 from dod-ccpo/multistep-app-provisioning-design-tweaks
More multistep app provisioning design tweaks
2019-10-14 15:40:04 -04:00
graham-dds
8e6a4101ff Update copy in headers / flash 2019-10-14 14:46:00 -04:00
graham-dds
24be9a6a61 Update copy for new app provisioning
- change flashed message for adding members
- use the correct helper text for the app name input
- a few other updates to text in translations
2019-10-14 10:10:22 -04:00
leigh-mil
10c16cc4ef Send email after environment is provisioned 2019-10-10 09:45:01 -04:00
richard-dds
95b33ac33d Add beat task for dispatch_delete_user 2019-10-09 09:57:50 -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
274ff9fbbf Trigger environment_role deletion 2019-10-08 16:42:25 -04:00
richard-dds
78c4949776 Move sqlalchemy_dumps to atst.utils.json 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
1a809418b1 Refactor out duplicate dictionary 2019-10-08 16:10:46 -04:00
leigh-mil
13bc830536 Add update invite form to settings page and move user info page of member form into its own macro 2019-10-08 16:10:46 -04:00