Skip to content

vyos_user

Experimental. A local account on a VyOS router: its full name, password and SSH keys. Every VyOS account can configure the router. Conn3x won’t delete the account it logs in as, or take all its keys away.

Experimental. Network devices are new, and this module may change between releases. It’s tested against VyOS rolling in a container on a lab VM, not yet in CI.

Use vyos_user to keep a local account on a VyOS router: its full name, its password and its SSH keys. The change goes in like every VyOS step does, once per router per circuit; see vyos_config.

Every VyOS account can configure the router, so treat each one as an admin.

The password never reaches the router or state as text. Conn3x hashes password_wo on your machine, sends the salted SHA-512 hash as encrypted-password, and keeps only an HMAC of that hash in state, so a refresh can tell whether the account still holds your password without knowing it. A password changed on the router by hand shows as drift.

ssh_keys is the account’s whole set of keys: a key that isn’t listed is deleted. VyOS files each key under a label; Conn3x uses the key’s comment, such as alice@laptop, or a label made from the key itself when there’s no usable comment, and matches keys by the key, whatever their label. Leave ssh_keys unset to leave the keys alone.

Conn3x won’t delete the account it logs in as, or take all of its keys away. Removing the step deletes the account, as with every step that grants access, unless on_remove = "forget".

Give the password from an ephemeral variable, so it stays out of state and plan files:

step "alice" {
vyos_user {
name = "alice"
full_name = "Alice Ops"
password_wo = "use-an-ephemeral-variable-here"
ssh_keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl alice@laptop"]
}
}
Name Type Required Description
full_name string No The account’s full name or description. No quotes. Unset leaves it alone.
name string Yes The account name: lower-case letters, digits, _ . and -. Not root.
on_remove string No “delete” (default) deletes the account when the step goes, as with every step that grants access; “forget” leaves it.
password_wo string No Write-only: the password, never kept in state. Conn3x hashes it here and sends the router the salted SHA-512 crypt hash, as encrypted-password, so the password itself never reaches the CLI; a new value plans a change through password_hmac. Unset leaves the account’s password alone.
ssh_keys list of string No The account’s public keys, one line each, such as “ssh-ed25519 AAAA… alice@laptop”. Each is labelled on the router by its comment, or by a hash of the key without one. Keys not listed are deleted; [] deletes them all, and unset leaves them alone.

Conn3x sets these; reference them as conn3x_vyos_user.<circuit>__<step>["<host>"].<name>.

Name Type Description
in_sync bool Whether the account matched at the last refresh.
password_hmac string An HMAC of the hash the router should hold for password_wo, keyed outside state. A new password plans a change, and a refresh finds an account with another one out of sync.
revision string Changes each time Conn3x changes this on the host. Handlers watch it.

A step lowers to the conn3x_vyos_user resource, one instance per host, and connects with its circuit’s ssh block.