Pular para o conteúdo

Cisco IOS / IOS-XE

This page covers administrative login (SSH and, optionally, the console) on Cisco IOS and IOS-XE with the built-in Cisco IOS / IOS-XE (device administration) template. For how OkYouIn handles RADIUS in general — first-factor modes, prompt modes, identification, BlastRADIUS — see RADIUS.

PlatformSoftwareModesWhat was verified
Cisco IOS XE (IOL, virtual)17.12.1password, password + MFATOTP in the SSH keyboard-interactive prompt; exec accounting Start / Stop; Class echoed in accounting; shell:priv-lvl, shell:autocmd, Session-Timeout and Idle-Timeout applied

Not verified: Interim-Update driven by OkYouIn’s Interim interval, and Accounting-On / Off.

First factorOkYouIn checks the password only. MFA only is not available (see below).
Second factorTOTP, e-mail code, push (Web Push, Telegram) — the code prompt appears in the same SSH session.
PromptsYes: IOS shows OkYouIn’s Access-Challenge text as it is, with input hidden.
AccountingExec Start / Stop with session time and disconnect cause; no byte counters.
Client IPCalling-Station-Id is the SSH client’s address — needs the attribute 31 line below.

Why there is no MFA-only mode. IOS cannot check its local password and then ask RADIUS for the code only. A method list such as local group OKYOUIN-GRP never chains: a right local password ends the login without OkYouIn, a wrong one ends it too (IOS tries the next method only when the user is unknown locally).

  1. In OkYouIn, open Access ▸ Applications ▸ Add application and pick Cisco IOS / IOS-XE (device administration). The application gets a generated NAS-Identifier and shared secret; the Connect tab shows the configuration below with those values already filled in.

  2. Under Sources, add a network object for the router’s own address. IOS sends no Message-Authenticator in the first Access-Request, so this router must be identified by its source address: it cannot share an address with another application that is told apart by NAS-Identifier only.

  3. Keep a console session or out-of-band access available, and keep your current SSH session open until a new login has been tested.

The example uses 192.0.2.10 for OkYouIn and vpn-hq stands in for the application’s NAS-Identifier — copy the real values from the Connect tab. IOS needs an IP address, not a host name. Replace <INTERFACE> with the interface the router reaches OkYouIn from.

radius server OKYOUIN
address ipv4 192.0.2.10 auth-port 1812 acct-port 1813
key <SHARED-SECRET>
timeout 60
retransmit 0
!
aaa group server radius OKYOUIN-GRP
server name OKYOUIN
ip radius source-interface <INTERFACE>
!
aaa authentication login OKYOUIN group OKYOUIN-GRP local
aaa authorization exec OKYOUIN group OKYOUIN-GRP local
aaa accounting exec OKYOUIN start-stop group OKYOUIN-GRP
radius-server attribute 32 include-in-access-req format vpn-hq
radius-server attribute 32 include-in-accounting-req format vpn-hq
radius-server attribute 31 send nas-port-detail
!
line vty 0 4
login authentication OKYOUIN
authorization exec OKYOUIN
accounting exec OKYOUIN
transport input ssh

Keep the console on a local method list — it is your recovery path:

aaa authentication login CONSOLE local
line con 0
login authentication CONSOLE

What the less obvious lines do:

  • timeout 60 — a push waits for the user to approve; a shorter timeout fails the login first.
  • attribute 32 … include-in-access-req / include-in-accounting-req — IOS sends no NAS-Identifier by default. Both lines are needed: without the accounting one, IOS sends no NAS-Identifier in Accounting-Request, OkYouIn records those packets as unidentified and no sessions appear. format %h would send the host name instead — then set the application’s NAS-Identifier to the host name. If the application has no NAS-Identifier (identified by source only), leave both lines out. These lines are global: they apply to every RADIUS server group on the device.
  • attribute 31 send nas-port-detail — without it IOS sends no Calling-Station-Id on SSH logins, and network conditions in your policy cannot match.

The same configuration serves password and password + MFA: MFA is switched on or off in OkYouIn only (Require MFA in the application’s Settings, or per rule).

Users must use keyboard-interactive authentication (OpenSSH and PuTTY do by default). With MFA on, IOS answers the plain password method with a code prompt that strict clients reject. An empty answer at the code prompt is sent too and counts as a wrong code. A reject’s message, such as “Too many wrong codes — sign in again”, reaches the SSH client as keyboard-interactive text.

Set these in the application’s Rules tab. They take effect only with the aaa authorization exec line.

AttributeEffect
Cisco-AVPair = shell:priv-lvl=NExec privilege level 0–15 (default in the template: shell:priv-lvl=15). Without it the session starts at level 1. Service-Type Administrative-User alone also gives level 15.
Cisco-AVPair = shell:autocmd=<command>A second Cisco-AVPair: runs the command at login, then ends the session.
Session-TimeoutEnds the SSH session after N seconds even while in use (e.g. 28800).
Idle-TimeoutEnds the session after N idle seconds (e.g. 1800).
ClassEchoed in accounting. A Class from a rule replaces OkYouIn’s own Class token; sessions are then linked to the sign-in by user and client address.

aaa accounting exec OKYOUIN start-stop together with accounting exec OKYOUIN on the vty lines sends Accounting Start at login and Stop at logout: user, Acct-Session-Id, client address, tty line, session time and disconnect cause (User-Request, Idle-Timeout, Session-Timeout). There are no byte counters, and failed logins send no accounting. OkYouIn’s Class token is echoed in every packet and links each session to its sign-in on the application’s Sessions tab.

Interim-Update is sent only with the global aaa accounting update periodic <MINUTES>, which also adds update records to every other accounting list on the device (TACACS+ included). Whether IOS honours OkYouIn’s Interim interval (seconds) has not been verified, so the template leaves it empty.

Keep Protection mode (CVE-2024-3596) at Standard, the default. Strict breaks this device: IOS-XE 17.12.1 sends no Message-Authenticator in the first Access-Request, so every login would be dropped.

  1. Open a new SSH session as an OkYouIn user. After the password, enter the code (or approve the push).

  2. In OkYouIn, open Logging ▸ RADIUS log: the request shows Accept with the application, source and reason (for example MFA verified).

  3. After logging out, the session appears on the application’s Sessions tab (and Logging ▸ RADIUS sessions) with start, end and disconnect cause.

  4. Only then save the configuration with write memory.

SymptomLikely cause
Login hangs for a minute, then falls back to localOkYouIn did not answer. Check Logging ▸ RADIUS log ▸ Dropped packets: a wrong shared secret, an unknown client (source address not among the application’s Sources), or a dropped packet without Message-Authenticator (Strict mode).
Reject with reason nas_identifier_mismatchThe router sends a different NAS-Identifier than the application expects — compare the attribute 32 lines with the Settings tab.
No sessions on the Sessions tabThe include-in-accounting-req line is missing, or the accounting lines are not on the vty lines.
Session starts at level 1No Cisco-AVPair shell:priv-lvl=… in the matching rule, or the aaa authorization exec line is missing.
Network conditions never matchThe attribute 31 line is missing.