Skip to content

Commit 541d13d

Browse files
ashbChris Fei
authored and
Chris Fei
committed
Don't let webserver run with dangerous config (apache#12747)
(cherry picked from commit dab783f)
1 parent 58b6167 commit 541d13d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

airflow/bin/cli.py

+11
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,17 @@ def webserver(args):
11391139
py2_deprecation_waring()
11401140
print(settings.HEADER)
11411141

1142+
# Check for old/insecure config, and fail safe (i.e. don't launch) if the config is wildly insecure.
1143+
if conf.get('webserver', 'secret_key') == 'temporary_key':
1144+
print(
1145+
"ERROR: The `secret_key` setting under the webserver config has an insecure "
1146+
"value - Airflow has failed safe and refuses to start. Please change this value to a new, "
1147+
"per-environment, randomly generated string, for example using this command `openssl rand "
1148+
"-hex 30`",
1149+
file=sys.stderr,
1150+
)
1151+
sys.exit(1)
1152+
11421153
access_logfile = args.access_logfile or conf.get('webserver', 'access_logfile')
11431154
error_logfile = args.error_logfile or conf.get('webserver', 'error_logfile')
11441155
num_workers = args.workers or conf.get('webserver', 'workers')

0 commit comments

Comments
 (0)