• Home
  • Raw
  • Download

Lines Matching full:user

31 def get_user_hash(user):  argument
32 """Get the user hash for the given user."""
34 '--user=%s' % user])
37 def user_path(user): argument
38 """Get the user mount point for the given user."""
39 return utils.system_output(['cryptohome-path', 'user', user])
42 def system_path(user): argument
43 """Get the system mount point for the given user."""
44 return utils.system_output(['cryptohome-path', 'system', user])
47 def temporary_mount_path(user): argument
48 """Get the vault mount path used during crypto-migration for the user.
50 @param user: user the temporary mount should be for
52 return TEMP_MOUNT_PATTERN % (get_user_hash(user))
55 def vault_path(user): argument
56 """ Get the vault path for the given user.
58 @param user: The user who's vault path should be returned.
60 return VAULT_PATH_PATTERN % (get_user_hash(user))
63 def ensure_clean_cryptohome_for(user, password=None): argument
64 """Ensure a fresh cryptohome exists for user.
66 @param user: user who needs a shiny new cryptohome.
71 unmount_vault(user)
72 remove_vault(user)
73 mount_vault(user, password, create=True)
267 def remove_vault(user): argument
268 """Remove the given user's vault from the shadow directory."""
269 logging.debug('user is %s', user)
270 user_hash = get_user_hash(user)
271 logging.debug('Removing vault for user %s with hash %s', user, user_hash)
272 cmd = CRYPTOHOME_CMD + ' --action=remove --force --user=%s' % user
276 raise ChromiumOSError('Cryptohome could not remove the user\'s vault.')
287 logging.debug('Removing vault for user with hash %s', item)
291 def mount_vault(user, password, create=False, key_label=None): argument
292 """Mount the given user's vault. Mounts should be created by calling this
297 args = [CRYPTOHOME_CMD, '--action=mount_ex', '--user=%s' % user,
307 user_hash = get_user_hash(user)
315 # TODO: Remove this additional call to get_user_hash(user) when
317 user_hash = get_user_hash(user)
324 if not is_permanent_vault_mounted(user=user, allow_fail=True):
337 def test_auth(user, password): argument
338 cmd = [CRYPTOHOME_CMD, '--action=check_key_ex', '--user=%s' % user,
345 def add_le_key(user, password, new_password, new_key_label): argument
347 '--user=%s' % user, '--password=%s' % password,
353 def remove_key(user, password, remove_key_label): argument
354 args = [CRYPTOHOME_CMD, '--action=remove_key_ex', '--user=%s' % user,
372 def unmount_vault(user=None): argument
373 """Unmount the given user's vault.
375 Once unmounting for a specific user is supported, the user parameter will
376 name the target user. See crosbug.com/20778.
380 if user is not None and is_vault_mounted(user, allow_fail=True):
381 raise ChromiumOSError('Cryptohome did not unmount the user.')
401 def __get_user_mount_info(user, allow_fail=False): argument
402 """Get information about the active mounts for a given user.
404 Returns the active mounts at the user's user and system mount points. If no
405 user is given, the active mount at the shared mount point is returned
407 compatibility; the guest user has a mount at this mount point only).
409 return [__get_mount_info(mount_point=user_path(user),
411 __get_mount_info(mount_point=system_path(user),
414 def is_vault_mounted(user, regexes=None, allow_fail=False): argument
415 """Check whether a vault is mounted for the given user.
417 user: If no user is given, the shared mount point is checked, determining
418 whether a vault is mounted for any user.
420 The mount filesystem for the user's user and system mounts point must
431 user_mount_info = __get_user_mount_info(user=user, allow_fail=allow_fail)
434 # user user/system mount (/home/user/.... /home/root/...)
474 """Check whether a vault is mounted for the guest user.
479 user=GUEST_USER_NAME,
490 def is_permanent_vault_mounted(user, allow_fail=False): argument
491 """Check if user is mounted over ecryptfs or ext4 crypto. """
493 user=user,
502 def get_mounted_vault_path(user, allow_fail=False): argument
503 """Get the path where the decrypted data for the user is located."""
504 return os.path.join(constants.SHADOW_ROOT, get_user_hash(user), 'mount')
548 def create_ecryptfs_homedir(user, password): argument
551 If a home directory for the user exists already, it will be removed.
554 @param user: Username to create the home directory for.
557 unmount_vault(user)
558 remove_vault(user)
562 '--user=%s' % user,
568 if not is_vault_mounted(user, regexes={
575 def do_dircrypto_migration(user, password, timeout=600): argument
576 """Start dircrypto migration for the user.
578 @param user: The user to migrate.
583 unmount_vault(user)
588 '--user=%s' % user,
591 if not __get_mount_info(temporary_mount_path(user), allow_fail=True):
593 args = [CRYPTOHOME_CMD, '--action=migrate_to_dircrypto', '--user=%s' % user]
597 temporary_mount_path(user), allow_fail=True),
603 def change_password(user, password, new_password): argument
607 '--user=%s' % user,
708 def mount(self, user, password, create=False, async=True, key_label='bar'): argument
716 acc.account_id = user
733 def unmount(self, user): argument
748 def is_mounted(self, user): argument
749 """Tests whether a user's cryptohome is mounted."""
750 return (utils.is_mountpoint(user_path(user))
751 and utils.is_mountpoint(system_path(user)))
754 def require_mounted(self, user): argument
755 """Raises a test failure if a user's cryptohome is not mounted."""
756 utils.require_mountpoint(user_path(user))
757 utils.require_mountpoint(system_path(user))
760 def remove(self, user, async=True): argument
768 acc.account_id = user
776 def ensure_clean_cryptohome_for(self, user, password=None): argument
777 """Ensure a fresh cryptohome exists for user.
779 @param user: user who needs a shiny new cryptohome.
784 self.remove(user)
785 self.mount(user, password, create=True)