<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Lance,<br>
<br>
That makes perfect sense. Thanks a lot for a very good logical
explanation.<br>
<br>
BTW, this is what I did in f5rancid(a copy of rancid). Modified it as
below.<br>
<br>
# This routine processes a "write term"<br>
sub BList {<br>
print STDERR " In BList: $_" if ($debug);<br>
my($lineauto,$comment,$linecnt) = (0,0,0); <br>
<br>
while (<INPUT>) {<br>
tr/\015//d;<br>
last if(/^$prompt/); <br>
return(-1) if (/command not found/i); <br>
$linecnt++; <br>
$lineauto = 0 if (/^[^ ]/); <br>
# some versions have other crap mixed in with the bits in the<br>
<br>
}<br>
# The ContentEngine lacks a definitive "end of config" marker. If
we<br>
# know that it is a CE and we have seen at least 5 lines of b list<br>
# o/p, we can be reasonably sure that we got the config.<br>
if ($linecnt > 5) {<br>
$found_end = 1;<br>
return(1);<br>
}<br>
<br>
return(0);<br>
}<br>
<br>
# dummy function <br>
sub DoNothing {print STDOUT;}<br>
<br>
# Main<br>
%commands=(<br>
'b list' => "BList"<br>
);<br>
# keys() doesnt return things in the order entered and the order of the<br>
# cmds is important (show version first and write term last). pita<br>
@commands=(<br>
"b list"<br>
);<br>
$cisco_cmds=join(";",@commands);<br>
$cmds_regexp=join("|",@commands);<br>
<br>
All I did was changed "write term" to "b list" and changed function
name too. I also changed a little bit around finding the end of input
variable. However it still doesn't work. I get following in my logs.<br>
<br>
starting: Mon Jul 16 12:49:05 CDT 2007<br>
<br>
<br>
<br>
Trying to get all of the configs.<br>
test-f5-01: End of run not found<br>
!<br>
=====================================<br>
Getting missed routers: round 1.<br>
test-f5-01: End of run not found<br>
!<br>
=====================================<br>
Getting missed routers: round 2.<br>
test-f5-01: End of run not found<br>
!<br>
=====================================<br>
Getting missed routers: round 3.<br>
test-f5-01: End of run not found<br>
!<br>
=====================================<br>
Getting missed routers: round 4.<br>
test-f5-01: End of run not found<br>
!<br>
<br>
cvs diff: Diffing .<br>
cvs diff: Diffing configs<br>
cvs diff: cannot find configs/test-f5-01<br>
cvs commit: Examining .<br>
cvs commit: Examining configs<br>
cvs commit: Up-to-date check failed for `configs/test-f5-01'<br>
cvs [commit aborted]: correct above errors first!<br>
ls: test-f5-01: No such file or directory<br>
<br>
ending: Mon Jul 16 12:49:32 CDT 2007<br>
<br>
Any hints would be appreciated.<br>
<br>
Thanks,<br>
Sam<br>
<blockquote
cite="mid:20070716102053.8e114e4890519e5179c192e02d6bca26.ed552ed684.wbe@email.secureserver.net"
type="cite">
<pre wrap="">Sam,
What bldshgalsjd is the prompt is looks for before it sends the
username.
Example, if the the device prompted you for a username like so, you
would use the following.
Your User name:
#.cloginrc line
add userprompt f5* "Your User name:"
This would only send your username if it found the prompt of "Your User
name:" (minus the ""). So the likely hood that it will find bldshgalsjd
would be slim to almost impossible.
-lance
</pre>
<blockquote type="cite">
<pre wrap="">-------- Original Message --------
Subject: Re: [rancid] Re: F5 load balancer support
From: Sam Munzani <a class="moz-txt-link-rfc2396E" href="mailto:smunzani@comcast.net"><smunzani@comcast.net></a>
Date: Mon, July 16, 2007 9:48 am
To: David Croft <a class="moz-txt-link-rfc2396E" href="mailto:david@infotrek.co.uk"><david@infotrek.co.uk></a>
Cc: Lance <a class="moz-txt-link-rfc2396E" href="mailto:rancid@gheek.net"><rancid@gheek.net></a>, <a class="moz-txt-link-abbreviated" href="mailto:rancid-discuss@shrubbery.net">rancid-discuss@shrubbery.net</a>
David,
Thanks a lot for the tip. This worked well. Now f5login goes much more
cleaner and the "root" doesn't set sent again. I still have other issues
where rancid-run is backing up config properly but I am still
troubleshooting it.
Now here is a question. What does "bldshgalsjd" mean and how does it do
this miracle?
Thanks,
Sam
</pre>
<blockquote type="cite">
<pre wrap="">Thanks for this tip, turns out that this is also the reason the
username gets entered at a prompt on the cisco IPS devices. Since it's
using SSH and therefore doesn't need a username prompt, solution was
to simply add in .cloginrc:
add userprompt ids* bldshgalsjd (<- something that won't get sent
during login)
Regards,
David
On 14/07/07, Lance <a class="moz-txt-link-rfc2396E" href="mailto:rancid@gheek.net"><rancid@gheek.net></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Sam,
Have you tried using telnet to login, if the f5 has it enabled.
You may also want to set auto enable in your .cloginrc for this device
as it looks to clogin as you are already in a cisco equivalent
</pre>
</blockquote>
</blockquote>
<pre wrap="">equal to
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">enable since your prompt has a # sign in it.
Looking at your next email along with this one it looks like you are
already in a cisco equivalent of enable after you login. f5login seems
to be sending your username of root as a command after you get
</pre>
</blockquote>
</blockquote>
<pre wrap="">connected
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">because it sees this line "Last login: Fri Jul 13 14:38:03 2007 from
172.24.100.12" and it matches on the word "Login". See below.
"(Username|Login|login|user name):"? yes
expect: set expect_out(0,string) "login:"
expect: set expect_out(1,string) "login"
expect: set expect_out(spawn_id) "exp4"
expect: set expect_out(buffer) " \r\nLast login:"
send: sending "root\r" to { exp4 }
expect: continuing expect
You are just using a Cisco login/parsing script so it expects prompts
from a Cisco device and in this case you have a *nix SSH banner that
gets interrupted. I know you can use RANCID to backup *nix systems. So
it knows how to understand connecting to a *nix system. You might want
to try this email thread which asks about backing up Linux conifgs.
<a class="moz-txt-link-rfc2396E" href="http://www.shrubbery.net/pipermail/rancid-discuss/2006-August/001649.html">"http://www.shrubbery.net/pipermail/rancid-discuss/2006-August/001649.html"</a>
</pre>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">Or you could modify the existing f5login like so.
I think you have to use the carrot before the () to work. I haven't
checked this as I am at home and not on a UNIX system right now. Sorry
to lazy to check it out right now. You might want to uncomment the
</pre>
</blockquote>
</blockquote>
<pre wrap="">line
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">below 3. and comment out the line below 2. and see if that works. This
is the only point in the code that I see it look for login in any
</pre>
</blockquote>
</blockquote>
<pre wrap="">line.
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">If that doesn't work send me back the debug and I will see what I can
do. I am sure some people that use expect more often then I can
</pre>
</blockquote>
</blockquote>
<pre wrap="">probably
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">quickly tell you what to use as syntax there.
# Figure out prompts
set u_prompt [find userprompt $router
if { "$u_prompt" == "" } {
#1. ORIGINAL
#set u_prompt "^(Username|Login|login|user name):"
#2. Modified to read for a line beginning with
Username,Login,login, or
user name.
set u_prompt "^(Username|Login|login|user name):"
#3. Modified to read for a line beginning with Login or login.
but I
may be wrong
#set u_prompt "^(Username|^Login|^login|user name):"
} else {
set u_prompt [join [lindex $u_prompt 0] ""]
Let me know if this works for you.
-Lance
</pre>
<blockquote type="cite">
<pre wrap="">-------- Original Message --------
Subject: Re: [rancid] F5 load balancer support
From: Sam Munzani <a class="moz-txt-link-rfc2396E" href="mailto:smunzani@comcast.net"><smunzani@comcast.net></a>
Date: Fri, July 13, 2007 2:30 pm
To: Lance <a class="moz-txt-link-rfc2396E" href="mailto:rancid@gheek.net"><rancid@gheek.net></a>
Cc: <a class="moz-txt-link-abbreviated" href="mailto:rancid-discuss@shrubbery.net">rancid-discuss@shrubbery.net</a>
Lance,
F5 login works fine with a minor error.
$ f5login test-f5-01
test-f5-01
spawn ssh -c 3des -x -l root test-f5-01
Password:
Last login: Fri Jul 13 14:26:28 2007 from 172.24.100.12
root
[root@test-f5-01:Active] config # root
-bash: root: command not found
[root@test-f5-01:Active] config #
[root@test-f5-01:Active] config #
[root@test-f5-01:Active] config #
I don't know how to debug otherwise I would turn on debug too. If
</pre>
</blockquote>
</blockquote>
</blockquote>
<pre wrap="">you
</pre>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">can provide some hints on debug, I would appreciate it.
Thanks,
Sam
</pre>
<blockquote type="cite">
<pre wrap="">What error(s) do you get when you try to run your f5rancid?
Where does it fail if you debug your f5login?
-lance
</pre>
<blockquote type="cite">
<pre wrap="">-------- Original Message --------
Subject: [rancid] F5 load balancer support
From: Sam Munzani <a class="moz-txt-link-rfc2396E" href="mailto:smunzani@comcast.net"><smunzani@comcast.net></a>
Date: Fri, July 13, 2007 12:45 pm
To: <a class="moz-txt-link-abbreviated" href="mailto:rancid-discuss@shrubbery.net">rancid-discuss@shrubbery.net</a>
Hi,
Did anybody happened to hack one of Cisco scripts to support
</pre>
</blockquote>
</blockquote>
</blockquote>
<pre wrap="">BigIP F5
</pre>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">boxes? It should be pretty simple. All I want to do is login and
</pre>
</blockquote>
</blockquote>
<pre wrap="">type "b
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">list" which is equivalent of "show run" on cisco.
However for some reason things not working. All I did was copied
</pre>
</blockquote>
</blockquote>
<pre wrap="">clogin
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">to f5login, copied rancid to f5rancid and added following to
</pre>
</blockquote>
</blockquote>
<pre wrap="">rancid-fe.
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">elsif ($vendor =~ /^f5$/i) { exec('f5rancid',
</pre>
</blockquote>
</blockquote>
</blockquote>
<pre wrap="">$router); }
</pre>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">Then modified f5 rancid file and kept only one command in list of
commands "b list".
For some reason its not working. I can post my configs here if
</pre>
</blockquote>
</blockquote>
<pre wrap="">somebody
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">like to see them.
Thanks,
Sam
_______________________________________________
Rancid-discuss mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Rancid-discuss@shrubbery.net">Rancid-discuss@shrubbery.net</a>
<a class="moz-txt-link-freetext" href="http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss">http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss</a>
</pre>
</blockquote>
<pre wrap="">
</pre>
</blockquote>
</blockquote>
<pre wrap="">_______________________________________________
Rancid-discuss mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Rancid-discuss@shrubbery.net">Rancid-discuss@shrubbery.net</a>
<a class="moz-txt-link-freetext" href="http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss">http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss</a>
</pre>
</blockquote>
</blockquote>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>