[rancid] IOS show crypto feature addition request

David Jones djones at ena.com
Tue Jan 3 20:03:08 UTC 2017


Patch request for new feature that works with any recent Rancid version with ios.pm to show the crypto key generated or the lack thereof:

lib/ios.pm (add before the 'sub ShowDetail' -- line 560 in 3.6.1) 
== begin ================================================

# This routine parses "show crypto key mypubkey rsa"
sub ShowCrypto {
    my($INPUT, $OUTPUT, $cmd) = @_;
    print STDERR "    In ShowCrypto: $_" if ($debug);

    while (<$INPUT>) {
        tr/\015//d;
        last if (/^$prompt/);
        next if (/^(\s*|\s*$cmd\s*)$/);
        return(1) if /^\s*\^\s*$/;
        return(1) if (/(invalid (input|command) detected|type help or )/i);
        return(1) if (/unrecognized command/i);
        next if (!(/Key name|^ssh-[dr]sa/i));
        ProcessHistory("CRYPTO","","","!crypto: $_");
    }
    ProcessHistory("","","","!\n");
    return(0);
}
== end ================================================

etc/rancid.types.conf (could be promoted to rancid.types.base):
======================================================
cisco;command;ios::ShowCrypto;show crypto key mypubkey rsa

Thanks,
Dave Jones
Lead Systems Engineer
Education Networks of America


More information about the Rancid-discuss mailing list