01-17-2024 06:59 AM - edited 01-17-2024 10:51 PM
Hi there,
I'm trying to set an encrypted preshared key on a C9200 (ver 17.06.05) with a python script.
When executing the following script
import cli
cli.configurep([
"password encryption aes",
"key config-key password-encrypt MYKEY"
])
I get the following output :
Line 1 SUCCESS: password encryption aes
Line 2 SUCCESS: key config-key password-encrypt MYKEY
However the second line is not configured.
Did I miss something ?
Regards
01-17-2024 07:27 AM
Try
import cli
cli.enable()
cli.configure(["crypto key generate rsa general-keys modulus 1024"])
config = [
"password encryption aes",
"key config-key password-encrypt MYKEY"
]
cli.configure(config)
The cli.configure() method takes a list of configuration commands and executes them in config mode.
01-17-2024 10:02 AM
First try, I had to remove ,cli.enable() because of this : "AttributeError: module 'cli' has no attribute 'enable''"
After a second try, the rsa key pairs were generated successfully. The "password encryption aes" command was executed successfully but the "key config-key password-encrypt MYKEY" command still fails to work. When trying to set an encrypted key for radius or tacacs+ servers, I receive invalid key error messages. This suggests that encrypted preshared key is not set properly.
02-02-2024 01:54 AM
Has this been resolved?
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide