New system default SOGoEncryptionKey

To be used to encrypt the passwords of remote Web calendars when
SOGoTrustProxyAuthentication is enabled.
pull/10/head
Francis Lachapelle 2013-03-11 09:34:36 -04:00
parent 41a6c02aa3
commit d12c651d59
5 changed files with 38 additions and 32 deletions

5
NEWS
View File

@ -1,8 +1,9 @@
2.0.5 (2013-02-dd) 2.0.5 (2013-03-dd)
------------------ ------------------
New features New features
- - new system default SOGoEncryptionKey to be used to encrypt the passwords of
remote Web calendars when SOGoTrustProxyAuthentication is enabled
Enhancements Enhancements
- Added logging of the X-Forwarded-For HTTP header (#2229) - Added logging of the X-Forwarded-For HTTP header (#2229)

View File

@ -1,6 +1,6 @@
/* SOGoWebAppointmentFolder.m - this file is part of SOGo /* SOGoWebAppointmentFolder.m - this file is part of SOGo
* *
* Copyright (C) 2009-2010 Inverse inc. * Copyright (C) 2009-2013 Inverse inc.
* *
* Author: Cyril Robert <crobert@inverse.ca> * Author: Cyril Robert <crobert@inverse.ca>
* Ludovic Marcotte <lmarcotte@inverse.ca> * Ludovic Marcotte <lmarcotte@inverse.ca>
@ -37,6 +37,7 @@
#import <NGCards/iCalCalendar.h> #import <NGCards/iCalCalendar.h>
#import <GDLContentStore/GCSFolder.h> #import <GDLContentStore/GCSFolder.h>
#import <SOGo/SOGoAuthenticator.h> #import <SOGo/SOGoAuthenticator.h>
#import <SOGo/SOGoSystemDefaults.h>
#import <SOGo/SOGoUser.h> #import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserSettings.h> #import <SOGo/SOGoUserSettings.h>
#import <SOGo/NSDictionary+Utilities.h> #import <SOGo/NSDictionary+Utilities.h>
@ -69,27 +70,23 @@ size_t curl_body_function(void *ptr, size_t size, size_t nmemb, void *buffer)
NSString *authValue, *userPassword; NSString *authValue, *userPassword;
NSArray *parts, *keys; NSArray *parts, *keys;
userPassword = [[self authenticatorInContext: context] userPassword = [[self authenticatorInContext: context] passwordInContext: context];
passwordInContext: context];
if ([userPassword length] == 0) if ([userPassword length] == 0)
{ {
authData = nil; userPassword = [[SOGoSystemDefaults sharedSystemDefaults] encryptionKey];
}
authValue
= [[self folderPropertyValueInCategory: @"WebCalendarsAuthentication"]
decryptWithKey: userPassword];
parts = [authValue componentsSeparatedByString: @":"];
if ([parts count] == 2)
{
keys = [NSArray arrayWithObjects: @"username", @"password", nil];
authData = [NSDictionary dictionaryWithObjects: parts
forKeys: keys];
} }
else else
{ authData = nil;
authValue
= [[self folderPropertyValueInCategory: @"WebCalendarsAuthentication"]
decryptWithKey: userPassword];
parts = [authValue componentsSeparatedByString: @":"];
if ([parts count] == 2)
{
keys = [NSArray arrayWithObjects: @"username", @"password", nil];
authData = [NSDictionary dictionaryWithObjects: parts
forKeys: keys];
}
else
authData = nil;
}
return authData; return authData;
} }
@ -99,18 +96,18 @@ size_t curl_body_function(void *ptr, size_t size, size_t nmemb, void *buffer)
{ {
NSString *authValue, *userPassword; NSString *authValue, *userPassword;
userPassword = [[self authenticatorInContext: context] userPassword = [[self authenticatorInContext: context] passwordInContext: context];
passwordInContext: context]; if ([userPassword length] == 0) {
if ([userPassword length] > 0) userPassword = [[SOGoSystemDefaults sharedSystemDefaults] encryptionKey];
{ }
if (!username)
username = @""; if (!username)
if (!password) username = @"";
password = @""; if (!password)
authValue = [NSString stringWithFormat: @"%@:%@", username, password]; password = @"";
[self setFolderPropertyValue: [authValue encryptWithKey: userPassword] authValue = [NSString stringWithFormat: @"%@:%@", username, password];
inCategory: @"WebCalendarsAuthentication"]; [self setFolderPropertyValue: [authValue encryptWithKey: userPassword]
} inCategory: @"WebCalendarsAuthentication"];
} }
- (NSDictionary *) loadWebCalendar - (NSDictionary *) loadWebCalendar

View File

@ -10,6 +10,8 @@
SOGoZipPath = "/usr/bin/zip"; SOGoZipPath = "/usr/bin/zip";
SOGoEncryptionKey = "MySOGoEncryptionKey";
WOUseRelativeURLs = YES; WOUseRelativeURLs = YES;
WOMessageUseUTF8 = YES; WOMessageUseUTF8 = YES;
WOParsersUseUTF8 = YES; WOParsersUseUTF8 = YES;

View File

@ -43,6 +43,7 @@
- (BOOL) debugLeaks; - (BOOL) debugLeaks;
- (int) vmemLimit; - (int) vmemLimit;
- (BOOL) trustProxyAuthentication; - (BOOL) trustProxyAuthentication;
- (NSString *) encryptionKey;
- (BOOL) useRelativeURLs; - (BOOL) useRelativeURLs;
- (BOOL) isWebAccessEnabled; - (BOOL) isWebAccessEnabled;

View File

@ -349,6 +349,11 @@ _injectConfigurationFromFile (NSMutableDictionary *defaultsDict,
return [self boolForKey: @"SOGoTrustProxyAuthentication"]; return [self boolForKey: @"SOGoTrustProxyAuthentication"];
} }
- (NSString *) encryptionKey;
{
return [self stringForKey: @"SOGoEncryptionKey"];
}
- (BOOL) useRelativeURLs - (BOOL) useRelativeURLs
{ {
return [self boolForKey: @"WOUseRelativeURLs"]; return [self boolForKey: @"WOUseRelativeURLs"];