def init(self, core): # Get max duration minutes = core.config.getint('CORE', 'max_session_duration') self.max_session_duration = timedelta(minutes=minutes) # Get the directory vardir = core.config.get('CORE', 'vardir') self.path = path_join(vardir, "sessions") mkdirNew(self.path) # Register the manager core.session_manager = self self.core = core # cookie => Session object self.sessions = {} # Remove old sessions each minute self.cleanup_task = scheduleRepeat(60, self.cleanup)
def __init__(self, core, type="tmp"): self.core = core self.vardir = self.core.config.get('CORE','vardir') self.files_path_tmp = path_join(self.vardir,FILES_GLOBAL,"tmp") self.files_path_resident = path_join(self.vardir,FILES_GLOBAL,"resident") mkdirNew(self.files_path_tmp) mkdirNew(self.files_path_resident) self.user_files_path_tmp = path_join(self.vardir,FILES_USER,"tmp") self.user_files_path_resident = path_join(self.vardir,FILES_USER,"resident") mkdirNew(self.user_files_path_tmp) mkdirNew(self.user_files_path_resident) self.type = type
def __init__(self, root_path, address, port, interface, key_file = None, cert_file = None, cacert_file = None, netmask=None): Logger.__init__(self, 'openvpn') self.root_path = root_path self.key_file = key_file self.cert_file = cert_file self.cacert_file = cacert_file self.DH1024_FILE = os.path.join(self.root_path, 'dh1024.pem') self.PID_FILE = os.path.join(self.root_path, 'openvpn.pid') self.CONFIG_FILE = os.path.join(self.root_path, 'openvpn.conf') if key_file is None: self.key_file = os.path.join(self.root_path, 'key.pem') if cert_file is None: self.cert_file = os.path.join(self.root_path, 'cert.pem') if cacert_file is None: self.cacert_file = os.path.join(self.root_path, 'cacert.pem') self.address = address self.port = port self.interface = interface if netmask: assert isinstance(netmask, IP) assert netmask.version() == 4 assert netmask.prefixlen() < 32 self.network = str(netmask.net()) self.netmask = str(netmask.netmask()) else: self.network = '' self.netmask = '' try: mkdirNew(self.root_path) except OSError: raise RpcdError('Unable to create directory: %s', self.root_path)