|
13 | 13 |
|
14 | 14 | DEBUG = False |
15 | 15 |
|
| 16 | +# Silence two security messages around SSL as router takes care of them |
| 17 | +# https://docs.djangoproject.com/es/1.9/ref/checks/#security |
| 18 | +SILENCED_SYSTEM_CHECKS = [ |
| 19 | + 'security.W004', |
| 20 | + 'security.W008' |
| 21 | +] |
| 22 | + |
16 | 23 | ADMINS = ( |
17 | 24 | # ('Your Name', 'your_email@example.com'), |
18 | 25 | ) |
|
84 | 91 | MIDDLEWARE_CLASSES = ( |
85 | 92 | 'corsheaders.middleware.CorsMiddleware', |
86 | 93 | 'django.middleware.security.SecurityMiddleware', |
| 94 | + 'django.middleware.clickjacking.XFrameOptionsMiddleware', |
| 95 | + 'django.middleware.csrf.CsrfViewMiddleware', |
87 | 96 | 'django.contrib.sessions.middleware.SessionMiddleware', |
88 | 97 | 'django.middleware.common.CommonMiddleware', |
89 | 98 | 'django.contrib.auth.middleware.AuthenticationMiddleware', |
90 | 99 | 'django.contrib.messages.middleware.MessageMiddleware', |
91 | 100 | 'api.middleware.APIVersionMiddleware', |
92 | 101 | 'deis.middleware.PlatformVersionMiddleware', |
93 | | - # Uncomment the next line for simple clickjacking protection: |
94 | | - # 'django.middleware.clickjacking.XFrameOptionsMiddleware', |
95 | 102 | ) |
96 | 103 |
|
97 | 104 | ROOT_URLCONF = 'deis.urls' |
|
125 | 132 | LOGIN_URL = '/v2/auth/login/' |
126 | 133 | LOGIN_REDIRECT_URL = '/' |
127 | 134 |
|
| 135 | +# Security settings |
128 | 136 | CORS_ORIGIN_ALLOW_ALL = True |
129 | | - |
130 | 137 | CORS_ALLOW_HEADERS = ( |
131 | 138 | 'content-type', |
132 | 139 | 'accept', |
|
141 | 148 | 'Deis-Release', |
142 | 149 | ) |
143 | 150 |
|
| 151 | +X_FRAME_OPTIONS = 'DENY' |
| 152 | +CSRF_COOKIE_SECURE = True |
| 153 | +CSRF_COOKIE_HTTPONLY = True |
| 154 | +SESSION_COOKIE_SECURE = True |
| 155 | +SECURE_CONTENT_TYPE_NOSNIFF = True |
| 156 | +SECURE_BROWSER_XSS_FILTER = True |
| 157 | + |
| 158 | +# Honor HTTPS from a trusted proxy |
| 159 | +# see https://docs.djangoproject.com/en/1.6/ref/settings/#secure-proxy-ssl-header |
| 160 | +SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') |
| 161 | + |
144 | 162 | # standard datetime format used for logging, model timestamps, etc. |
145 | 163 | DEIS_DATETIME_FORMAT = '%Y-%m-%dT%H:%M:%S%Z' |
146 | 164 |
|
|
262 | 280 | SCHEDULER_OPTIONS = None |
263 | 281 |
|
264 | 282 | # security keys and auth tokens |
265 | | -SECRET_KEY = os.environ.get('DEIS_SECRET_KEY', 'CHANGEME_sapm$s%upvsw5l_zuy_&29rkywd^78ff(qi') |
266 | | -BUILDER_KEY = os.environ.get('DEIS_BUILDER_KEY', 'CHANGEME_sapm$s%upvsw5l_zuy_&29rkywd^78ff(qi') |
| 283 | +random_secret = 'CHANGEME_sapm$s%upvsw5l_zuy_&29rkywd^78ff(qi*#@&*^' |
| 284 | +SECRET_KEY = os.environ.get('DEIS_SECRET_KEY', random_secret) |
| 285 | +BUILDER_KEY = os.environ.get('DEIS_BUILDER_KEY', random_secret) |
267 | 286 |
|
268 | 287 | # registry settings |
269 | 288 | REGISTRY_HOST = os.environ.get('DEIS_REGISTRY_SERVICE_HOST', '127.0.0.1') |
|
299 | 318 |
|
300 | 319 | APP_URL_REGEX = '[a-z0-9-]+' |
301 | 320 |
|
302 | | -# Honor HTTPS from a trusted proxy |
303 | | -# see https://docs.djangoproject.com/en/1.6/ref/settings/#secure-proxy-ssl-header |
304 | | -SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') |
305 | | - |
306 | 321 | # Unit Hostname handling. |
307 | 322 | # Supports: |
308 | 323 | # default - Docker generated hostname |
|
0 commit comments