76 Commits

Author SHA1 Message Date
graham-dds
237848c2c9 Azure cloud method to get a url to the calculator 2020-02-18 16:15:07 -05:00
graham-dds
8f52443b5d Send email to PPOC when portfolio is provisioned
When a portfolio state machine transitions to the COMPLETED state, an
email is sent to the PPOC letting them know it's ready, and provides
them with their username needed to create a password.
2020-02-13 10:55:47 -05:00
dandds
10014e696d Merge branch 'staging' into environment-role-creation 2020-02-11 12:12:45 -05:00
dandds
f975249f07 Set Redis verification mode for TLS connections.
If the app is making a TLS connection to Redis, the new config setting
REDIS_SSLMODE determines whether CA verification should be performed.
Acceptable values are Python `None` or strings "none", "optional", and
"required".
2020-02-10 16:58:07 -05:00
dandds
b754f1384f Include all Azure config in the INI file.
Adds all the new config items to the INI file and adjusts some naming
conventions so that these values sort together. Also adds defaults for
some values where they're known.
2020-02-04 16:12:45 -05:00
graham-dds
00a5a98577 Add Mailer class method to email TOs to MSFT 2020-01-31 13:17:00 -05:00
leigh-mil
0c408bccfd Update PDF file size limit to be less than the GMail SMTP size limit 2020-01-31 11:59:07 -05:00
leigh-mil
dff9924c95 Make file size limit configurable 2020-01-31 11:59:07 -05:00
dandds
6edc7b138b Set SESSION_COOKIE_SECURE for deployed environments.
This sets the "Secure" attribute on cookies sent to the client:

https://flask.palletsprojects.com/en/1.1.x/config/#SESSION_COOKIE_SECURE
2020-01-29 14:39:56 -05:00
dandds
944c5d3c9f Forcibly destroy existing session on logout.
To comply with security guidelines, we need to destroy the session when
a user logs out. This means that the session's key in the Redis cache
needs to be deleted. Flask expects to _always_ have a session object. If
the current session object does not exist in the Redis cache, Flask will
reserialize and store it at the end of the request. In order for
session deletion to work, we need to delete the key for the existing
session and then replace the session object with a new, empty one.

This also updates the SessionLimiter class so that the session prefix is
configurable.
2020-01-23 10:31:20 -05:00
raydds
1fa5de6f90 Add a configuration to totally disable the mailer 2020-01-16 11:27:14 -05:00
dandds
60b12fca52 Config to specify session cookie domain.
This got lost somewhere along the way (almost certainly by me), so this
commit tries to make it explicit. The app needs to be able to configure
the session cookie domain name so that it is valid for both the main
site domain and the authentication subdomain. For instance, if the site
is runnning at uat.atat.code.mil and authentication happens at
auth-uat.atat.code.mil, SESSION_COOKIE_DOMAIN should be set to
atat.code.mil so that it's valid for both.

This adds the setting to the base INI file and a default for our K8s
clusters.
2020-01-06 14:07:53 -05:00
dandds
3bfb6c9621 Basic implementation for a policy wrapper.
The implementation here is meant to wrap a library of JSON policy
documents. Policies should be added to directories corresponding to
where they will be defined (portfolio, application, environment).
Functionality for parsing portfolio policy definitions is included. When
the policies need to be defined on a management group, the
AzureCloudProvider can iterate the appropriate tier of the policy
manager and add those definitions.
2019-12-20 10:34:12 -05:00
dandds
2d714cae39 Add some missing configuration settings.
These settings are used in the deployed instance and mentioned elsewhere
in the README, but were missing from the base INI file and the
Configuration Guide section of the README.
2019-12-10 10:14:53 -05:00
dandds
20c7e943c8 Compose REDIS_URI from component parts.
This updates the configuration handling for the Redis connection string.
The motivation is so that the Redis password can be managed separately
via Azure Key Vault and eventually be rotated independently of the rest
of the connection URI.

This also tweaks the method we use to build the DATABASE_URI and removes
some stale config from the CI config file.
2019-12-04 13:28:26 -05:00
richard-dds
6b2427a98d Remove unused RQ_QUEUES 2019-11-27 10:30:42 -05:00
richard-dds
684b86c2d0 Remove PE_NUMBER_CSV_URL and PGAPPNAME 2019-11-27 10:30:42 -05:00
richard-dds
2f8135ecd1 Remove CLASSIFIED param 2019-11-27 10:30:42 -05:00
tomdds
4df68bab23 Add BLOB_STORAGE_URL config
Our content security policy in non-dev environments didn't allow uploading to azure blob storage. This adds a configurable blob storage base URL to allow regions to specify which storage endpoint they expect the upload request to use.
2019-11-22 11:56:27 -05:00
dandds
08fc530223 Add config value for CDN origin.
This value is set as the Access-Control-Allow-Origin header value for
the application. When using Azure CDN, the CDN will consume this header
when it populates its cache and use it on subsequent requests.

It would be possible to make this the same as the Flask SERVER_NAME
value. We explicitly set SERVER_NAME for Celery worker processes because
they need that information to contruct URLs outside of the request cycle
(Flask can infer the server name within a request cycle). I decided not
to rely on SERVER_NAME though because it has side effects:

- It determines what `url_for` uses as the host domain (which would be
  fine).
- It makes it so that the Flask app can only server requests to that
  domain (probably fine, but it felt like too big a side effect).

Additionally, SERVER_NAME does not include the scheme. For all of these
reasons I opted to make CDN_ORIGIN a separate config value.
2019-11-21 16:43:22 -05:00
dandds
293854ece6 CircleCI config for passing CDN url to the Docker image.
The workflows need to split since we're passing different parameters to
the Docker build at the beginning of the workflow.
2019-11-21 16:42:42 -05:00
richard-dds
4c693cf9c0 Fix bad rebase 2019-11-21 16:42:42 -05:00
richard-dds
5e9a3f0ba6 Add STATIC_URL and ASSET_URL config in base.ini 2019-11-21 16:42:42 -05:00
dandds
88171aaee7 Supply named default queue for Celery.
Supplying this will prevent queue clashes between various ATAT sites
sharing the same Redis instance.

Note that the Celery documentation is currently wrong about the name for
configuring this:

https://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-task_default_queue

It specifies `CELERY_TASK_DEFAULT_QUEUE`, but
`CELERY_DEFAULT_QUEUE` is the value that Celery currently looks for.
This appears to be fixed in on an upcoming release:

https://github.com/celery/celery/issues/5575

This is worth keeping an eye on, since the configuration key could
change in the future.
2019-11-14 15:48:14 -05:00
richard-dds
4b8296c6ea Remove unused configuration values from base.ini 2019-11-12 16:57:46 -05:00
graham-dds
9de90d796d Rename audit log feature flag config variable 2019-10-21 11:36:53 -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
leigh-mil
e4ca027065 Validate CLIN PoP against configurable contract start and end dates 2019-09-06 10:12:34 -04:00
dandds
5f0ff137d3 Raise default session lifetime to 30 minutes. 2019-08-21 14:44:55 -04:00
dandds
485f578c78 Apply config changes for CSP file uploads.
This applies configuration changes for the Flask app and adds changes to
the Dockerfile so that the build can make a CSP-specific JS bundle. It
adds `write_dotenv` script that creates the appropriate `.env` file for
the `parcel` bundler depending on how the `CSP` environment variable is
set.

- Configure K8s environment variables for Flask CSP usage
- Supply default CSP config setting to Flask app
- Declare the CSP arg in the Dockerfile
- Supply extra Docker build args to CD
- Fix top-level reference to boto3 in file_upload module
- Add back missing sample NGINX config for docker-compose build
2019-08-09 08:05:20 -04:00
leigh-mil
90caeae063 Add back in CRL_STORAGE_CONTAINER to base.ini 2019-08-08 16:57:38 -04:00
dandds
9fc6514d80 Clean up defunct upload and CRL logic.
- Applies our previous CSP namespacing pattern to the upload classes.
- Removes code and config for previous uploader implementation.
- Removes Attachment model's ability to upload files directly and
  adjusts tests that expected that behavior.
2019-08-08 13:20:27 -04:00
richard-dds
5dcbee333a Make session limiter configurable 2019-05-28 10:45:12 -04:00
dandds
b8a24c37c4 Make SQLALCHEMY_ECHO option independent of DEBUG for sqlalchemy logging. 2019-05-02 15:41:13 -04:00
dandds
d73b082471 configurable json logging for atst app 2019-04-01 12:34:53 -04:00
Montana
d6906c8504 Add config for CRL_FAIL_OPEN 2019-03-14 13:42:12 -04:00
dandds
725042ab76 modify crl storage config:
- make local container for libcloud storage if it does not exist
- separate config variables for CRL storage
2019-02-27 05:51:50 -05:00
dandds
9aa15d57e8 CRL Provider for syncing CRLs from cached source 2019-02-27 05:51:50 -05:00
dandds
4bd41950c6 remove REQUIRE_CRLS setting in favor of DISABLE_CRL_CHECK 2019-01-18 09:48:43 -05:00
dandds
becaec8d42 no op version of CRL cache for disabling crl check 2019-01-17 10:28:40 -05:00
George Drummond
99f34fe45a
Disable CLIN fields via a config option 2019-01-07 14:25:03 -05:00
Patrick Smith
4bbb55a06e Add RQ_QUEUES to default config
We can use string interpolation in the file rather than building it when
making the config. Adding the value to the config allows us to override
it with an environment variable, if we want to (as we do for the UAT
environment).
2018-10-31 16:12:00 -04:00
Patrick Smith
e177fe0037 Add REQUIRE_CRLS to config parser 2018-10-26 10:11:03 -04:00
dandds
ef2e97713a initial uploader and some form work 2018-08-27 13:04:41 -04:00
dandds
ee4458edd1 alphabetize base config 2018-08-08 09:49:55 -04:00
dandds
3b36066315 remove authnid base URL from config 2018-08-07 09:44:10 -04:00
dandds
69fb8217eb add default value for WTF_CSRF_ENABLED 2018-08-07 09:33:46 -04:00
dandds
94223e1869 add session expiration config 2018-08-06 15:03:09 -04:00