Enhancement for automated testing

This commit is contained in:
Richard Frith-Macdonald 2018-03-08 10:04:25 +00:00
parent 4205f7c074
commit 18653e0506
3 changed files with 39 additions and 10 deletions

View file

@ -1,3 +1,9 @@
2018-03-08 Richard Frith-Macdonald <rfm@gnu.org>
* 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 <rfm@gnu.org> 2018-03-02 Richard Frith-Macdonald <rfm@gnu.org>
* Control.m: * Control.m:

22
ECCL.h
View file

@ -54,13 +54,23 @@
string ControlVersion is defined, it is written to one line of string ControlVersion is defined, it is written to one line of
this file and in any case a timestamp is written. this file and in any case a timestamp is written.
</p> </p>
<p>If the EcControlKey user default (treated as a boolean) is true, <p>If the EcControlKey NSUserDefault (32 hex digits) is set when the
The Control server requires manual entry of a key from the Control server is started, it must also be set to the same value
terminal and makes the string entered (leading and trailing in Control.plist, and on startup the Control server then requires
white space stripped) available as EcControlKey in the configuration manual entry of a key from the terminal (and makes the string
information it gives to other processes.<br /> entered (leading and trailing white space stripped) available as
EcControlKey in the configuration information it gives to other
processes.<br />
This for instance allows all processes in a cluster to use a single 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.<br />
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.<br />
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).
</p> </p>
</section> </section>

View file

@ -2796,10 +2796,23 @@ static NSString* cmdWord(NSArray* a, unsigned int pos)
} }
if ([controlKey length] == 0 && digest != nil) if ([controlKey length] == 0 && digest != nil)
{ {
ASSIGN(configFailed, NSString *key;
@"EcControlKey configured but no value supplied on startup");
[[self cmdLogFile: logname] printf: @"%@", configFailed]; if ([(key = [[[conf objectForKey: @"*"] objectForKey: @"*"]
return NO; 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) if (digest != nil)
{ {