Esempio n. 1
0
 def get_proxy_rights(self, protocols, target_device=None):
     if self.rights:
         return
     self.rights = [
         TargetConf().config_rights[r]
         for r in TargetConf().config_users[self.wab_login]['rights']
     ]
     return self.rights
Esempio n. 2
0
 def x509_authenticate(self):
     print('x509_authenticate(%s)' % self.wab_login)
     try:
         if TargetConf().config_users[self.wab_login]['x509_authenticate']:
             self.user.preferredLanguage = TargetConf().config_users[
                 self.wab_login][u'preferredLanguage']
             return True
         return False
     except:
         self.wab_login = None
     return False
Esempio n. 3
0
 def get_app_params(self, selected_target, effective_target):
     service_login = selected_target.service_login
     res = None
     #        Logger().info("get_app_params %s" % service_login)
     try:
         for key, value in TargetConf().config_effective_targets.items():
             #                Logger().info('key=%s value=%s' % (key, value))
             if value is effective_target:
                 res = TargetConf().config_app_params[service_login][key]
     except Exception, e:
         import traceback
         Logger().info("%s" % traceback.format_exc(e))
Esempio n. 4
0
 def passthrough_authenticate(self, wab_login, ip_client, server_ip):
     print('passthrough_authenticate(%s %s)' % (wab_login, ip_client))
     try:
         if TargetConf().config_users[
                 self.wab_login]['passthrough_authenticate']:
             self.user.preferredLanguage = TargetConf().config_users[
                 self.wab_login][u'preferredLanguage']
             return True
         return False
     except:
         self.wab_login = None
     return False
Esempio n. 5
0
    def challenge_manage(self, wab_login, password):
        res = False
        if not self.challenge:
            res = TargetConf().config_users[wab_login]['password'] == password
            if res:
                self.challenge = ChallengeInfo(
                    """When Littlefoot's Mother died in the original
'Land Before Time', did you feel sad ?
(Bots: No lying)""", False)
                res = False
        else:
            res = TargetConf().config_users[wab_login]['response'] == password
            self.challenge = None
        return res
Esempio n. 6
0
    def get_effective_target(self, selected_target):
        service_login = selected_target.service_login
        Logger().info("Effective_target %s" % service_login)
        try:
            if selected_target.resource.application:
                res = [
                    TargetConf().config_effective_targets[r] for r in
                    TargetConf().config_service_logins[service_login]['rights']
                ]
                Logger().info("Engine get_effective_target done (application)")
                return effective_target
            else:
                Logger().info("Engine get_effective_target done (physical)")
                return [selected_target]

        except Exception, e:
            import traceback
            Logger().info("%s" % traceback.format_exc(e))
Esempio n. 7
0
 def password_authenticate(self, wab_login, ip_client, password, server_ip):
     print('password_authenticate(%s %s %s)' %
           (wab_login, ip_client, password))
     res = False
     try:
         # print ('::::: %s' % (TargetConf().config_users[wab_login]))
         if wab_login == 'challenge':
             res = self.challenge_manage(wab_login, password)
         else:
             res = TargetConf(
             ).config_users[wab_login]['password'] == password
         if res:
             Logger().info("password authenticated Succeed for %s" %
                           wab_login)
             self.wab_login = wab_login
             self.user.preferredLanguage = TargetConf(
             ).config_users[wab_login][u'preferredLanguage']
     except:
         pass
     return res
Esempio n. 8
0
 def is_x509_connected(self, wab_login, ip_client, proxy_type, target,
                       server_ip):
     """
     Ask if we are authentifying using x509
     (and ask user by opening confirmation popup if we are,
     session ticket will be asked later in x509_authenticate)
     """
     print('is_x509_connected(%s %s %s %s)' %
           (wab_login, ip_client, proxy_type, target))
     res = False
     try:
         res = TargetConf().config_users[wab_login]['is_x509_connected']
         if res:
             self.wab_login = wab_login
     except:
         pass
     return res
Esempio n. 9
0
 def get_target_password(self, target_device):
     res = None
     Logger().info("get_target_password ...")
     Logger().info("account =%s" % target_device.account.login)
     Logger().info("resource=%s" % target_device.resource.device.cn)
     Logger().info("protocol=%s" %
                   target_device.resource.service.protocol.cn)
     try:
         for p in TargetConf().config_target_password:
             if (p.account == target_device.account.login
                     and p.resource == target_device.resource.device.cn
                     and p.protocol
                     == target_device.resource.service.protocol.cn):
                 res = p.password
     except Exception, e:
         import traceback
         Logger().info("%s" % traceback.format_exc(e))