salt.states.ssh_auth#
- salt.states.ssh_auth.absent(name, user, enc='ssh-rsa', comment='', source='', options=None, config='.ssh/authorized_keys', fingerprint_hash_type=None)#
Verifies that the specified SSH key is absent
- name
The SSH key to manage
- user
The user who owns the SSH authorized keys file to modify
- enc
Defines what type of key is being used, can be ed25519, ecdsa, ssh-rsa, ssh-dss or any other type as of openssh server version 8.7.
- comment
The comment to be placed with the SSH public key
- options
The options passed to the key, pass a list object
- source
The source file for the key(s). Can contain any number of public keys, in standard "authorized_keys" format. If this is set, comment, enc and options will be ignored.
New in version 2015.8.0.
- config
The location of the authorized keys file relative to the user's home directory, defaults to ".ssh/authorized_keys". Token expansion %u and %h for username and home path supported.
- fingerprint_hash_type
The public key fingerprint hash type that the public key fingerprint was originally hashed with. This defaults to
sha256if not specified.New in version 2016.11.7.
- salt.states.ssh_auth.manage(name, ssh_keys, user, enc='ssh-rsa', comment='', source='', options=None, config='.ssh/authorized_keys', fingerprint_hash_type=None, **kwargs)#
New in version 3000.
Ensures that only the specified ssh_keys are present for the specified user
- ssh_keys
The SSH key to manage
- user
The user who owns the SSH authorized keys file to modify
- enc
Defines what type of key is being used, can be ed25519, ecdsa, ssh-rsa, ssh-dss or any other type as of openssh server version 8.7.
- comment
The comment to be placed with the SSH public key
- source
The source file for the key(s). Can contain any number of public keys, in standard "authorized_keys" format. If this is set, comment and enc will be ignored.
Note
The source file must contain keys in the format
<enc> <key> <comment>. If you have generated a keypair using PuTTYgen, then you will need to do the following to retrieve an OpenSSH-compatible public key.In PuTTYgen, click
Load, and select the private key file (not the public key), and clickOpen.Copy the public key from the box labeled
Public key for pasting into OpenSSH authorized_keys file.Paste it into a new file.
- options
The options passed to the keys, pass a list object
- config
The location of the authorized keys file relative to the user's home directory, defaults to ".ssh/authorized_keys". Token expansion %u and %h for username and home path supported.
- fingerprint_hash_type
The public key fingerprint hash type that the public key fingerprint was originally hashed with. This defaults to
sha256if not specified.
- salt.states.ssh_auth.present(name, user, enc='ssh-rsa', comment='', source='', options=None, config='.ssh/authorized_keys', fingerprint_hash_type=None, **kwargs)#
Verifies that the specified SSH key is present for the specified user
- name
The SSH key to manage
- user
The user who owns the SSH authorized keys file to modify
- enc
Defines what type of key is being used, can be ed25519, ecdsa, ssh-rsa, ssh-dss or any other type as of openssh server version 8.7.
- comment
The comment to be placed with the SSH public key
- source
The source file for the key(s). Can contain any number of public keys, in standard "authorized_keys" format. If this is set, comment and enc will be ignored.
Note
The source file must contain keys in the format
<enc> <key> <comment>. If you have generated a keypair using PuTTYgen, then you will need to do the following to retrieve an OpenSSH-compatible public key.In PuTTYgen, click
Load, and select the private key file (not the public key), and clickOpen.Copy the public key from the box labeled
Public key for pasting into OpenSSH authorized_keys file.Paste it into a new file.
- options
The options passed to the key, pass a list object. If set, this will overwrite the
optionsto all keys in source file- config
The location of the authorized keys file relative to the user's home directory, defaults to ".ssh/authorized_keys". Token expansion %u and %h for username and home path supported.
- fingerprint_hash_type
The public key fingerprint hash type that the public key fingerprint was originally hashed with. This defaults to
sha256if not specified.