From eb67ccad5a4a95db2579b9abc03bcbf068213512 Mon Sep 17 00:00:00 2001 From: Ryan McKern Date: Thu, 9 Feb 2017 16:09:47 -0800 Subject: [PATCH] (POOLER-71) dummy auth only works in debug mode If a user attempts to start vmpooler using dummy authentication without setting the environment variable VMPOOLER_DEBUG, the vmpooler will now refuse to start. --- lib/vmpooler.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/vmpooler.rb b/lib/vmpooler.rb index 844aa6e..05468d3 100644 --- a/lib/vmpooler.rb +++ b/lib/vmpooler.rb @@ -32,6 +32,19 @@ module Vmpooler parsed_config = YAML.load_file(config_file) end + # Bail out if someone attempts to start vmpooler with dummy authentication + # without enbaling debug mode. + if parsed_config[:auth]['provider'] == 'dummy' + unless ENV['VMPOOLER_DEBUG'] + warning = [ + "Dummy authentication should not be used outside of debug mode", + "please set environment variable VMPOOLER_DEBUG to 'true' if you want to use dummy authentication", + ] + + raise warning.join(";\s") + end + end + # Set some configuration defaults parsed_config[:redis] ||= {} parsed_config[:redis]['server'] ||= 'localhost'