diff options
author | Stefan Hacker <dd0t@users.sourceforge.net> | 2010-02-12 03:21:56 +0300 |
---|---|---|
committer | Stefan Hacker <dd0t@users.sourceforge.net> | 2010-02-12 03:21:56 +0300 |
commit | 88900308ddcac54efd48bf07b52304da2dc63f43 (patch) | |
tree | 1cd4bf0538f16441fb4b272021983b6d57cd00ad /Authenticators/phpBB3 | |
parent | 5da1dc21ae1a39719dd7b51a9dae5dc04999c8c4 (diff) |
Add icesecret feature to smfauth.py and phpbb3auth.py
Diffstat (limited to 'Authenticators/phpBB3')
-rw-r--r-- | Authenticators/phpBB3/phpBB3auth.ini | 1 | ||||
-rw-r--r-- | Authenticators/phpBB3/phpBB3auth.py | 30 |
2 files changed, 23 insertions, 8 deletions
diff --git a/Authenticators/phpBB3/phpBB3auth.ini b/Authenticators/phpBB3/phpBB3auth.ini index b97b849..1b2c9b1 100644 --- a/Authenticators/phpBB3/phpBB3auth.ini +++ b/Authenticators/phpBB3/phpBB3auth.ini @@ -22,6 +22,7 @@ avatar_path = http://localhost/phpBB3/download/file.php?avatar= host = 127.0.0.1 port = 6502 slice = Murmur.ice +secret = ;Murmur configuration [murmur] diff --git a/Authenticators/phpBB3/phpBB3auth.py b/Authenticators/phpBB3/phpBB3auth.py index cd6b772..f7ed454 100644 --- a/Authenticators/phpBB3/phpBB3auth.py +++ b/Authenticators/phpBB3/phpBB3auth.py @@ -85,7 +85,8 @@ default = {'database':(('lib', str, 'MySQLdb'), 'ice':(('host', str, '127.0.0.1'), ('port', int, 6502), - ('slice', str, 'Murmur.ice')), + ('slice', str, 'Murmur.ice'), + ('secret', str, '')), 'iceraw':None, @@ -222,6 +223,12 @@ def do_main_program(): """ ice = self.communicator() + if cfg.ice.secret: + debug('Using shared ice secret') + ice.getImplicitContext().put("secret", cfg.ice.secret) + elif not cfg.glacier.enabled: + warning('Consider using an ice secret to improve security') + if cfg.glacier.enabled: #info('Connecting to Glacier2 server (%s:%d)', glacier_host, glacier_port) error('Glacier support not implemented yet') @@ -237,13 +244,18 @@ def do_main_program(): adapter = ice.createObjectAdapterWithEndpoints('Callback.Client', 'tcp -h %s' % cfg.ice.host) adapter.activate() - - for server in meta.getBootedServers(): - if not cfg.murmur.servers or server.id() in cfg.murmur.servers: - info('Setting authenticator for server %d', server.id()) - authprx = adapter.addWithUUID(phpBBauthenticator(server, adapter)) - auth = Murmur.ServerUpdatingAuthenticatorPrx.uncheckedCast(authprx) - server.setAuthenticator(auth) + + try: + for server in meta.getBootedServers(): + if not cfg.murmur.servers or server.id() in cfg.murmur.servers: + info('Setting authenticator for server %d', server.id()) + authprx = adapter.addWithUUID(phpBBauthenticator(server, adapter)) + auth = Murmur.ServerUpdatingAuthenticatorPrx.uncheckedCast(authprx) + server.setAuthenticator(auth) + except Murmur.InvalidSecretException: + error('Invalid ice secret') + return False + return True class phpBBauthenticator(Murmur.ServerUpdatingAuthenticator): @@ -529,6 +541,8 @@ def do_main_program(): initdata.properties = Ice.createProperties([], initdata.properties) for prop, val in cfg.iceraw: initdata.properties.setProperty(prop, val) + + initdata.properties.setProperty("Ice.ImplicitContext", "Shared") initdata.logger = CustomLogger() app = phpBBauthenticatorApp() |