Auth Methods, Entities and Groups
Auth Methods
Section titled “Auth Methods”- These are vault components that perform authentication and manages identities.
- Responsible for assigning identity and policies to a user.
- Multiple auth methods can be enables based on use case.
- Tokens are the core method of authentication within vault
- Most operations in vault require an existing token
- Token auth method is responsible for creating and storing tokens
Auth Methods Workflow
Section titled “Auth Methods Workflow”- User authenticates with credentials
- Validate credentials against provider (auth provider, could be OIDC, LDAP …)
- Generate vault token and attach policy or policies and a TTL
- Supply token to user
- User then uses that token for doing operations in vault
There are a lot of auth methods, see them at docs at 🌐
Configuring Auth Methods
Section titled “Configuring Auth Methods”| COMMAND | EFFECT |
|---|---|
vault auth enable -path=AUTH_METHOD_PATH -description="DESCRIPTION" AUTH_METHOD | Enable auth method at path, default path picked if path not supplied |
vault auth disable AUTH_METHOD_PATH | Disable auth method |
vault auth list | List auth methods |
vault write auth/AUTH_METHOD_PATH/OPTIONS PARAMETERS | Configure auth method |
vault auth tune AUTH_METHOD_PATH PARAMETERS | Modify vault auth method |
Vault Entities
Section titled “Vault Entities”-
Vault creates an entity every time a user logs in and attaches an alias to it if a corresponding entiry doesn’t already exist. The alias is combination of auth method and username or user ID
-
An entity is a representation of a single person or system used to log into the vault. Each has unique value, each entity is made of
zeroor more aliases. -
Aliasis a combination of auth method plus some identification. It is a mapping between an entity and auth method(s). -
This is done using the Identity secrets engine, which manages internal identities that are recognized by vault. Identity secrets engine is default enabled and can’t be disabled, another instance of identity secrets engine also can’t be created.
-
Operators explicitly create and manage entities; Vault does not automatically sync identity information from external sources.
-
An entity can be created manually to map multiple entities for a single user to provide more efficient authorization management.
-
Any tokens created for the entity inherit the capabilities that are granted by alias(es).
-
This manually created entity has aliases to other entities that are required for inherited properties.
-
Policies get combined or we can say united from the particular alias and the current manual entity.
Managing Entities
Section titled “Managing Entities”List Entities (Only IDs):
vault list identity/entity/idRead Entity Details:
vault read identity/entity/id/ENTITY_IDRead Entity ID using Name:
vault read -field=id identity/entity/name/ENTITY_NAMECreate Entity:
vault write identity/entity name="ENTITY_NAME" policies="POLICIES" metadata=METADATAUpdate Entity(Name, Metadata, Policies):
vault write identity/entity/id/ENTITY_ID name="NEW_NAME" metadata=METADATA policies="POLICIES"Delete Entity:
vault delete identity/entity/id/ENTITY_IDCreate Alias in Entity:
ENTITY_ID=$(vault read -field=id identity/entity/name/ENTITY_NAME)USERPASS_ACCESSOR=$(vault auth list -format=json | jq -r '.[\"AUTH_METHOD_MOUNT_PATH/\"].accessor')vault write identity/entity-alias name="ALIAS_NAME" canonical_id="$ENTITY_ID" mount_accessor="$USERPASS_ACCESSOR"Delete Alias in Entity:
vault delete identity/entity-alias/id/ALIAS_IDVault Groups
Section titled “Vault Groups”- A group contains multiple entities as its members
- A group can also have subgroups
- Policies can be set to group and the permissions will be granted to all members of the group
Internal Groups
- Used to easily manage permissions for entities
- Frequently used when using vault namespaces to propagate permissions down to child namespaces
- Helpful when the admin do not want to configure an identical auth method on every single namespace External Groups
- Used to set permissions based on group members from an external identity provider. Such as Okta, OIDC, …
- Allows admin to set up once and continue manage permissions and users in the identity provider instead of vault.
Managing Groups
Section titled “Managing Groups”Create Group:
vault write identity/group name="NAME" type="internal" policies="POLICIES" member_entity_ids="ENTITY_IDS" metadata=METADATAList Groups:
vault list identity/group/idRead Group Details:
vault read identity/group/id/GROUP_IDUpdate Group:
vault write identity/group/id/GROUP_ID policies="POLICIES" member_entity_ids="ENTITY_IDS" metadata=METADATADelete a Group:
vault delete identity/group/id/GROUP_IDAdd Members to Group:
CURRENT_MEMBERS=$(vault read -field=member_entity_ids identity/group/id/GROUP_ID)NEW_MEMBERS="NEW_ENTITY_IDS"UPDATED_MEMBERS="$CURRENT_MEMBERS,$NEW_MEMBERS"vault write identity/group/id/GROUP_ID member_entity_ids="$UPDATED_MEMBERS"Remove Members from Group:
CURRENT_MEMBERS=$(vault read -field=member_entity_ids identity/group/id/GROUP_ID)# Remove members from the list in CURRENT_MEMBERS using shell/text tools, then update:UPDATED_MEMBERS="LIST_OF_REMAINING_MEMBERS_AFTER_REMOVAL"vault write identity/group/id/GROUP_ID member_entity_ids="$UPDATED_MEMBERS"Add Member Groups to Group:
CURRENT_MEMBERS=$(vault read -field=member_group_ids identity/group/id/GROUP_ID)UPDATED_MEMBERS="$CURRENT_MEMBERS,NEW_SUBGROUP_ID"vault write identity/group/id/GROUP_ID member_group_ids="$UPDATED_MEMBERS"Remove Member Groups from Group:
CURRENT_MEMBERS=$(vault read -field=member_group_ids identity/group/id/GROUP_ID)# Remove subgroups in CURRENT_MEMBERS, then update:UPDATED_MEMBERS="LIST_OF_REMAINING_SUBGROUPS_AFTER_REMOVAL"vault write identity/group/id/GROUP_ID member_group_ids="$UPDATED_MEMBERS"