def login(self, system_id, extra_data={}): """Return a dictionary of session token/channel information. Also sets this information in the headers. """ log_debug(5, self.remote_hostname) # Authenticate the system certificate. self.auth_system() # log the entry log_debug(1, self.remote_hostname) rhnServerTime = str(time.time()) expireOffset = str(CFG.SATELLITE_AUTH_TIMEOUT) signature = rhnLib.computeSignature(CFG.SECRET_KEY, self.remote_hostname, rhnServerTime, expireOffset) loginDict = { 'X-RHN-Server-Hostname': self.remote_hostname, 'X-RHN-Auth': signature, 'X-RHN-Auth-Server-Time': rhnServerTime, 'X-RHN-Auth-Expire-Offset': expireOffset, } # XXX This request is not proxy-cacheable log_debug(5, "loginDict", loginDict) return loginDict
def login(self, system_id, extra_data={}): """Return a dictionary of session token/channel information. Also sets this information in the headers. """ log_debug(5, self.remote_hostname) # Authenticate the system certificate. self.auth_system() # log the entry log_debug(1, self.remote_hostname) rhnServerTime = str(time.time()) expireOffset = str(CFG.SATELLITE_AUTH_TIMEOUT) signature = rhnLib.computeSignature(CFG.SECRET_KEY, self.remote_hostname, rhnServerTime, expireOffset) loginDict = { 'X-RHN-Server-Hostname' : self.remote_hostname, 'X-RHN-Auth' : signature, 'X-RHN-Auth-Server-Time' : rhnServerTime, 'X-RHN-Auth-Expire-Offset' : expireOffset, } # XXX This request is not proxy-cacheable log_debug(5, "loginDict", loginDict) return loginDict
def login(self, system_id, extra_data={}): """ Clients v2+ Log in routine. Return a dictionary of session token/channel information. Also sets this information in the headers. """ log_debug(5, system_id) # Authenticate the system certificate. We need the user record # to generate the tokens self.load_user = 1 server = self.auth_system('login', system_id) # log the entry log_debug(1, self.server_id) # Update the capabilities list rhnCapability.update_client_capabilities(self.server_id) # Fetch the channels this client is subscribed to channels = rhnChannel.getSubscribedChannels(self.server_id) rhnServerTime = str(time.time()) expireOffset = str(CFG.CLIENT_AUTH_TIMEOUT) signature = computeSignature(CFG.SECRET_KEY, self.server_id, self.user, rhnServerTime, expireOffset) loginDict = { 'X-RHN-Server-Id': self.server_id, 'X-RHN-Auth-User-Id': self.user, 'X-RHN-Auth': signature, 'X-RHN-Auth-Server-Time': rhnServerTime, 'X-RHN-Auth-Expire-Offset': expireOffset, # List of lists [[label,last_mod],...]: 'X-RHN-Auth-Channels': channels } # Duplicate these values in the headers so that the proxy can # intercept and cache them without parseing the xmlrpc. transport = rhnFlags.get('outputTransportOptions') for k, v in loginDict.items(): # Special case for channels if string.lower(k) == string.lower('X-RHN-Auth-Channels'): # Concatenate the channel information column-separated transport[k] = [string.join(x, ':') for x in v] else: transport[k] = v log_debug(5, "loginDict", loginDict, transport) # store route in DB (schema for RHN 3.1+ only!) server_route.store_client_route(self.server_id) return loginDict
def login(self, system_id): """ Login routine for the proxy Return a formatted string of session token information as regards an Spacewalk Proxy. Also sets this information in the headers. NOTE: design description for the auth token format and how it is is used is well documented in the proxy/broker/rhnProxyAuth.py code. """ log_debug(5, system_id) # Authenticate. We need the user record to be able to generate # auth tokens self.load_user = 1 self.auth_system(system_id) # log the entry log_debug(1, self.server_id) rhnServerTime = str(time.time()) expireOffset = str(CFG.PROXY_AUTH_TIMEOUT) signature = computeSignature(CFG.SECRET_KEY, self.server_id, self.user, rhnServerTime, expireOffset) token = '%s:%s:%s:%s:%s' % (self.server_id, self.user, rhnServerTime, expireOffset, signature) # NOTE: for RHN Proxies of version 3.1+ tokens are passed up in a # multi-valued header with HOSTNAME tagged onto the end of the # token, so, it looks something like this: # x-rhn-proxy-auth: 'TOKEN1:HOSTNAME1,TOKEN2:HOSTNAME2' # This note is only that -- a "heads up" -- in case anyone gets # confused. # Push this value into the headers so that the proxy can # intercept and cache it without parsing the xmlrpc. transport = rhnFlags.get('outputTransportOptions') transport['X-RHN-Action'] = 'login' transport['X-RHN-Proxy-Auth'] = token return token
def login(self, system_id, extra_data={}): """ Clients v2+ Log in routine. Return a dictionary of session token/channel information. Also sets this information in the headers. """ log_debug(5, system_id) # Authenticate the system certificate. We need the user record # to generate the tokens self.load_user = 1 server = self.auth_system('login', system_id) # log the entry log_debug(1, self.server_id) # Update the capabilities list rhnCapability.update_client_capabilities(self.server_id) # Fetch the channels this client is subscribed to channelList = rhnChannel.channels_for_server(self.server_id) channels = [] for each in channelList: if not each.has_key('last_modified'): # No last_modified attribute # Probably an empty channel, so ignore continue channel = [each['label'], each['last_modified']] # isBaseChannel if each['parent_channel']: flag = "0" else: flag = "1" channel.append(flag) # isLocalChannel if each['local_channel']: flag = "1" else: flag = "0" channel.append(flag) channels.append(channel) rhnServerTime = str(time.time()) expireOffset = str(CFG.CLIENT_AUTH_TIMEOUT) signature = computeSignature(CFG.SECRET_KEY, self.server_id, self.user, rhnServerTime, expireOffset) loginDict = { 'X-RHN-Server-Id': self.server_id, 'X-RHN-Auth-User-Id': self.user, 'X-RHN-Auth': signature, 'X-RHN-Auth-Server-Time': rhnServerTime, 'X-RHN-Auth-Expire-Offset': expireOffset, # List of lists [[label,last_mod],...]: 'X-RHN-Auth-Channels': channels } # Duplicate these values in the headers so that the proxy can # intercept and cache them without parseing the xmlrpc. transport = rhnFlags.get('outputTransportOptions') for k, v in loginDict.items(): # Special case for channels if string.lower(k) == string.lower('X-RHN-Auth-Channels'): # Concatenate the channel information column-separated transport[k] = map(lambda x: string.join(x, ':'), v) else: transport[k] = v log_debug(5, "loginDict", loginDict, transport) # store route in DB (schema for RHN 3.1+ only!) server_route.store_client_route(self.server_id) return loginDict
def login(self, system_id, extra_data={}): """ Clients v2+ Log in routine. Return a dictionary of session token/channel information. Also sets this information in the headers. """ log_debug(5, system_id) # Authenticate the system certificate. We need the user record # to generate the tokens self.load_user = 1 server = self.auth_system('login', system_id) # log the entry log_debug(1, self.server_id) # Update the capabilities list rhnCapability.update_client_capabilities(self.server_id) # Fetch the channels this client is subscribed to channelList = rhnChannel.channels_for_server(self.server_id) channels = [] for each in channelList: if not each.has_key('last_modified'): # No last_modified attribute # Probably an empty channel, so ignore continue channel = [each['label'], each['last_modified']] # isBaseChannel if each['parent_channel']: flag = "0" else: flag = "1" channel.append(flag) # isLocalChannel if each['local_channel']: flag = "1" else: flag = "0" channel.append(flag) channels.append(channel) rhnServerTime = str(time.time()) expireOffset = str(CFG.CLIENT_AUTH_TIMEOUT) signature = computeSignature(CFG.SECRET_KEY, self.server_id, self.user, rhnServerTime, expireOffset) loginDict = { 'X-RHN-Server-Id' : self.server_id, 'X-RHN-Auth-User-Id' : self.user, 'X-RHN-Auth' : signature, 'X-RHN-Auth-Server-Time' : rhnServerTime, 'X-RHN-Auth-Expire-Offset' : expireOffset, # List of lists [[label,last_mod],...]: 'X-RHN-Auth-Channels' : channels } # Duplicate these values in the headers so that the proxy can # intercept and cache them without parseing the xmlrpc. transport = rhnFlags.get('outputTransportOptions') for k, v in loginDict.items(): # Special case for channels if string.lower(k) == string.lower('X-RHN-Auth-Channels'): # Concatenate the channel information column-separated transport[k] = map(lambda x: string.join(x, ':'), v) else: transport[k] = v log_debug(5, "loginDict", loginDict, transport) # store route in DB (schema for RHN 3.1+ only!) server_route.store_client_route(self.server_id) return loginDict