diff --git a/confluent/auth.py b/confluent/auth.py index 816816cf..3e8a0185 100644 --- a/confluent/auth.py +++ b/confluent/auth.py @@ -3,7 +3,7 @@ # the PBKDF2 transform is skipped unless a user has been idle for sufficient # time -import confluent.config as config +import confluent.config.configmanager as configmanager import eventlet import Crypto.Protocol.KDF as kdf import Crypto.Hash as hash @@ -41,7 +41,7 @@ def _get_usertenant(name, tenant=False): user = name elif '/' in name: # tenant scoped name tenant, user = name.split('/', 1) - elif config.is_tenant(name): + elif configmanager.is_tenant(name): # the account is the implicit tenant owner account user = name tenant = name @@ -66,9 +66,9 @@ def authorize(name, element, tenant=False, access='rw'): request. """ user, tenant = _get_usertenant(name, tenant) - if tenant is not None and not config.is_tenant(tenant): + if tenant is not None and not configmanager.is_tenant(tenant): return None - configmanager = config.ConfigManager(tenant) + configmanager = configmanager.ConfigManager(tenant) userobj = configmanager.get_user(user) if userobj: #returning return (userobj, configmanager) @@ -90,7 +90,7 @@ def set_user_passphrase(name, passphrase, tenant=None): salt = os.urandom(8) crypted = kdf.PBKDF2(passphrase, salt, 32, 10000, lambda p, s: hash.HMAC.new(p, s, hash.SHA256).digest()) - cfm = config.ConfigManager(tenant) + cfm = configmanager.ConfigManager(tenant) cfm.set_user(name, { 'cryptpass': (salt, crypted) }) @@ -131,7 +131,7 @@ def check_user_passphrase(name, passphrase, element=None, tenant=False): # invalidate cache and force the slower check del _passcache[(user, tenant)] return None - cfm = config.ConfigManager(tenant) + cfm = configmanager.ConfigManager(tenant) ucfg = cfm.get_user(user) if ucfg is None or 'cryptpass' not in ucfg: eventlet.sleep(0.05) #stall even on test for existance of a username diff --git a/confluent/config/__init__.py b/confluent/config/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/confluent/attribs.py b/confluent/config/attributes.py similarity index 100% rename from confluent/attribs.py rename to confluent/config/attributes.py diff --git a/confluent/config.py b/confluent/config/configmanager.py similarity index 100% rename from confluent/config.py rename to confluent/config/configmanager.py diff --git a/confluent/sockapi.py b/confluent/sockapi.py index afc29ee4..26f8818a 100644 --- a/confluent/sockapi.py +++ b/confluent/sockapi.py @@ -6,7 +6,7 @@ # # TODO: SO_PEERCRED for unix socket import confluent.consoleserver as consoleserver -import confluent.config as config +import confluent.config.configmanager as configmanager import eventlet.green.socket as socket import eventlet.green.ssl as ssl import eventlet @@ -43,7 +43,7 @@ def sessionhdl(connection, authname): print username print passphrase connection.sendall("Confluent -- v0 -- Session Granted\r\n/->") - cfm = config.ConfigManager(tenant=0) + cfm = configmanager.ConfigManager(tenant=0) consession = consoleserver.ConsoleSession(node='n1', configmanager=cfm, datacallback=connection.sendall) while (1):