Crates.io | vaultssh |
lib.rs | vaultssh |
version | 0.1.1 |
source | src |
created_at | 2021-09-11 05:59:36.189532 |
updated_at | 2021-09-14 03:55:19.253506 |
description | A small CLI wrapper for authenticating with SSH keys from Hashicorp Vault. |
homepage | |
repository | https://github.com/jmgilman/vssh |
max_upload_size | |
id | 449630 |
size | 509,032 |
A small CLI wrapper for authenticating with SSH keys from Hashicorp Vault
vaultssh is a small CLI wrapper for automatically fetching and using signed SSH certificates when remoting into a host. It wraps the ssh process and is therefore compatible with all standard ssh flags.
cargo install vaultssh
Or install using brew
:
brew tap jmgilman/homebrew-apps
brew install vaultssh
$> vssh --help
vaultssh 0.1.0
A small CLI wrapper for authenticating with SSH keys from Hashicorp Vault
USAGE:
vssh [FLAGS] [OPTIONS] <HOST> [ARGS]...
ARGS:
<HOST> ssh host
<ARGS>... additional arguments to pass to ssh
FLAGS:
-b, --basic disables terminal effects
-h, --help Print help information
-p, --persist persist acquired tokens to ~/.vault-token
-V, --version Print version information
OPTIONS:
-a, --auth-method <AUTH> default authentication method to use
--auth-mount <AUTH_MOUNT> default authentication mount to use
-c, --config <CONFIG> config file (default: $HOME/.vssh)
-i, --identity <IDENTITY> ssh key-pair to sign and use (default: $HOME/.ssh/id_rsa)
-m, --mount <MOUNT> mount path for ssh backend (default: ssh)
-r, --role <ROLE> vault role account to sign with (default: "default")
-s, --server <SERVER> address of vault server (default: $VAULT_ADDR)
-t, --token <TOKEN> vault token to use for authentication (default: $VAULT_TOKEN)
A configuration can be used by either creating it at ~/.vssh
or passing one in
using the CLI option. Configuration files are in TOML format. An example one is
shown below:
# Example config - place this in ~/.vssh to automatically use it
#
# The authentication names are the same as the default mount point for the
# associated engine. For example, "approle" for AppRole and "oidc" for OIDC.
# Not all engines are supported, only the ones shown below. You don't have to
# configure each one and may only configure the one you set to the default.
auth = "oidc" # default authentication method to use
auth_mount = "oidc" # default mount point for the authentication method
identity = "~/.ssh/id_rsa" # ssh key-pair to sign and use
mount = "ssh" # mount path for ssh backend
persist = true # persist acquired tokens to ~/.vault-token
role = "myrole" # vault role account to sign with
server = "https://vault:8200" # address of vault server
[approle] # name of auth method to configure
role_id = "myrole" # default values for auth method
[oidc]
role = "admin
[userpass]
username = "myuser"
The following occurs when you run vssh:
By default, if a new certificate is needed but no valid token has been found
then vssh will initiate a login prompt for acquiring a new token. This token
will only be used for the single session unless the --persist
option is given
in which case the token is saved to the Vault CLI's default location of
~/.vault-token
. Future uses of vssh will use this token.
Not all authentication methods are currently supported, see the above configuration example for the ones that are. Specifying defaults for the authentication method will pre-fill the login prompt to make logging in easier. However, all other auth methods are still available if desired (i.e. setting defaults does not skip any prompts).
Check out the issues for items neeeding attention or submit your own and then: