pt_apply_hardening
Applies CLI hardening to a router or switch: hostname, banner, secrets, local users, SSH, and SSH-only vty lines. Validate changes first with a dry run.
Instructions
Hardens a router/switch in the active topology.
Applies via CLI: hostname, MOTD banner, enable secret, local users, SSH
(domain-name + RSA keys + ip ssh version), service password-encryption, and
restricts the vty lines to SSH with local login.
Parameters:
device: device name in PT.
hostname: new hostname (optional).
banner_motd: MOTD banner text (without the '#' character).
enable_secret: enable password (it is encrypted).
users: list of {username, secret, privilege?}. Needed for SSH/local login.
ssh: dict {domain?, modulus?, version?, enable?} to enable SSH. Requires at least one user. modulus<768 raises a warning.
service_password_encryption: applies
service password-encryption(default True).dry_run: if True, only validates and returns the CLI/payload.
Example: full hardening of R1 with SSH: pt_apply_hardening(device="R1", hostname="R1", enable_secret="cisco123", users=[{"username":"admin","secret":"adminpass","privilege":15}], ssh={"domain":"lab.local","modulus":1024}, dry_run=True)
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"device": "<device>"
},
"name": "pt_apply_hardening"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ssh | No | ||
| users | No | ||
| device | Yes | ||
| dry_run | No | ||
| hostname | No | ||
| banner_motd | No | ||
| enable_secret | No | ||
| service_password_encryption | No |