diff --git a/ChangeLog b/ChangeLog index 32a68a1..b840182 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2018-03-08 Richard Frith-Macdonald + + * EcControl.m: Allow EcControlKeyTest to be defined to supply a key + without requring it to be entered from the terminal. This is solely + to enable automated testing of systems. + 2018-03-02 Richard Frith-Macdonald * Control.m: diff --git a/ECCL.h b/ECCL.h index af954bc..116296b 100644 --- a/ECCL.h +++ b/ECCL.h @@ -54,13 +54,23 @@ string ControlVersion is defined, it is written to one line of this file and in any case a timestamp is written.

-

If the EcControlKey user default (treated as a boolean) is true, - The Control server requires manual entry of a key from the - terminal and makes the string entered (leading and trailing - white space stripped) available as EcControlKey in the configuration - information it gives to other processes.
+

If the EcControlKey NSUserDefault (32 hex digits) is set when the + Control server is started, it must also be set to the same value + in Control.plist, and on startup the Control server then requires + manual entry of a key from the terminal (and makes the string + entered (leading and trailing white space stripped) available as + EcControlKey in the configuration information it gives to other + processes.
This for instance allows all processes in a cluster to use a single - encryption key never stored on disk. + encryption key never stored on disk.
+ The value of EcControlKey in Control.plist must be the MD5 hash of + the value entered as the master key, otherwise the Control server + will log a warning and shut down.
+ For purposes of automated testing only, Control.plist may contain + the master key (64 hex digits) in EcControlKeyTest. In this case + EcControlKey need not be defined as an NSUserDefault (because the + Control server does not need to read the master key from the + terminal).

diff --git a/EcControl.m b/EcControl.m index cd80707..af8b419 100644 --- a/EcControl.m +++ b/EcControl.m @@ -2796,10 +2796,23 @@ static NSString* cmdWord(NSArray* a, unsigned int pos) } if ([controlKey length] == 0 && digest != nil) { - ASSIGN(configFailed, - @"EcControlKey configured but no value supplied on startup"); - [[self cmdLogFile: logname] printf: @"%@", configFailed]; - return NO; + NSString *key; + + if ([(key = [[[conf objectForKey: @"*"] objectForKey: @"*"] + objectForKey: @"EcControlKeyTest"]) length] == 64) + { + /* Operating in test mode with the master key stored in + * Control.plist as EcControlKeyTest + */ + ASSIGN(controlKey, key); + } + else + { + ASSIGN(configFailed, + @"EcControlKey configured but no value supplied on startup"); + [[self cmdLogFile: logname] printf: @"%@", configFailed]; + return NO; + } } if (digest != nil) {