Beispiel #1
0
    def __init__(self, sambacreds, username, domain, is_machine):
        self.cache_path = '/var/cache/gpupdate/creds/krb5cc_{}'.format(
            os.getpid())
        self.__kinit_successful = machine_kinit(self.cache_path)
        self.storage = registry_factory('registry')
        self.storage.set_info('domain', domain)
        machine_name = get_machine_name()
        machine_sid = get_sid(domain, machine_name, is_machine)
        self.storage.set_info('machine_name', machine_name)
        self.storage.set_info('machine_sid', machine_sid)

        # User SID to work with HKCU hive
        self.username = username
        self._is_machine_username = is_machine
        if is_machine:
            self.sid = machine_sid
        else:
            self.sid = get_sid(self.storage.get_info('domain'), self.username)

        self.cache = cache_factory('regpol_cache')
        self.gpo_names = cache_factory('gpo_names')

        # Samba objects - LoadParm() and CredentialsOptions()
        self.sambacreds = sambacreds

        self.cache_dir = self.sambacreds.get_cache_dir()
        logdata = dict({'cachedir': self.cache_dir})
        log('D7', logdata)
    def __init__(self):
        self.storage = registry_factory('registry')
        self.storage.set_info('domain', domain)
        self.storage.set_info('machine_name', get_machine_name())
        self.storage.set_info('machine_sid', get_sid(domain, self.storage.get_info('machine_name')))

        # User SID to work with HKCU hive
        self.username = username
        self.sid = get_sid(self.storage.get_info('domain'), self.username)
    def __init__(self, sambacreds, username, domain):
        self.storage = registry_factory('registry')
        self.storage.set_info('domain', domain)
        self.storage.set_info('machine_name', get_machine_name())
        self.storage.set_info(
            'machine_sid',
            get_sid(domain, self.storage.get_info('machine_name')))

        # User SID to work with HKCU hive
        self.username = username
        self._is_machine_username = is_machine_name(self.username)
        self.sid = get_sid(self.storage.get_info('domain'), self.username)

        self.cache = cache_factory('regpol_cache')
        self.gpo_names = cache_factory('gpo_names')

        # Samba objects - LoadParm() and CredentialsOptions()
        self.sambacreds = sambacreds

        self.cache_dir = self.sambacreds.get_cache_dir()
        logging.debug(slogm('Cache directory is: {}'.format(self.cache_dir)))
Beispiel #4
0
    def __init__(self):
        domain = None
        machine_name = get_machine_name()
        machine_sid = get_sid(domain, machine_name, True)
        self.storage = registry_factory('registry')
        self.storage.set_info('domain', domain)
        self.storage.set_info('machine_name', machine_name)
        self.storage.set_info('machine_sid', machine_sid)

        # User SID to work with HKCU hive
        self.username = machine_name
        self.sid = machine_sid
Beispiel #5
0
    def __init__(self, username, is_machine):
        self.storage = registry_factory('registry')
        self.username = determine_username(username)
        self.is_machine = is_machine
        self.process_uname = get_process_user()
        self.sid = get_sid(self.storage.get_info('domain'), self.username,
                           is_machine)

        self.machine_appliers = dict({
            'control':
            control_applier(self.storage),
            'polkit':
            polkit_applier(self.storage),
            'systemd':
            systemd_applier(self.storage),
            'firefox':
            firefox_applier(self.storage, self.sid, self.username),
            'chromium':
            chromium_applier(self.storage, self.sid, self.username),
            'shortcuts':
            shortcut_applier(self.storage),
            'gsettings':
            gsettings_applier(self.storage),
            'cups':
            cups_applier(self.storage),
            'package':
            package_applier(self.storage)
        })

        # User appliers are expected to work with user-writable
        # files and settings, mostly in $HOME.
        self.user_appliers = dict({
            'shortcuts':
            shortcut_applier_user(self.storage, self.sid, self.username),
            'gsettings':
            gsettings_applier_user(self.storage, self.sid, self.username),
            'cifs':
            cifs_applier_user(self.storage, self.sid, self.username)
        })
Beispiel #6
0
    def __init__(self, username, is_machine):
        self.storage = registry_factory('registry')
        self.username = determine_username(username)
        self.is_machine = is_machine
        self.process_uname = get_process_user()
        self.sid = get_sid(self.storage.get_info('domain'), self.username, is_machine)

        self.machine_appliers = dict()
        self.machine_appliers['control'] = control_applier(self.storage)
        self.machine_appliers['polkit'] = polkit_applier(self.storage)
        self.machine_appliers['systemd'] = systemd_applier(self.storage)
        self.machine_appliers['firefox'] = firefox_applier(self.storage, self.sid, self.username)
        self.machine_appliers['chromium'] = chromium_applier(self.storage, self.sid, self.username)
        self.machine_appliers['shortcuts'] = shortcut_applier(self.storage)
        self.machine_appliers['gsettings'] = gsettings_applier(self.storage)
        self.machine_appliers['cups'] = cups_applier(self.storage)
        self.machine_appliers['firewall'] = firewall_applier(self.storage)
        self.machine_appliers['folders'] = folder_applier(self.storage, self.sid)
        self.machine_appliers['package'] = package_applier(self.storage)
        self.machine_appliers['ntp'] = ntp_applier(self.storage)
        self.machine_appliers['envvar'] = envvar_applier(self.storage, self.sid)

        # User appliers are expected to work with user-writable
        # files and settings, mostly in $HOME.
        self.user_appliers = dict()
        self.user_appliers['shortcuts'] = shortcut_applier_user(self.storage, self.sid, self.username)
        self.user_appliers['folders'] = folder_applier_user(self.storage, self.sid, self.username)
        self.user_appliers['gsettings'] = gsettings_applier_user(self.storage, self.sid, self.username)
        try:
            self.user_appliers['cifs'] = cifs_applier_user(self.storage, self.sid, self.username)
        except Exception as exc:
            logdata = dict()
            logdata['applier_name'] = 'cifs'
            logdata['msg'] = str(exc)
            log('E25', logdata)
        self.user_appliers['package'] = package_applier_user(self.storage, self.sid, self.username)
        self.user_appliers['polkit'] = polkit_applier_user(self.storage, self.sid, self.username)
        self.user_appliers['envvar'] = envvar_applier_user(self.storage, self.sid, self.username)