def get_coa_client(self, nasaddr): cli = self.coa_clients.get(nasaddr) if not cli: bas = self.store.get_bas(nasaddr) if bas: cli = CoAClient(bas, dictionary.Dictionary(self.dictfile), debug=self.debug) self.coa_clients[nasaddr] = cli return cli
def reload_coa_clients(self): for bas in self.store.list_bas(): if bas['ip_addr'] in self.coa_clients: self.coa_clients[bas['ip_addr']].close() self.coa_clients[bas['ip_addr']] = CoAClient(bas, dictionary.Dictionary( self.dictfile), debug=self.debug)
def __init__(self, radiusd): _dict = dictionary.Dictionary(radiusd.dictfile) host.Host.__init__(self, dict=_dict) self.debug = radiusd.debug self.user_trace = radiusd.trace self.midware = radiusd.midware self.runstat = radiusd.runstat self.coa_clients = radiusd.coa_clients self.store = radiusd.store self.auth_delay = utils.AuthDelay( int(self.store.get_param("reject_delay") or 0))
def __init__(self, config): auth_port = config.getint('radiusd', 'authport') acct_port = config.getint('radiusd', 'acctport') rad_addr = '127.0.0.1' if config.has_option('radiusd', 'host'): rad_addr = config.getint('radiusd', 'host') dictfile = os.path.join( os.path.split(utils.__file__)[0], 'dicts/dictionary') _dict = dictionary.Dictionary(dictfile) secret = six.b('radtest') self.debug = config.getboolean('DEFAULT', 'debug') self.radcli = Client(rad_addr, auth_port, acct_port, secret, _dict) self.radius_sessions = {} self.user_sessions = {}
def init_protocol(self): # rundata self.trace = utils.UserTrace() self.runstat = utils.RunStat() self.midware = middleware.Middleware() # init coa clients self.coa_clients = {} for bas in self.store.list_bas(): self.coa_clients[bas['ip_addr']] = CoAClient(bas, dictionary.Dictionary( self.dictfile), debug=self.debug) self.auth_protocol = RADIUSAccess(self) self.acct_protocol = RADIUSAccounting(self) ws_url = "ws://%s:%s" % (self.radiusd_host, self.adminport) if self.use_ssl: ws_url = "wss://%s:%s" % (self.radiusd_host, self.adminport) self.admin_factory = WebSocketServerFactory(ws_url, debug=False) self.admin_factory.protocol = AdminServerProtocol self.admin_factory.setProtocolOptions(allowHixie76=True) self.admin_factory.protocol.radiusd = self
def __init__(self, dictfile=None, timeout=5, retry=5, debug=True): self.dict = dictionary.Dictionary(dictfile) self.timeout = timeout self.retry = retry self.debug = debug self.port = reactor.listenUDP(0, self)