certwrangler.stores.vault module#
- class certwrangler.stores.vault.BaseAuth[source]#
Bases:
BaseModelBase vault auth class.
- abstractmethod login(client: Client) None[source]#
This should be overridden by subclasses to provide the login logic.
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certwrangler.stores.vault.AppRoleAuth(*, method: Literal['approle'], mount_point: str | None = None, role_id: str, secret_id: str)[source]#
Bases:
BaseAuthAppRole auth class.
- method: Literal['approle']#
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certwrangler.stores.vault.KubernetesAuth(*, method: Literal['kubernetes'], mount_point: str | None = None, role: str, token_path: str = '/var/run/secrets/kubernetes.io/serviceaccount/token')[source]#
Bases:
BaseAuthKubernetes auth class.
- method: Literal['kubernetes']#
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certwrangler.stores.vault.TokenAuth(*, method: Literal['token'], token: str)[source]#
Bases:
BaseAuthToken auth class.
- method: Literal['token']#
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certwrangler.stores.vault.VaultStore(*, driver: Literal['vault'], server: HttpUrl, ca_cert: Path | None = None, mount_point: str, path: Path, version: Literal[1, 2] = 2, auth: AppRoleAuth | TokenAuth | KubernetesAuth)[source]#
Bases:
StoreVault storage driver.
- driver: Literal['vault']#
- server: HttpUrl#
- path: Path#
- version: Literal[1, 2]#
- auth: AppRoleAuth | TokenAuth | KubernetesAuth#
- property client: Client#
- initialize() None[source]#
hvac will try to read the token from an $VAULT_TOKEN or ~/.vault_token. This explicitly clears out the token to ensure we read from config.
- publish(cert: Cert) None[source]#
Publish the cert to the configured location in vault.
- Raises:
StoreError – Raised on authentication failures or failures reading or writing to vault.
- _read_v1(path: Path) Dict[str, str][source]#
Read the contents of a secret from a v1 vault endpoint.
- _write_v1(path: Path, secret: Dict[str, str]) None[source]#
Write the contents of a secret to a v1 vault endpoint.
- _read_v2(path: Path) Dict[str, str][source]#
Read the contents of a secret from a v2 vault endpoint.
- _write_v2(path: Path, secret: Dict[str, str]) None[source]#
Write the contents of a secret to a v1 vault endpoint.
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].