[TriLUG] a perl/expect/IOS question

Greg Brown gwbrown1 at gmail.com
Thu Feb 23 16:41:15 EST 2012


Here you go:

length of $tacacsKey is 20
$tacacsKey = "0115140B551F02002E5E"

They appear to match.

(more head scratching)


On Thu, Feb 23, 2012 at 4:25 PM, Brian Weaver <cmdrclueless at gmail.com>wrote:

> Greg,
>
> I don't know where you set the value of $tacacsKey, perhaps is has a
> control character that you're not picking up via cut and paste. Out of
> curiosity what do you get when you add the following debug?
>
> print STDERR 'length of $tacacsKey is ' . length($tacacsKey) . "\n";
> print STDERR '$tacacsKey = "' . $tacacsKey ."\"\n";
>
> Be sure you use the correct quoting to avoid having the variable
> interpreted during the initial part of the print statement.
>
> -- Brian
>
> On Thu, Feb 23, 2012 at 3:49 PM, Greg Brown <gwbrown1 at gmail.com> 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: 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
>



More information about the TriLUG mailing list