Discussion:
[rancid] Cisco Banners
Todd Heide
2015-04-14 16:21:46 UTC
Permalink
I am having an issue with rancid running commands, and I think I found out why, but dont know how to correct it.  When logging into a router, there is a banner which is using ############# for the box.  Looks like this is what is interfering with Rancid. Is there any work around other than removing the banner(I dont think this will go over well).
banner motd ^CC
###############################################################################
blahblahblah###############################################################################^C
expect: does "routerr#\r\nrouter#terminal length 0\r\nrouter#" (spawn_id exp6) match regular expression "###############################################################################"? Gate "###############################################################################"? gate=no
heasley
2015-04-14 16:36:36 UTC
Permalink
I am having an issue with rancid running commands, and I think I found out why, but dont know how to correct it.  When logging into a router, there is a banner which is using ############# for the box.  Looks like this is what is interfering with Rancid. Is there any work around other than removing the banner(I dont think this will go over well).
banner motd ^CC
###############################################################################
blahblahblah###############################################################################^C
expect: does "routerr#\r\nrouter#terminal length 0\r\nrouter#" (spawn_id exp6) match regular expression "###############################################################################"? Gate "###############################################################################"? gate=no
see add prompt in cloginrc(5)
Todd Heide
2015-04-14 18:12:56 UTC
Permalink
That was the first place I looked, and do not see add prompt listed.  http://www.shrubbery.net/rancid/man/cloginrc.5.html I looked through the .clogin file itself to find a way to ignore the banner.


From: heasley <***@shrubbery.net>
To: Todd Heide <***@yahoo.com>
Cc: "rancid-***@shrubbery.net" <rancid-***@shrubbery.net>
Sent: Tuesday, April 14, 2015 11:36 AM
Subject: Re: [rancid] Cisco Banners
Post by Todd Heide
I am having an issue with rancid running commands, and I think I found out why, but dont know how to correct it.  When logging into a router, there is a banner which is using ############# for the box.  Looks like this is what is interfering with Rancid. Is there any work around other than removing the banner(I dont think this will go over well).
banner motd ^CC
###############################################################################
blahblahblah###############################################################################^C
expect: does "routerr#\r\nrouter#terminal length 0\r\nrouter#" (spawn_id exp6) match regular expression "###############################################################################"? Gate "###############################################################################"? gate=no
see add prompt in cloginrc(5)
heasley
2015-04-14 18:19:25 UTC
Permalink
That was the first place I looked, and do not see add prompt listed.  http://www.shrubbery.net/rancid/man/cloginrc.5.html I looked through the .clogin file itself to find a way to ignore the banner.
I need to update those manpages; sorry.

I assumed you were using rancid >= 3.0. This was added in 3.0.
Sent: Tuesday, April 14, 2015 11:36 AM
Subject: Re: [rancid] Cisco Banners
I am having an issue with rancid running commands, and I think I found out why, but dont know how to correct it.  When logging into a router, there is a banner which is using ############# for the box.  Looks like this is what is interfering with Rancid. Is there any work around other than removing the banner(I dont think this will go over well).
banner motd ^CC
###############################################################################
blahblahblah###############################################################################^C
expect: does "routerr#\r\nrouter#terminal length 0\r\nrouter#" (spawn_id exp6) match regular expression "###############################################################################"? Gate "###############################################################################"? gate=no
see add prompt in cloginrc(5)
Todd Heide
2015-04-14 19:10:30 UTC
Permalink
Yep. Could not locate an rws patch for the latest version so used 2.3.8. So far so good, this is my only hangup.

Sent from my iPhone
Post by heasley
That was the first place I looked, and do not see add prompt listed. http://www.shrubbery.net/rancid/man/cloginrc.5.html I looked through the .clogin file itself to find a way to ignore the banner.
I need to update those manpages; sorry.
I assumed you were using rancid >= 3.0. This was added in 3.0.
Sent: Tuesday, April 14, 2015 11:36 AM
Subject: Re: [rancid] Cisco Banners
I am having an issue with rancid running commands, and I think I found out why, but dont know how to correct it. When logging into a router, there is a banner which is using ############# for the box. Looks like this is what is interfering with Rancid. Is there any work around other than removing the banner(I dont think this will go over well).
banner motd ^CC
###############################################################################
blahblahblah###############################################################################^C
expect: does "routerr#\r\nrouter#terminal length 0\r\nrouter#" (spawn_id exp6) match regular expression "###############################################################################"? Gate "###############################################################################"? gate=no
see add prompt in cloginrc(5)
heasley
2015-04-14 19:39:08 UTC
Permalink
Post by Todd Heide
Yep. Could not locate an rws patch for the latest version so used 2.3.8. So far so good, this is my only hangup.
i do not know what an rws patch is. but, you can use clogin from 3.x.
Todd Heide
2015-04-14 20:05:30 UTC
Permalink
That's the patch used to add Restful web service for Opennms.  It partially works, and other than this problem with connecting to certain routers with MOTD banners, Rancid is working fine. It has been about 7 years since I setup my last instance of Rancid and it is slowly coming back to me.


