예제 #1
0
	def ProcessAuthPacket(self, pkt):
		# decrypt crypted attributes
		pkt.decryptAttributes()
		#debug (pkt)
		
		received = dict(pkt) # don't use packet instance any more
		check = {'Auth-Type': [None]}
		reply = {}
		
		debug (misc.authPacketToStr(received))
		
		# wait for authorization modules to process the request
		authzModulesResult = modules.execAuthorizationModules(received, check, reply)
		if authzModulesResult == modules.MODULE_OK:
			# execute authentication modules
			authcModulesResult = modules.execAuthenticationModules(received, check, reply)
			if authcModulesResult == modules.MODULE_OK:
				info ('===\n')
				info ('Authorization and authentication successful')
				return (True, reply)
			else:
				info ('===\n')
				info ('Authentication phase failed')
				if authcModulesResult == modules.MODULE_FAILED:
					dumpPacket.dumpFailedAuthPacket(received)
				return (False, reply)
		else:
			info ('===\n')
			info ('Authorization phase failed')
			if authzModulesResult == modules.MODULE_FAILED:
				dumpPacket.dumpFailedAuthPacket(received)
			return (False, reply)
예제 #2
0
    def ProcessAuthPacket(self, pkt):
        # decrypt crypted attributes
        pkt.decryptAttributes()
        #debug (pkt)

        received = dict(pkt)  # don't use packet instance any more
        check = {'Auth-Type': [None]}
        reply = {}

        debug(misc.authPacketToStr(received))

        # wait for authorization modules to process the request
        authzModulesResult = modules.execAuthorizationModules(
            received, check, reply)
        if authzModulesResult == modules.MODULE_OK:
            # execute authentication modules
            authcModulesResult = modules.execAuthenticationModules(
                received, check, reply)
            if authcModulesResult == modules.MODULE_OK:
                info('===\n')
                info('Authorization and authentication successful')
                return (True, reply)
            else:
                info('===\n')
                info('Authentication phase failed')
                if authcModulesResult == modules.MODULE_FAILED:
                    dumpPacket.dumpFailedAuthPacket(received)
                return (False, reply)
        else:
            info('===\n')
            info('Authorization phase failed')
            if authzModulesResult == modules.MODULE_FAILED:
                dumpPacket.dumpFailedAuthPacket(received)
            return (False, reply)
예제 #3
0
	def ProcessAuthPacket(self, pkt):
		# decrypt crypted attributes
		pkt.decryptAttributes()
		#debug (pkt)
		
		received = dict(pkt) # don't use packet instance any more
		check = {'Auth-Type': [None]}
		reply = {}
		
		debug (misc.authPacketToStr(received))
		
		# wait for authorization modules to process the request
		authzModulesResult = modules.execAuthorizationModules(received, check, reply)
		if authzModulesResult == modules.MODULE_OK:
			# execute authentication modules
			check['forward_reply_items'] = self.server.hosts[pkt.source[0]].forward_reply_items
			authcModulesResult = modules.execAuthenticationModules(received, check, reply)
			if authcModulesResult == modules.MODULE_OK:
				#info ('===\n')
				debug ('Authorization and authentication successful')
				return (True, reply)
			elif authcModulesResult == modules.MODULE_CHALLENGE:
				#info ('===\n')
				debug ('Authorization successful, authentication challenge')
				return (modules.MODULE_CHALLENGE, reply)
			elif authcModulesResult == modules.MODULE_INACTIVE:
				#info ('===\n')
				debug ('Authorization phase failed')
				#dumpPacket.dumpFailedAuthPacket(received)
				return (modules.MODULE_INACTIVE, reply)
			else:
				#info ('===\n')
				debug ('Authentication phase failed')
				if authcModulesResult == modules.MODULE_FAILED:
					dumpPacket.dumpFailedAuthPacket(received)
				return (False, reply)
		else:
			#info ('===\n')
			debug ('Authorization phase failed')
			if authzModulesResult == modules.MODULE_FAILED:
				dumpPacket.dumpFailedAuthPacket(received)
			return (False, reply)