[TriLUG] a perl/expect/IOS question

Mitchell Amiano mamiano at nc.rr.com
Thu Feb 23 16:20:48 EST 2012


A character encoding issue perhaps?  UTF8 only sort-of-kind-of equals ASCII, up to 7 bits; swapping the encodings you end up with the same number of characters only if there is no BOM and no characters outside the ASCII set, and a silent up conversion to UTF-16 would double the byte count and look like a message where most of the characters were interleaved with nulls to an 8 bit reader. 

Or perhaps something else is gobbling up a character or two. Where's the 7 in the error message?


On Feb 23, 2012, at 3:49 PM, Greg Brown wrote:

> Thanks for the ideas, Weave.  I tried both ways and got the same result I'm
> afraid:
> 
> in subscript: output of sending new config: r2821(config)# tacacs-server
> key 7 0115140B551F02002E5E
> in subscript: output of sending new config: %Invalid encrypted key:
> 0115140B551F02002E5E
> 
> However, if you copy and paste it (just to prove to myself that I'm not
> insane) it works:
> 
> 
> r2821(config)#tacacs-server key 7 0115140B551F02002E5E
> r2821(config)#
> 
> Oy.
> 
> Greg
> 
> 
> On Thu, Feb 23, 2012 at 3:12 PM, Brian Weaver <cmdrclueless at gmail.com>wrote:
> 
>> Have you tried
>> 
>> $configLine = "tacacs-server key 7 " . $tacacsKey;
>> 
>> or
>> 
>> $configLine = "tacacs-server key 7 $tacacsKey";
>> 
>> -- Brian
>> 
>> On Thu, Feb 23, 2012 at 2:47 PM, Greg Brown <gwbrown1 at gmail.com> wrote:
>>> I have an encrypted tacacs key that I extract out of a router and I place
>>> that key onto the line "tacacs-server key 7 $tacacsKey" using join.  The
>>> actual line is my $configLine=join(' ',"tacacs-server key 7",$tacacsKey);
>>> 
>>> I can copy and past that line manually into the cisco router and the
>>> router accepts the key.  If my script tries to do the same I get an
>> invalid
>>> key error.
>>> 
>>> I think I might have a control character stuck in there but I'm starting
>> to
>>> doubt it.  I can 'od -c' the string and it looks ok but the key will fail
>>> within the script ever time throwing back "%Invalid encrypted key" every
>>> time.
>>> 
>>> So, in summary, cut and past the line by hand with the encrypted key and
>>> the router accepts it.  Try the same using Net::SSH::Expect and it fails.
>>> 
>>> Ideas?  I don't have any at this point.
>>> 
>>> Greg
>>> --
>>> This message was sent to: cmdrclueless at gmail.com <cmdrclueless at gmail.com
>>> 
>>> To unsubscribe, send a blank message to trilug-leave at trilug.org from
>> that address.
>>> TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
>>> Unsubscribe or edit options on the web  :
>> http://www.trilug.org/mailman/options/trilug/cmdrclueless%40gmail.com
>>> TriLUG FAQ          :
>> http://www.trilug.org/wiki/Frequently_Asked_Questions
>> 
>> 
>> 
>> --
>> 
>> /* insert witty comment here */
>> --
>> This message was sent to: Greg Brown <gwbrown1 at gmail.com>
>> To unsubscribe, send a blank message to trilug-leave at trilug.org from that
>> address.
>> TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
>> Unsubscribe or edit options on the web  :
>> http://www.trilug.org/mailman/options/trilug/gwbrown1%40gmail.com
>> TriLUG FAQ          :
>> http://www.trilug.org/wiki/Frequently_Asked_Questions
>> 
> -- 
> This message was sent to: Mitch Amiano <mamiano at nc.rr.com>
> To unsubscribe, send a blank message to trilug-leave at trilug.org from that address.
> TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
> Unsubscribe or edit options on the web	: http://www.trilug.org/mailman/options/trilug/mamiano%40nc.rr.com
> TriLUG FAQ          : http://www.trilug.org/wiki/Frequently_Asked_Questions

Mitchell Amiano
(919) 410-8008
mamiano at nc.rr.com







More information about the TriLUG mailing list