Lines Matching full:user

41 def get_user_hash(user):  argument
42 """Get the user hash for the given user."""
44 '--user=%s' % user])
47 def user_path(user): argument
48 """Get the user mount point for the given user."""
49 return utils.system_output(['cryptohome-path', 'user', user])
52 def system_path(user): argument
53 """Get the system mount point for the given user."""
54 return utils.system_output(['cryptohome-path', 'system', user])
57 def temporary_mount_path(user): argument
58 """Get the vault mount path used during crypto-migration for the user.
60 @param user: user the temporary mount should be for
62 return TEMP_MOUNT_PATTERN % (get_user_hash(user))
65 def vault_path(user): argument
66 """ Get the vault path for the given user.
68 @param user: The user who's vault path should be returned.
70 return VAULT_PATH_PATTERN % (get_user_hash(user))
73 def ensure_clean_cryptohome_for(user, password=None): argument
74 """Ensure a fresh cryptohome exists for user.
76 @param user: user who needs a shiny new cryptohome.
81 unmount_vault(user)
82 remove_vault(user)
83 mount_vault(user, password, create=True)
294 def remove_vault(user): argument
295 """Remove the given user's vault from the shadow directory."""
296 logging.debug('user is %s', user)
297 user_hash = get_user_hash(user)
298 logging.debug('Removing vault for user %s with hash %s', user, user_hash)
299 cmd = CRYPTOHOME_CMD + ' --action=remove --force --user=%s' % user
303 raise ChromiumOSError('Cryptohome could not remove the user\'s vault.')
314 logging.debug('Removing vault for user with hash %s', item)
318 def mount_vault(user, password, create=False, key_label=None): argument
319 """Mount the given user's vault. Mounts should be created by calling this
324 args = [CRYPTOHOME_CMD, '--action=mount_ex', '--user=%s' % user,
334 user_hash = get_user_hash(user)
342 # TODO: Remove this additional call to get_user_hash(user) when
344 user_hash = get_user_hash(user)
351 if not is_permanent_vault_mounted(user=user, allow_fail=True):
364 def test_auth(user, password): argument
366 cmd = [CRYPTOHOME_CMD, '--action=check_key_ex', '--user=%s' % user,
373 def add_le_key(user, password, new_password, new_key_label): argument
376 '--user=%s' % user, '--password=%s' % password,
382 def remove_key(user, password, remove_key_label): argument
384 args = [CRYPTOHOME_CMD, '--action=remove_key_ex', '--user=%s' % user,
403 def unmount_vault(user=None): argument
404 """Unmount the given user's vault.
406 Once unmounting for a specific user is supported, the user parameter will
407 name the target user. See crosbug.com/20778.
411 if user is not None and is_vault_mounted(user, allow_fail=True):
412 raise ChromiumOSError('Cryptohome did not unmount the user.')
454 def __get_user_mount_info(user, allow_fail=False): argument
455 """Get information about the active mounts for a given user.
457 Returns the active mounts at the user's user and system mount points. If no
458 user is given, the active mount at the shared mount point is returned
460 compatibility; the guest user has a mount at this mount point only).
462 return [__get_mount_info(mount_point=user_path(user),
464 __get_mount_info(mount_point=system_path(user),
467 def is_vault_mounted(user, regexes=None, allow_fail=False): argument
468 """Check whether a vault is mounted for the given user.
470 user: If no user is given, the shared mount point is checked, determining
471 whether a vault is mounted for any user.
473 The mount filesystem for the user's user and system mounts point must
484 user_mount_info = __get_user_mount_info(user=user, allow_fail=allow_fail)
487 # user user/system mount (/home/user/.... /home/root/...)
512 """Check whether a vault is mounted for the guest user.
517 user=GUEST_USER_NAME,
528 def is_permanent_vault_mounted(user, allow_fail=False): argument
529 """Check if user is mounted over ecryptfs or ext4 crypto. """
531 user=user,
540 def get_mounted_vault_path(user, allow_fail=False): argument
541 """Get the path where the decrypted data for the user is located."""
542 return os.path.join(constants.SHADOW_ROOT, get_user_hash(user), 'mount')
587 def create_ecryptfs_homedir(user, password): argument
590 If a home directory for the user exists already, it will be removed.
593 @param user: Username to create the home directory for.
596 unmount_vault(user)
597 remove_vault(user)
601 '--user=%s' % user,
607 if not is_vault_mounted(user, regexes={
614 def do_dircrypto_migration(user, password, timeout=600): argument
615 """Start dircrypto migration for the user.
617 @param user: The user to migrate.
622 unmount_vault(user)
627 '--user=%s' % user,
630 if not __get_mount_info(temporary_mount_path(user), allow_fail=True):
632 args = [CRYPTOHOME_CMD, '--action=migrate_to_dircrypto', '--user=%s' % user]
636 temporary_mount_path(user), allow_fail=True),
642 def change_password(user, password, new_password): argument
643 """Change user password."""
647 '--user=%s' % user,
748 def mount(self, user, password, create=False, key_label='bar'): argument
756 acc.account_id = user
773 def unmount(self, user): argument
788 def is_mounted(self, user): argument
789 """Tests whether a user's cryptohome is mounted."""
790 return (utils.is_mountpoint(user_path(user))
791 and utils.is_mountpoint(system_path(user)))
794 def require_mounted(self, user): argument
795 """Raises a test failure if a user's cryptohome is not mounted."""
796 utils.require_mountpoint(user_path(user))
797 utils.require_mountpoint(system_path(user))
800 def remove(self, user): argument
808 acc.account_id = user
816 def ensure_clean_cryptohome_for(self, user, password=None): argument
817 """Ensure a fresh cryptohome exists for user.
819 @param user: user who needs a shiny new cryptohome.
824 self.remove(user)
825 self.mount(user, password, create=True)