From: heasley <***@shrubbery.net>
To: Todd Heide <***@yahoo.com>
Cc: heasley <***@shrubbery.net>; "rancid-***@shrubbery.net" <rancid-***@shrubbery.net>
Sent: Tuesday, April 14, 2015 2:39 PM
Subject: Re: [rancid] Cisco Banners
Post by Todd Heide
Yep. Could not locate an rws patch for the latest version so used 2.3.8. So far so good, this is my only hangup.
i do not know what an rws patch is.  but, you can use clogin from 3.x.
Todd Heide
2015-04-14 20:19:18 UTC
Permalink
OK Found it.
 add prompt <router name glob> {<regex>}
Match login prompt, or initial login prompt in the case of some of the login
contain forbidden characters that conflict with CLI prompt markers.
should use if or when prompted for one.


OY REGEX, I hate Regex!  Now to figure this part out!


From: heasley <***@shrubbery.net>
To: Todd Heide <***@yahoo.com>
Cc: heasley <***@shrubbery.net>; "rancid-***@shrubbery.net" <rancid-***@shrubbery.net>
Sent: Tuesday, April 14, 2015 2:39 PM
Subject: Re: [rancid] Cisco Banners
Post by Todd Heide
Yep. Could not locate an rws patch for the latest version so used 2.3.8. So far so good, this is my only hangup.
i do not know what an rws patch is.  but, you can use clogin from 3.x.
heasley
2015-04-14 20:32:58 UTC
Permalink
Post by Todd Heide
OK Found it.
 add prompt <router name glob> {<regex>}
Match login prompt, or initial login prompt in the case of some of the login
contain forbidden characters that conflict with CLI prompt markers.
should use if or when prompted for one.
OY REGEX, I hate Regex!  Now to figure this part out!
its not that difficult. it will set you free.

sth like {\[^ ]\[#>]+} might do it.

i've updated the html manpages too.
Todd Heide
2015-04-14 21:31:27 UTC
Permalink
Tried a few different things, including a direct match for the expression and still errors.

expect: does "\r\nrouter#\r\nrouter#terminal length 0\r\nrouter#" (spawn_id exp6) match regular expression "###############################################################################"? Gate "###############################################################################"? gate=no

What I am seeing though, and wonder if this is why,  terminal length 0  For several lines down I am seeing ter, termin, terminal, etc. until the last line above then is gives up.   I dont know why terminal length 0 is coming up at the prompt, but when I turn debug off I am seeing it every time I clogin to this router.  If this was the only router that has a MOTD, I would push to have it removed, but they want it on all devices.


From: heasley <***@shrubbery.net>
To: Todd Heide <***@yahoo.com>
Cc: heasley <***@shrubbery.net>; "rancid-***@shrubbery.net" <rancid-***@shrubbery.net>
Sent: Tuesday, April 14, 2015 3:32 PM
Subject: Re: [rancid] Cisco Banners
Post by Todd Heide
OK Found it.
 add prompt <router name glob> {<regex>}
Match login prompt, or initial login prompt in the case of some of the login
contain forbidden characters that conflict with CLI prompt markers.
should use if or when prompted for one.
OY REGEX, I hate Regex!  Now to figure this part out!
its not that difficult.  it will set you free.

sth like {\[^ ]\[#>]+} might do it.

i've updated the html manpages too.
Bob Brunette
2015-04-14 21:41:00 UTC
Permalink
Would it be difficult to change the “#”’s to “*”’s or “=“’s? RANCID doesn’t choke on those, and it’s what we normally do.

Bob


From: Todd Heide <***@yahoo.com<mailto:***@yahoo.com>>
Reply-To: Todd Heide <***@yahoo.com<mailto:***@yahoo.com>>
Date: Tuesday, April 14, 2015 at 4:31 PM
To: heasley <***@shrubbery.net<mailto:***@shrubbery.net>>
Cc: "rancid-***@shrubbery.net<mailto:rancid-***@shrubbery.net>" <rancid-***@shrubbery.net<mailto:rancid-***@shrubbery.net>>
Subject: Re: [rancid] Cisco Banners

Tried a few different things, including a direct match for the expression and still errors.

expect: does "\r\nrouter#\r\nrouter#terminal length 0\r\nrouter#" (spawn_id exp6) match regular expression "###############################################################################"? Gate "###############################################################################"? gate=no

What I am seeing though, and wonder if this is why, terminal length 0 For several lines down I am seeing ter, termin, terminal, etc. until the last line above then is gives up. I dont know why terminal length 0 is coming up at the prompt, but when I turn debug off I am seeing it every time I clogin to this router. If this was the only router that has a MOTD, I would push to have it removed, but they want it on all devices.

________________________________
From: heasley <***@shrubbery.net<mailto:***@shrubbery.net>>
To: Todd Heide <***@yahoo.com<mailto:***@yahoo.com>>
Cc: heasley <***@shrubbery.net<mailto:***@shrubbery.net>>; "rancid-***@shrubbery.net<mailto:rancid-***@shrubbery.net>" <rancid-***@shrubbery.net<mailto:rancid-***@shrubbery.net>>
Sent: Tuesday, April 14, 2015 3:32 PM
Subject: Re: [rancid] Cisco Banners
Post by Todd Heide
OK Found it.
add prompt <router name glob> {<regex>}
Match login prompt, or initial login prompt in the case of some of the login
contain forbidden characters that conflict with CLI prompt markers.
should use if or when prompted for one.
OY REGEX, I hate Regex! Now to figure this part out!
its not that difficult. it will set you free.

sth like {\[^ ]\[#>]+} might do it.

i've updated the html manpages too.
Todd Heide
2015-04-15 00:41:39 UTC
Permalink
That's probably where I will go. Wasted enough time already.

Sent from my iPhone
Would it be difficult to change the “#”’s to “*”’s or “=“’s? RANCID doesn’t choke on those, and it’s what we normally do.
Bob
Date: Tuesday, April 14, 2015 at 4:31 PM
Subject: Re: [rancid] Cisco Banners
Tried a few different things, including a direct match for the expression and still errors.
expect: does "\r\nrouter#\r\nrouter#terminal length 0\r\nrouter#" (spawn_id exp6) match regular expression "###############################################################################"? Gate "###############################################################################"? gate=no
What I am seeing though, and wonder if this is why, terminal length 0 For several lines down I am seeing ter, termin, terminal, etc. until the last line above then is gives up. I dont know why terminal length 0 is coming up at the prompt, but when I turn debug off I am seeing it every time I clogin to this router. If this was the only router that has a MOTD, I would push to have it removed, but they want it on all devices.
Sent: Tuesday, April 14, 2015 3:32 PM
Subject: Re: [rancid] Cisco Banners
Post by Todd Heide
OK Found it.
add prompt <router name glob> {<regex>}
Match login prompt, or initial login prompt in the case of some of the login
contain forbidden characters that conflict with CLI prompt markers.
should use if or when prompted for one.
OY REGEX, I hate Regex! Now to figure this part out!
its not that difficult. it will set you free.
sth like {\[^ ]\[#>]+} might do it.
i've updated the html manpages too.
heasley
2015-04-15 00:59:11 UTC
Permalink
Post by Todd Heide
Tried a few different things, including a direct match for the expression and still errors.
expect: does "\r\nrouter#\r\nrouter#terminal length 0\r\nrouter#" (spawn_id exp6) match regular expression "###############################################################################"? Gate "###############################################################################"? gate=no
What I am seeing though, and wonder if this is why,  terminal length 0  For several lines down I am seeing ter, termin, terminal, etc. until the last line above then is gives up.   I dont know why terminal length 0 is coming up at the prompt, but when I turn debug off I am seeing it every time I clogin to this router.  If this was the only router that has a MOTD, I would push to have it removed, but they want it on all devices.
where did that regex come from? "########### etc etc"

you may also try anchoring it:

{^\[^ #]+\[#>]+}

the last regex in the login procedure should eat the o/p one line at a
time, so it can be anchored.
Todd Heide
2015-04-15 01:06:39 UTC
Permalink
I'll give it a try tomorrow before submitting a change order to redo all the MOTD.

From: heasley <***@shrubbery.net>
To: Todd Heide <***@yahoo.com>
Cc: heasley <***@shrubbery.net>; "rancid-***@shrubbery.net" <rancid-***@shrubbery.net>
Sent: Tuesday, April 14, 2015 7:59 PM
Subject: Re: [rancid] Cisco Banners
Post by Todd Heide
Tried a few different things, including a direct match for the expression and still errors.
expect: does "\r\nrouter#\r\nrouter#terminal length 0\r\nrouter#" (spawn_id exp6) match regular expression "###############################################################################"? Gate "###############################################################################"? gate=no
What I am seeing though, and wonder if this is why,  terminal length 0  For several lines down I am seeing ter, termin, terminal, etc. until the last line above then is gives up.   I dont know why terminal length 0 is coming up at the prompt, but when I turn debug off I am seeing it every time I clogin to this router.  If this was the only router that has a MOTD, I would push to have it removed, but they want it on all devices.
 
where did that regex come from?  "########### etc etc"

you may also try anchoring it:

{^\[^ #]+\[#>]+}

the last regex in the login procedure should eat the o/p one line at a
time, so it can be anchored.

Loading...