SSH authentication on Cisco NX-OS devices provide X.509 digital certificate support for host authentication.

Cisco NX-OS devices support SSHv2, including Rivest, Shamir, and Adelman (RSA) public-key cryptography and the Digital System Algorithm (DSA).

SSH Class

class SSH(Feature)

Example:
>>> import cisco
>>> from cisco.ssh import *
>>> ssh1 = SSH()

gen_key

Generate SSH keys

gen_key (self, **args)

Example:
>>> import cisco
>>> from cisco.ssh import *
>>> ssh1 = SSH()
>>> mykeys = ssh1.gen_keys('rsa')

Arguments:

  • key_type
    • dsa: Generate DSA keys
    • rsa: Generate RSA keys

Optional Arguments:

  • bits: For RSA keys, the number of bits. The range is 768 to 2048 bits. You cannot specify the size of the DSA key. It is always set to 1024 bits.
  • force: Force the generation of keys, replacing any existing keys.
  • no: If set to True, remove SSH key.

get_keys

Show SSH keys

get_keys (self, **args)

Example:
>>> ssh1.get_keys(key_type='rsa')
{'rsa': {'bitcount': ['1024'], 'generation date': ['Tue'], 'key': ['AAAAB3NzaC1yc2EAAAABIwAAAEIA3SppFWo7kIER1UkI+fRWcxwwYaSadmF33zzvlOk8wSmC5WE9iZ12aeYnSzdquz4VTMDLOL8FdrK6jfhUiBSINJkPaq9DV43g+Rka7KL4h1zQLAryPkpdWgcUllOnDde+o7cVK1Or6ZXLEbhC3rH+MA0Dh+6tcbeaHPaxdYhPTck=']}, 'dsa': {'bitcount': [], 'generation date': [], 'key': []}}

Optional Arguments:

  • key_type
    • dsa: Show DSA keys
    • rsa: Show RSA keys

Returns: SSH keys