Cisco IOS XE
Rotate your Cisco IOS XE Network Credentials

Overview
In this guide, you will learn how to set up password rotation to rotate Cisco IOS XE network credentials.
Prerequisites
KSM Application: Ensure that the Keeper Secrets Manager (KSM) application is set up.
Shared Folder: A shared folder should be set up where all the records will be stored.
PAM Configuration: Ensure that the PAM Configuration is set up and that the Gateway is running and attached to this configuration.
Requests Library: Ensure that the requests library is installed in your Python environment. This library is necessary for making HTTP requests to Cisco devices.
Setting up AnyConnect Cisco VPN: In order to connect to cisco devices, ensure that the machine hosting Keeper Gateway has Cisco AnyConnect VPN installed and properly configured
Test Cisco Device Connectivity
Requests library installation
The Requests library allows you to send HTTP requests easily. Activate a Python virtual environment in your Keeper Gateway environment and install the library using the following command:
Setting up AnyConnect Cisco VPN
Ensure that the machine hosting Keeper Gateway has Cisco AnyConnect VPN installed and properly configured in order to connect to cisco device. This setup is necessary for establishing secure connections to Cisco devices.
Steps to Test Cisco Device
Following these steps will allow you to test the Cisco device and create a new user in the Cisco sandbox environment.
Note: If you want to use a virtual environment, add a shebang line at the top of the script as documented here in the Python Environment Setup.
1. Login to Cisco Sandbox
Go to the Cisco DevNet Sandbox
Log in with your Cisco account credentials.
Select and launch the sandbox.

2. Select and Launch the Device
Navigate to the sandbox catalog.
Select the appropriate sandbox for your Cisco device (e.g., Cisco IOS XE, etc.).
Launch the sandbox.

3. Receive Details via Email or DevNet Environment
After launching the sandbox, you will receive an email with the connection details or find them in the DevNet Environment under Quick Access.

4. Download Cisco AnyConnect VPN
Download and install the Cisco AnyConnect Secure Mobility Client.
Get detailed connection instructions here.
5. Connect to the VPN
Open the Cisco AnyConnect Secure Mobility Client.
Enter the VPN connection details provided in the email or from the DevNet Environment.
Connect using the provided username and password.
6. Store Developer Credentials
At this point, you will see Developer Credentials—a host, username, and password. Store these values in a Keeper Security record of type Login
named as Cisco Authentication Record
. You will need this Keeper Security record name in order to run the post-rotation script.
7. Add Custom Field to Cisco Authentication Record
Add a custom field named host_endpoint
to the Cisco Authentication Record and set its value to the host address (e.g., 10.10.20.48
).

8. Create a User
Open your terminal or SSH client.
Connect to the Cisco device using the provided IP address and credentials.
9. Follow These Steps to Create a User
Login with Admin User (developer):
Enable privileged commands:
Enter configuration mode:
Create a new user with a password:

10. Test the New User
Login with the new user:

Note: Replace
<user>
with the username you created and<device-ip>
with the IP address of the Cisco device.
Setting up Rotation in your Vault
Once you have your prerequisites ready, make sure you cover the following:
Make sure you satisfy all the prerequisites
Ensure that the post-rotation script references the Keeper Security record containing your Cisco admin credentials.
Attach the post-rotation script to a Keeper Security PAM user record using the Keeper Security documentation. When this record has its secrets rotated, the post-rotation script will execute and update the password for the specified Cisco device user.
Step 1: Set Up Rotation Record
Create a new PAM User record to store Cisco User details whose password will be rotated.
Set the username to match the Cisco device admin credentials
Set the password to the current password set for the user.
Add a custom field named
host_endpoint
to the Cisco Authentication Record and set its value to the host address (e.g.,10.10.20.48
).
Step 2: Add PAM Script
Attach the below Python script that will perform the password rotation. The script has additional comments inside that describe each line.
Step 3: Add NOOP Custom Field
Enable No-Operation (NOOP) atomic execution:
In the current PAM User record where user's details are stored, create a new custom text field labeled
NOOP
and set its value toTrue
.
Step 4: Configure Password Rotation Settings
Rotation Type: Set it to "On-Demand" for this example.
Password Complexity: Leave it as default unless you have specific requirements.
Rotation Settings: Point to the PAM Configuration set up earlier.
Administrative Credentials Record: Can should be left empty
Python Script
PAM script to rotate Cisco IOS XE user credentials:
The above script for the Cisco Post-Rotation Script can be also found here:
Rotating Cisco IOS XE Network User Credentials
Note: The user whose password is getting rotated should not be an administrator and must be Authorized for Client VPN [While adding the user via user management portal, the authorized option should be selected as 'Yes'].
After successfully setting up Rotation for your Cisco User Credentials on the PAM User Record, clicking on "Run Scripts Only" will rotate the credential:

Last updated
Was this helpful?