diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ecbf7b2fb2..42142027afe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to this project will be documented in this file. Add any new changes to the top(right below this line). +- Role: edxapp + - Added `EDXAPP_SITE_CONFIGURATION` to allow creating/updating the `SiteConfiguration` values during provisioning. + - Role: edxapp BREAKING_CHANGE - The sandbox environment that runs instructor written python code used to run python 2.7. We update the default to python 3.5 but provide a new variable to be able to go back to the old setting. If `edxapp_sandbox_python_version` diff --git a/playbooks/roles/ecommerce/defaults/main.yml b/playbooks/roles/ecommerce/defaults/main.yml index 0c6f3549fc6..7da59dc30d3 100644 --- a/playbooks/roles/ecommerce/defaults/main.yml +++ b/playbooks/roles/ecommerce/defaults/main.yml @@ -83,6 +83,7 @@ ECOMMERCE_SOCIAL_AUTH_REDIRECT_IS_HTTPS: false # Settings for affiliate cookie tracking ECOMMERCE_AFFILIATE_COOKIE_NAME: '{{ EDXAPP_AFFILIATE_COOKIE_NAME | default("dev_affiliate_id") }}' +ECOMMERCE_OSCAR_DEFAULT_CURRENCY: 'USD' ECOMMERCE_OSCAR_FROM_EMAIL: 'oscar@example.com' # NOTE: The contents of the certificates should be set in private configuration @@ -194,9 +195,13 @@ ECOMMERCE_CORS_ALLOW_CREDENTIALS: false ECOMMERCE_USERNAME_REPLACEMENT_WORKER: "OVERRIDE THIS WITH A VALID USERNAME" +ECOMMERCE_SECURE_PROXY_SSL_HEADER: !!null + ecommerce_service_config_overrides: + SECURE_PROXY_SSL_HEADER: '{{ ECOMMERCE_SECURE_PROXY_SSL_HEADER }}' LANGUAGE_COOKIE_NAME: '{{ ECOMMERCE_LANGUAGE_COOKIE_NAME }}' EDX_API_KEY: '{{ ECOMMERCE_EDX_API_KEY }}' + OSCAR_DEFAULT_CURRENCY: '{{ ECOMMERCE_OSCAR_DEFAULT_CURRENCY }}' OSCAR_FROM_EMAIL: '{{ ECOMMERCE_OSCAR_FROM_EMAIL }}' ENTERPRISE_SERVICE_URL: '{{ ECOMMERCE_ENTERPRISE_URL }}/enterprise/' diff --git a/playbooks/roles/edx_django_service/templates/edx/app/nginx/sites-available/concerns/handle-ip-disclosure.j2 b/playbooks/roles/edx_django_service/templates/edx/app/nginx/sites-available/concerns/handle-ip-disclosure.j2 index bde470df881..f7267de637d 100644 --- a/playbooks/roles/edx_django_service/templates/edx/app/nginx/sites-available/concerns/handle-ip-disclosure.j2 +++ b/playbooks/roles/edx_django_service/templates/edx/app/nginx/sites-available/concerns/handle-ip-disclosure.j2 @@ -2,6 +2,11 @@ # there is a TLS redirect to same box, and a TLS redirect to externally terminated TLS # version of this in nginx and in edx_django_service role. +{% if NGINX_ALLOW_PRIVATE_IP_ACCESS %} +# This regexp matches only public IP addresses. +if ($host ~ "(\d+)(?/dev/null" + register: default_site_id + when: item.site_id is not defined and item.domain is not defined + + - name: Use the default SITE_ID as the site identifier + set_fact: + site_identifier: "--site-id {{ default_site_id.stdout }}" + when: item.site_id is not defined and item.domain is not defined + + - name: Run create_or_update_site_configuration + shell: | + . {{ edxapp_app_dir }}/edxapp_env + {{ edxapp_venv_bin }}/python {{ edxapp_code_dir }}/manage.py lms create_or_update_site_configuration -f /tmp/site_configuration.json --enabled {{ site_identifier }} + + - name: Remove the generated SiteConfiguration JSON file + file: + path: "/tmp/site_configuration.json" + state: absent diff --git a/playbooks/roles/edxapp/templates/site_configuration.json.j2 b/playbooks/roles/edxapp/templates/site_configuration.json.j2 new file mode 100644 index 00000000000..2fae98836c8 --- /dev/null +++ b/playbooks/roles/edxapp/templates/site_configuration.json.j2 @@ -0,0 +1 @@ +{{ item['values'] | to_nice_json }} diff --git a/playbooks/roles/nginx/defaults/main.yml b/playbooks/roles/nginx/defaults/main.yml index 6d8740680f6..a47a4f023e1 100644 --- a/playbooks/roles/nginx/defaults/main.yml +++ b/playbooks/roles/nginx/defaults/main.yml @@ -35,6 +35,8 @@ PROSPECTUS_PREVIEW_NGINX_USERS: NGINX_ENABLE_SSL: False NGINX_REDIRECT_TO_HTTPS: False +# Disable handling IP disclosure for private IP addresses. This is needed for ELB to run the health checks while using `NGINX_ENABLE_SSL`. +NGINX_ALLOW_PRIVATE_IP_ACCESS: False NGINX_HSTS_MAX_AGE: 31536000 # Set these to real paths on your # filesystem, otherwise nginx will diff --git a/playbooks/roles/nginx/templates/edx/app/nginx/sites-available/handle-ip-disclosure.j2 b/playbooks/roles/nginx/templates/edx/app/nginx/sites-available/handle-ip-disclosure.j2 index bde470df881..f7267de637d 100644 --- a/playbooks/roles/nginx/templates/edx/app/nginx/sites-available/handle-ip-disclosure.j2 +++ b/playbooks/roles/nginx/templates/edx/app/nginx/sites-available/handle-ip-disclosure.j2 @@ -2,6 +2,11 @@ # there is a TLS redirect to same box, and a TLS redirect to externally terminated TLS # version of this in nginx and in edx_django_service role. +{% if NGINX_ALLOW_PRIVATE_IP_ACCESS %} +# This regexp matches only public IP addresses. +if ($host ~ "(\d+)(?