|
3 | 3 | Reads environment variables and defaults to a value suitable for dev/test environment if not set |
4 | 4 | """ |
5 | 5 |
|
6 | | -import base64 |
7 | | -import os.path |
8 | | -import secrets |
9 | | -import string |
10 | | -from typing import Dict, Any, List |
11 | | - |
12 | | -_basedir = os.path.abspath(os.path.dirname(__file__)) |
| 6 | +from os.path import abspath, dirname, realpath |
| 7 | +from os import environ |
| 8 | +# from typing import Dict, Any |
13 | 9 |
|
| 10 | +_basedir = abspath(dirname(__file__)) |
14 | 11 |
|
15 | 12 | # General |
16 | | -THREADS_PER_PAGE = os.environ.get("THREADS_PER_PAGE", 8) |
17 | | -CORS = os.environ.get("CORS", True) |
18 | | -DEBUG = os.environ.get("DEBUG", True) |
| 13 | +THREADS_PER_PAGE = environ.get("THREADS_PER_PAGE", 8) |
| 14 | +CORS = environ.get("CORS", True) |
| 15 | +DEBUG = environ.get("DEBUG", True) |
| 16 | +LEMUR_HOSTNAME = environ.get("LEMUR_HOSTNAME", "localhost") |
19 | 17 |
|
20 | 18 | # Logging |
21 | | -LOG_LEVEL = os.environ.get("LOG_LEVEL", "DEBUG") |
22 | | -LOG_FILE = os.environ.get("LOG_FILE", "lemur.log") |
23 | | -LOG_UPGRADE_FILE = os.environ.get("LOG_UPGRADE_FILE", "db_upgrade.log") |
24 | | -LOG_REQUEST_HEADERS = os.environ.get("LOG_REQUEST_HEADERS", "False") |
25 | | -LOG_SANITIZE_REQUEST_HEADERS = os.environ.get("LOG_SANITIZE_REQUEST_HEADERS", "True") |
| 19 | +LOG_LEVEL = environ.get("LOG_LEVEL", "DEBUG") |
| 20 | +LOG_FILE = environ.get("LOG_FILE", "lemur.log") |
| 21 | +LOG_UPGRADE_FILE = environ.get("LOG_UPGRADE_FILE", "db_upgrade.log") |
| 22 | +LOG_REQUEST_HEADERS = environ.get("LOG_REQUEST_HEADERS", "False") |
| 23 | +LOG_SANITIZE_REQUEST_HEADERS = environ.get("LOG_SANITIZE_REQUEST_HEADERS", "True") |
26 | 24 | LOG_REQUEST_HEADERS_SKIP_ENDPOINT = ["/metrics", "/healthcheck"] # These endpoints are noisy so skip them by default |
27 | 25 |
|
28 | 26 | # This is the secret key used by flask session management |
|
41 | 39 | LEMUR_DEFAULT_ORGANIZATION = "" |
42 | 40 | LEMUR_DEFAULT_ORGANIZATIONAL_UNIT = "" |
43 | 41 | LEMUR_SECURITY_TEAM_EMAIL = ["admin@localhost"] |
44 | | -SQLALCHEMY_DATABASE_URI = os.environ.get('SQLALCHEMY_DATABASE_URI', 'postgresql://lemur:lemur@localhost:5432/lemur') |
45 | 42 |
|
| 43 | +# Database settings |
| 44 | +SQLALCHEMY_DATABASE_URI = environ.get('SQLALCHEMY_DATABASE_URI', 'postgresql://lemur:lemur@localhost:5432/lemur') |
| 45 | +# SQLALCHEMY_ENABLE_FLASK_REPLICATED = False |
| 46 | +# SQLALCHEMY_TRACK_MODIFICATIONS = False |
| 47 | +# SQLALCHEMY_ECHO = True |
| 48 | +# SQLALCHEMY_ENGINE_OPTIONS = { |
| 49 | +# 'pool_recycle': 499, |
| 50 | +# 'pool_timeout': 20, |
| 51 | +# } |
46 | 52 |
|
47 | 53 | # LEMUR_DEFAULT_ISSUER_PLUGIN=cryptography-issuer |
48 | 54 | # LEMUR_DEFAULT_AUTHORITY=cryptography |
|
85 | 91 | IDP_PROTECT_BUILTINS = True |
86 | 92 | IDP_CREATE_PER_USER_ROLE = True # Generates Lemur role for each user (allows cert assignment to a single user) |
87 | 93 |
|
88 | | - |
89 | 94 | # # this is the secret used to generate oauth state tokens |
90 | | -# OAUTH_STATE_TOKEN_SECRET = repr(os.environ.get('OAUTH_STATE_TOKEN_SECRET', base64.b64encode(get_random_secret(32).encode('utf8')))) |
91 | | -# |
| 95 | +# OAUTH_STATE_TOKEN_SECRET = repr(environ.get('OAUTH_STATE_TOKEN_SECRET', '') |
| 96 | + |
92 | 97 | # REDIS_HOST = 'redis' |
93 | 98 | # REDIS_PORT = 6379 |
94 | 99 | # REDIS_DB = 0 |
95 | 100 | # CELERY_RESULT_BACKEND = f'redis://{REDIS_HOST}:{REDIS_PORT}' |
96 | 101 | # CELERY_BROKER_URL = f'redis://{REDIS_HOST}:{REDIS_PORT}' |
97 | 102 | # CELERY_IMPORTS = ('lemur.common.celery') |
98 | 103 | # CELERYBEAT_SCHEDULE: Dict[str, Any] = { |
99 | | - # All tasks are disabled by default. Enable any tasks you wish to run. |
100 | | - # 'fetch_all_pending_acme_certs': { |
101 | | - # 'task': 'lemur.common.celery.fetch_all_pending_acme_certs', |
102 | | - # 'options': { |
103 | | - # 'expires': 180 |
104 | | - # }, |
105 | | - # 'schedule': crontab(minute="*"), |
106 | | - # }, |
107 | | - # 'remove_old_acme_certs': { |
108 | | - # 'task': 'lemur.common.celery.remove_old_acme_certs', |
109 | | - # 'options': { |
110 | | - # 'expires': 180 |
111 | | - # }, |
112 | | - # 'schedule': crontab(hour=8, minute=0, day_of_week=5), |
113 | | - # }, |
114 | | - # 'clean_all_sources': { |
115 | | - # 'task': 'lemur.common.celery.clean_all_sources', |
116 | | - # 'options': { |
117 | | - # 'expires': 180 |
118 | | - # }, |
119 | | - # 'schedule': crontab(hour=5, minute=0, day_of_week=5), |
120 | | - # }, |
121 | | - # 'sync_all_sources': { |
122 | | - # 'task': 'lemur.common.celery.sync_all_sources', |
123 | | - # 'options': { |
124 | | - # 'expires': 180 |
125 | | - # }, |
126 | | - # 'schedule': crontab(hour="*/2", minute=0), |
127 | | - # }, |
128 | | - # 'report_celery_last_success_metrics': { |
129 | | - # 'task': 'lemur.common.celery.report_celery_last_success_metrics', |
130 | | - # 'options': { |
131 | | - # 'expires': 180 |
132 | | - # }, |
133 | | - # 'schedule': crontab(minute="*"), |
134 | | - # }, |
135 | | - # 'certificate_reissue': { |
136 | | - # 'task': 'lemur.common.celery.certificate_reissue', |
137 | | - # 'options': { |
138 | | - # 'expires': 180 |
139 | | - # }, |
140 | | - # 'schedule': crontab(hour=9, minute=0), |
141 | | - # }, |
142 | | - # 'certificate_rotate': { |
143 | | - # 'task': 'lemur.common.celery.certificate_rotate', |
144 | | - # 'options': { |
145 | | - # 'expires': 180 |
146 | | - # }, |
147 | | - # 'schedule': crontab(hour=10, minute=0), |
148 | | - # }, |
149 | | - # 'get_all_zones': { |
150 | | - # 'task': 'lemur.common.celery.get_all_zones', |
151 | | - # 'options': { |
152 | | - # 'expires': 180 |
153 | | - # }, |
154 | | - # 'schedule': crontab(minute="*/30"), |
155 | | - # }, |
156 | | - # 'check_revoked': { |
157 | | - # 'task': 'lemur.common.celery.check_revoked', |
158 | | - # 'options': { |
159 | | - # 'expires': 180 |
160 | | - # }, |
161 | | - # 'schedule': crontab(hour=10, minute=0), |
162 | | - # } |
163 | | - # 'enable_autorotate_for_certs_attached_to_destination': { |
164 | | - # 'task': 'lemur.common.celery.enable_autorotate_for_certs_attached_to_destination', |
165 | | - # 'options': { |
166 | | - # 'expires': 180 |
167 | | - # }, |
168 | | - # 'schedule': crontab(hour=10, minute=0), |
169 | | - # } |
170 | | - # 'enable_autorotate_for_certs_attached_to_endpoint': { |
171 | | - # 'task': 'lemur.common.celery.enable_autorotate_for_certs_attached_to_endpoint', |
172 | | - # 'options': { |
173 | | - # 'expires': 180 |
174 | | - # }, |
175 | | - # 'schedule': crontab(hour=10, minute=0), |
176 | | - # } |
177 | | - # 'notify_expirations': { |
178 | | - # 'task': 'lemur.common.celery.notify_expirations', |
179 | | - # 'options': { |
180 | | - # 'expires': 180 |
181 | | - # }, |
182 | | - # 'schedule': crontab(hour=10, minute=0), |
183 | | - # }, |
184 | | - # 'notify_authority_expirations': { |
185 | | - # 'task': 'lemur.common.celery.notify_authority_expirations', |
186 | | - # 'options': { |
187 | | - # 'expires': 180 |
188 | | - # }, |
189 | | - # 'schedule': crontab(hour=10, minute=0), |
190 | | - # }, |
191 | | - # 'send_security_expiration_summary': { |
192 | | - # 'task': 'lemur.common.celery.send_security_expiration_summary', |
193 | | - # 'options': { |
194 | | - # 'expires': 180 |
195 | | - # }, |
196 | | - # 'schedule': crontab(hour=10, minute=0, day_of_week='mon-fri'), |
197 | | - # } |
| 104 | +# All tasks are disabled by default. Enable any tasks you wish to run. |
| 105 | +# 'fetch_all_pending_acme_certs': { |
| 106 | +# 'task': 'lemur.common.celery.fetch_all_pending_acme_certs', |
| 107 | +# 'options': { |
| 108 | +# 'expires': 180 |
| 109 | +# }, |
| 110 | +# 'schedule': crontab(minute="*"), |
| 111 | +# }, |
| 112 | +# 'remove_old_acme_certs': { |
| 113 | +# 'task': 'lemur.common.celery.remove_old_acme_certs', |
| 114 | +# 'options': { |
| 115 | +# 'expires': 180 |
| 116 | +# }, |
| 117 | +# 'schedule': crontab(hour=8, minute=0, day_of_week=5), |
| 118 | +# }, |
| 119 | +# 'clean_all_sources': { |
| 120 | +# 'task': 'lemur.common.celery.clean_all_sources', |
| 121 | +# 'options': { |
| 122 | +# 'expires': 180 |
| 123 | +# }, |
| 124 | +# 'schedule': crontab(hour=5, minute=0, day_of_week=5), |
| 125 | +# }, |
| 126 | +# 'sync_all_sources': { |
| 127 | +# 'task': 'lemur.common.celery.sync_all_sources', |
| 128 | +# 'options': { |
| 129 | +# 'expires': 180 |
| 130 | +# }, |
| 131 | +# 'schedule': crontab(hour="*/2", minute=0), |
| 132 | +# }, |
| 133 | +# 'report_celery_last_success_metrics': { |
| 134 | +# 'task': 'lemur.common.celery.report_celery_last_success_metrics', |
| 135 | +# 'options': { |
| 136 | +# 'expires': 180 |
| 137 | +# }, |
| 138 | +# 'schedule': crontab(minute="*"), |
| 139 | +# }, |
| 140 | +# 'certificate_reissue': { |
| 141 | +# 'task': 'lemur.common.celery.certificate_reissue', |
| 142 | +# 'options': { |
| 143 | +# 'expires': 180 |
| 144 | +# }, |
| 145 | +# 'schedule': crontab(hour=9, minute=0), |
| 146 | +# }, |
| 147 | +# 'certificate_rotate': { |
| 148 | +# 'task': 'lemur.common.celery.certificate_rotate', |
| 149 | +# 'options': { |
| 150 | +# 'expires': 180 |
| 151 | +# }, |
| 152 | +# 'schedule': crontab(hour=10, minute=0), |
| 153 | +# }, |
| 154 | +# 'get_all_zones': { |
| 155 | +# 'task': 'lemur.common.celery.get_all_zones', |
| 156 | +# 'options': { |
| 157 | +# 'expires': 180 |
| 158 | +# }, |
| 159 | +# 'schedule': crontab(minute="*/30"), |
| 160 | +# }, |
| 161 | +# 'check_revoked': { |
| 162 | +# 'task': 'lemur.common.celery.check_revoked', |
| 163 | +# 'options': { |
| 164 | +# 'expires': 180 |
| 165 | +# }, |
| 166 | +# 'schedule': crontab(hour=10, minute=0), |
| 167 | +# } |
| 168 | +# 'enable_autorotate_for_certs_attached_to_destination': { |
| 169 | +# 'task': 'lemur.common.celery.enable_autorotate_for_certs_attached_to_destination', |
| 170 | +# 'options': { |
| 171 | +# 'expires': 180 |
| 172 | +# }, |
| 173 | +# 'schedule': crontab(hour=10, minute=0), |
| 174 | +# } |
| 175 | +# 'enable_autorotate_for_certs_attached_to_endpoint': { |
| 176 | +# 'task': 'lemur.common.celery.enable_autorotate_for_certs_attached_to_endpoint', |
| 177 | +# 'options': { |
| 178 | +# 'expires': 180 |
| 179 | +# }, |
| 180 | +# 'schedule': crontab(hour=10, minute=0), |
| 181 | +# } |
| 182 | +# 'notify_expirations': { |
| 183 | +# 'task': 'lemur.common.celery.notify_expirations', |
| 184 | +# 'options': { |
| 185 | +# 'expires': 180 |
| 186 | +# }, |
| 187 | +# 'schedule': crontab(hour=10, minute=0), |
| 188 | +# }, |
| 189 | +# 'notify_authority_expirations': { |
| 190 | +# 'task': 'lemur.common.celery.notify_authority_expirations', |
| 191 | +# 'options': { |
| 192 | +# 'expires': 180 |
| 193 | +# }, |
| 194 | +# 'schedule': crontab(hour=10, minute=0), |
| 195 | +# }, |
| 196 | +# 'send_security_expiration_summary': { |
| 197 | +# 'task': 'lemur.common.celery.send_security_expiration_summary', |
| 198 | +# 'options': { |
| 199 | +# 'expires': 180 |
| 200 | +# }, |
| 201 | +# 'schedule': crontab(hour=10, minute=0, day_of_week='mon-fri'), |
| 202 | +# } |
198 | 203 | # } |
199 | 204 | # CELERY_TIMEZONE = 'UTC' |
200 | 205 | # |
201 | | -# SQLALCHEMY_ENABLE_FLASK_REPLICATED = False |
202 | | -# SQLALCHEMY_TRACK_MODIFICATIONS = False |
203 | | -# SQLALCHEMY_ECHO = True |
204 | | -# SQLALCHEMY_ENGINE_OPTIONS = { |
205 | | -# 'pool_recycle': 499, |
206 | | -# 'pool_timeout': 20, |
207 | | -# } |
208 | | -# |
209 | 206 | # LEMUR_EMAIL = '[email protected]' |
210 | 207 | # LEMUR_SECURITY_TEAM_EMAIL_INTERVALS = [15, 2] |
211 | 208 | # LEMUR_DEFAULT_EXPIRATION_NOTIFICATION_INTERVALS = [30, 15, 2] |
|
218 | 215 | # DEFAULT_VALIDITY_DAYS = 365 |
219 | 216 | # |
220 | 217 | # LEMUR_OWNER_EMAIL_IN_SUBJECT = False |
221 | | -# LEMUR_DEFAULT_AUTHORITY = str(os.environ.get('LEMUR_DEFAULT_AUTHORITY', 'ExampleCa')) |
| 218 | +# LEMUR_DEFAULT_AUTHORITY = str(environ.get('LEMUR_DEFAULT_AUTHORITY', 'ExampleCa')) |
222 | 219 | # LEMUR_DEFAULT_ROLE = 'operator' |
223 | | -# |
224 | | -# # Authority Settings - These will change depending on which authorities you are |
225 | | -# # using |
226 | | -# current_path = os.path.dirname(os.path.realpath(__file__)) |
227 | | -# |
228 | | -# # DNS Settings |
229 | | -# |
230 | | -# # exclude logging missing SAN, since we can have certs from private CAs with only cn, prod parity |
| 220 | + |
| 221 | +# Authority Settings - These will change depending on which authorities you are using |
| 222 | +# current_path = dirname(realpath(__file__)) |
| 223 | + |
| 224 | +# DNS Settings |
| 225 | + |
| 226 | +# exclude logging missing SAN, since we can have certs from private CAs with only cn, prod parity |
231 | 227 | # LOG_SSL_SUBJ_ALT_NAME_ERRORS = False |
232 | 228 | # |
233 | 229 | # ACME_DNS_PROVIDER_TYPES = {"items": [ |
|
266 | 262 | # 'name': 'ultradns', |
267 | 263 | # }, |
268 | 264 | # ]} |
269 | | -# |
| 265 | + |
270 | 266 | # # Authority plugins which support revocation |
271 | 267 | # SUPPORTED_REVOCATION_AUTHORITY_PLUGINS = ['acme-issuer'] |
0 commit comments