Skip to content

Cisco IOS: PKI sub-mode prompts not matched by promptExpression #294

@user7763

Description

@user7763

promptExpression in pkg/device/cisco/ciscoios.go uses pattern:
(?P[\w-.:/]+((conf(ig)?(-[^)]+)*))?)(>|#)$
This only matches prompts starting with conf or config, like (config)#, (config-if)#, etc.
Cisco IOS has multiple sub-modes that don't follow this pattern. All PKI-related configuration modes use different prefixes:
crypto pki trustpoint (ca-trustpoint)#
crypto pki server (cs-server)#
crypto pki trustpool policy (ca-trustpool)#
crypto pki profile enrollment (ca-profile-enroll)#
crypto pki certificate map (ca-certificate-map)#

gnetcli hits a read timeout because it doesn't recognize the prompt:
cmd: crypto pki trustpoint InternalCA
gnetclisdk.exceptions.GnetcliException: AioRpcError read timeout error.
last seen: "hostname(ca-trustpoint)#"

Suggested fix: broaden the regex to match any sub-mode prompt:

// current:
promptExpression = (?P<prompt>[\w\-.:/]+(\(conf(ig)?(-[^)]+)*\))?)(>|#)$

// proposed:
promptExpression = (?P<prompt>[\w\-.:/]+(\([^)]+\))?)(>|#)$ or (?P<prompt>[\w\-.:/]+(\((conf(ig)?|ca|cs)(-[^)]+)*\))?)(>|#)$

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions