From heas at shrubbery.net Tue Apr 3 18:13:40 2018 From: heas at shrubbery.net (heasley) Date: Tue, 3 Apr 2018 18:13:40 +0000 Subject: [rancid] fortigate login Message-ID: <20180403181339.GH59894@shrubbery.net> A user recently reported a problem with fnlogin to a Fortigate device. While they have reported the changes to fnlogin are working for them, I'd welcome confirmation from other users. The problem was primarily in the initial prompt matching. http://rancid.shrubbery.net/rancid/svn/rancid/trunk/rancid/bin/fnlogin.in OR ftp://ftp.shrubbery.net/pub/rancid/alpha/rancid-3.99.99.tar.gz tia. From ak.sn.201712 at gmail.com Wed Apr 4 12:21:23 2018 From: ak.sn.201712 at gmail.com (Ak Sn) Date: Wed, 4 Apr 2018 14:21:23 +0200 Subject: [rancid] fortigate problem Message-ID: Hi List, I'm running rancid 3.7 on ubuntu and try to backup ny fortinet fortigate firewall-devices. It worked with the previous version but now I'm stuck at the prompt of the fortigate where I'm not able to execute any commands. I'm then running into timeouts: root at rancidhost:/var/lib/rancid/bin# sudo -Hu rancid /var/lib/rancid/bin/fnlogin -c 'get sys status' fortigate-1 fortigate-1 spawn ssh -c 3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr -x -l rancid fortigate-1 rancid at fortigate-1's password: ebnfwa01-1 $ ebnfwa01-1 $ config global ebnfwa01-1 (global) $ Error: TIMEOUT reached root at rancidhost:/var/lib/rancid/bin# In the logs is the following: Trying to get all of the configs. fortigate-1 missed cmd(s): all commands fortigate-1 End of run not found fortigate-1 fnlogin error: Error: TIMEOUT reached If I try it with rancid in debugging mode, I get the following: root at rancidhost:/var/lib/rancid/bin# su - rancid -c "/var/lib/rancid/bin/rancid -d -t fortigate fortigate-1" loadtype: device type fortigate loadtype: found device type fortigate in /etc/rancid/rancid.types.base executing fnlogin -t 90 -c"" fortigate-1 inloop is not configured for device type fortigate at /var/lib/rancid/bin/rancid line 136. sh: 1: fnlogin: not found Any help or hint is much appreciated! I'd like to avoid downgrading. Alex -------------- next part -------------- An HTML attachment was scrubbed... URL: From natxo.asenjo at gmail.com Thu Apr 5 06:21:28 2018 From: natxo.asenjo at gmail.com (Natxo Asenjo) Date: Thu, 5 Apr 2018 08:21:28 +0200 Subject: [rancid] fortigate fnlogin problem (and a workaround) Message-ID: hi, I have a working installation of rancid (3.6.2) running on Ubuntu 16.04 and I need to migrate the application to Centos 7. So I decided to upgrade rancid as well to version 3.7. The fortigate fnlogin scripts of 3.7 is not working properly with our fortinets (we do not have a lot of them, but the ones we have give a timeout. 3.6.2 working: ## $Id: fnlogin.in 3519 2016-12-01 00:23:58Z heas $ 3.7 not working ## $Id: fnlogin.in 3718 2017-07-20 17:14:42Z heas $ This is a piece of the log: starting: Thu Apr 5 07:50:42 CEST 2018 Trying to get all of the configs. 94.142.211.65: missed cmd(s): all commands 94.142.211.65: End of run not found 94.142.211.65 fnlogin error: Error: TIMEOUT reached ===================================== Getting missed routers: round 1. xx.xx.xx.xx: missed cmd(s): all commands xx.xx.xx.xx: End of run not found xx.xx.xx.xx fnlogin error: Error: TIMEOUT reached If I replace fnlogin in the centos box (3.7) with the one in 3.6.2, everything works great. The fortinet is: #Version: FortiGate-600D v5.2.11,build0754,170421 (GA) not running the latest firmware, but wil do soon. For us this is not a problem as it's working, but maybe someone else could find this interesting to know. -- Groeten, natxo -------------- next part -------------- An HTML attachment was scrubbed... URL: From ak.sn.201712 at gmail.com Thu Apr 5 09:00:30 2018 From: ak.sn.201712 at gmail.com (Ak Sn) Date: Thu, 5 Apr 2018 11:00:30 +0200 Subject: [rancid] fortigate fnlogin problem (and a workaround) In-Reply-To: References: Message-ID: Hi I had the same error. See the message http://www.shrubbery.net/pipermail/rancid-discuss/2018-April/010180.html from heasly rancid 3.7 and the changed fnlogin file from 3.99 works perfect in my setup! ftp://ftp.shrubbery.net/pub/rancid/alpha/rancid-3.99.99.tar.gz BR Alex 2018-04-05 8:21 GMT+02:00 Natxo Asenjo : > hi, > > I have a working installation of rancid (3.6.2) running on Ubuntu 16.04 > and I need to migrate the application to Centos 7. > > So I decided to upgrade rancid as well to version 3.7. > > The fortigate fnlogin scripts of 3.7 is not working properly with our > fortinets (we do not have a lot of them, but the ones we have give a > timeout. > > 3.6.2 working: > ## $Id: fnlogin.in 3519 2016-12-01 00:23:58Z heas $ > > 3.7 not working > ## $Id: fnlogin.in 3718 2017-07-20 17:14:42Z heas $ > > > This is a piece of the log: > > starting: Thu Apr 5 07:50:42 CEST 2018 > > > > Trying to get all of the configs. > 94.142.211.65: missed cmd(s): all commands > 94.142.211.65: End of run not found > 94.142.211.65 fnlogin error: Error: TIMEOUT reached > > ===================================== > Getting missed routers: round 1. > xx.xx.xx.xx: missed cmd(s): all commands > xx.xx.xx.xx: End of run not found > xx.xx.xx.xx fnlogin error: Error: TIMEOUT reached > > > If I replace fnlogin in the centos box (3.7) with the one in 3.6.2, > everything works great. > > The fortinet is: > > #Version: FortiGate-600D v5.2.11,build0754,170421 (GA) > > not running the latest firmware, but wil do soon. > > For us this is not a problem as it's working, but maybe someone else could > find this interesting to know. > > -- > Groeten, > natxo > > _______________________________________________ > Rancid-discuss mailing list > Rancid-discuss at shrubbery.net > http://www.shrubbery.net/mailman/listinfo/rancid-discuss > -------------- next part -------------- An HTML attachment was scrubbed... URL: From heas at shrubbery.net Thu Apr 5 15:20:45 2018 From: heas at shrubbery.net (heasley) Date: Thu, 5 Apr 2018 15:20:45 +0000 Subject: [rancid] fortigate fnlogin problem (and a workaround) In-Reply-To: References: Message-ID: <20180405152045.GD53891@shrubbery.net> Thu, Apr 05, 2018 at 11:00:30AM +0200, Ak Sn: > Hi > > I had the same error. See the message > http://www.shrubbery.net/pipermail/rancid-discuss/2018-April/010180.html > from heasly > rancid 3.7 and the changed fnlogin file from 3.99 works perfect in my setup! > > ftp://ftp.shrubbery.net/pub/rancid/alpha/rancid-3.99.99.tar.gz Sorry; this will be 3.8 soonish. i have 2 things remaining to fix/add before cutting 3.8. From natxo.asenjo at gmail.com Thu Apr 5 13:24:40 2018 From: natxo.asenjo at gmail.com (Natxo Asenjo) Date: Thu, 5 Apr 2018 15:24:40 +0200 Subject: [rancid] fortigate fnlogin problem (and a workaround) In-Reply-To: References: Message-ID: On Thu, Apr 5, 2018 at 11:00 AM, Ak Sn wrote: > Hi > > I had the same error. See the message http://www.shrubbery.net/ > pipermail/rancid-discuss/2018-April/010180.html from heasly > rancid 3.7 and the changed fnlogin file from 3.99 works perfect in my > setup! > > ftp://ftp.shrubbery.net/pub/rancid/alpha/rancid-3.99.99.tar.gz > Awesome, thanks for the link. I was no longer on the list, so I missed that message ;-) -- regards, Natxo -------------- next part -------------- An HTML attachment was scrubbed... URL: From cgauthier at comscore.com Thu Apr 5 17:55:57 2018 From: cgauthier at comscore.com (Gauthier, Chris) Date: Thu, 5 Apr 2018 17:55:57 +0000 Subject: [rancid] Questions about sub ProcessHistory Message-ID: <21E12EC1-11CC-496A-BE4B-29853A770152@comscore.com> I?m trying to get my Aruba Instant access points to be backed up by rancid and I?m using the module developed by miken32, but it really doesn?t support a lot of the Aruba stuff that I have. I?m trying to add a few extra functions into the perl module, but have run into some difficulty with `sub ProcessHistory` in rancid.pm. I?ve read the description, but am not understanding the third argument. For example: ProcessHistory("COMMENTS","keysort","D99","!$_"); (from the aruba.pm file) Or ProcessHistory("COMMENTS","keysort","F1", "!Image: $_") (from the ios.pm file) What is the function of the ?D99? and ?F1? arguments and how do I leverage them for my own function? And, what is the string in the last argument used for? Thanks, Chris Chris Gauthier Senior Network Engineer | comScore, Inc. t +1 (503) 331-2704 | cgauthier at comscore.com 317 SW Alder Street, Suite 700 | Portland, OR 97204 United States comscore.com ???This e-mail (including any attachments) may contain information that is private, confidential, or protected by attorney-client or other privilege. If you received this e-mail in error, please delete it from your system and notify sender. -------------- next part -------------- An HTML attachment was scrubbed... URL: From heas at shrubbery.net Thu Apr 5 19:52:35 2018 From: heas at shrubbery.net (heasley) Date: Thu, 5 Apr 2018 19:52:35 +0000 Subject: [rancid] Questions about sub ProcessHistory In-Reply-To: <21E12EC1-11CC-496A-BE4B-29853A770152@comscore.com> References: <21E12EC1-11CC-496A-BE4B-29853A770152@comscore.com> Message-ID: <20180405195235.GA45401@shrubbery.net> Thu, Apr 05, 2018 at 05:55:57PM +0000, Gauthier, Chris: > I?m trying to get my Aruba Instant access points to be backed up by rancid and I?m using the module developed by miken32, but it really doesn?t support a lot of the Aruba stuff that I have. I?m trying to add a few extra functions into the perl module, but have run into some difficulty with `sub ProcessHistory` in rancid.pm. I?ve read the description, but am not understanding the third argument. > > For example: > ProcessHistory("COMMENTS","keysort","D99","!$_"); (from the aruba.pm file) > > Or > > ProcessHistory("COMMENTS","keysort","F1", "!Image: $_") (from the ios.pm file) > > What is the function of the ?D99? and ?F1? arguments and how do I leverage them for my own function? And, what is the string in the last argument used for? 3rd arg is the argument to the 2nd arg, for keysort, its the key. 4th arg is data/payload to be stored and later output. From cgauthier at comscore.com Thu Apr 5 20:18:57 2018 From: cgauthier at comscore.com (Gauthier, Chris) Date: Thu, 5 Apr 2018 20:18:57 +0000 Subject: [rancid] Questions about sub ProcessHistory In-Reply-To: <20180405195235.GA45401@shrubbery.net> References: <21E12EC1-11CC-496A-BE4B-29853A770152@comscore.com> <20180405195235.GA45401@shrubbery.net> Message-ID: Thanks, That helps, but does not completely help me understand what values are "valid" in the 3rd arg. I couldn't quite figure it out from the code. I tried. I looked at the man page, different sections of the source, but it's just not making sense. And, sorry all for always adding the corporate signature. Have no control over it, including no ability to change it or turn it off. The worst part is it always turns my email from plain-text to HTML. :( Chris ? Chris Gauthier Senior Network Engineer | comScore, Inc. t +1 (503) 331-2704 | cgauthier at comscore.com 317 SW Alder Street, Suite 700 | Portland, OR 97204 United States comscore.com ???This e-mail (including any attachments) may contain information that is private, confidential, or protected by attorney-client or other privilege. If you received this e-mail in error, please delete it from your system and notify sender. -----Original Message----- From: heasley Date: Thursday, April 5, 2018 at 12:53 PM To: "Gauthier, Chris" Cc: "rancid-discuss at shrubbery.net" Subject: Re: [rancid] Questions about sub ProcessHistory Thu, Apr 05, 2018 at 05:55:57PM +0000, Gauthier, Chris: > I?m trying to get my Aruba Instant access points to be backed up by rancid and I?m using the module developed by miken32, but it really doesn?t support a lot of the Aruba stuff that I have. I?m trying to add a few extra functions into the perl module, but have run into some difficulty with `sub ProcessHistory` in rancid.pm. I?ve read the description, but am not understanding the third argument. > > For example: > ProcessHistory("COMMENTS","keysort","D99","!$_"); (from the aruba.pm file) > > Or > > ProcessHistory("COMMENTS","keysort","F1", "!Image: $_") (from the ios.pm file) > > What is the function of the ?D99? and ?F1? arguments and how do I leverage them for my own function? And, what is the string in the last argument used for? 3rd arg is the argument to the 2nd arg, for keysort, its the key. 4th arg is data/payload to be stored and later output. -------------- next part -------------- An HTML attachment was scrubbed... URL: From heas at shrubbery.net Thu Apr 5 20:57:56 2018 From: heas at shrubbery.net (heasley) Date: Thu, 5 Apr 2018 20:57:56 +0000 Subject: [rancid] Questions about sub ProcessHistory In-Reply-To: References: <21E12EC1-11CC-496A-BE4B-29853A770152@comscore.com> <20180405195235.GA45401@shrubbery.net> Message-ID: <20180405205756.GD45401@shrubbery.net> Thu, Apr 05, 2018 at 08:18:57PM +0000, Gauthier, Chris: > That helps, but does not completely help me understand what values are "valid" in the 3rd arg. I couldn't quite figure it out from the code. I tried. I looked at the man page, different sections of the source, but it's just not making sense. a string; a number should also work but with keynsort. From cgauthier at comscore.com Thu Apr 5 21:59:23 2018 From: cgauthier at comscore.com (Gauthier, Chris) Date: Thu, 5 Apr 2018 21:59:23 +0000 Subject: [rancid] Questions about sub ProcessHistory In-Reply-To: <20180405205756.GD45401@shrubbery.net> References: <21E12EC1-11CC-496A-BE4B-29853A770152@comscore.com> <20180405195235.GA45401@shrubbery.net> <20180405205756.GD45401@shrubbery.net> Message-ID: So, more specifically, how is that string used as an argument? What's the significance of the "D99" or the "F1" or whatever the other value is? That's the part I'm not sure about. I want to leverage the ProcessHistory function with the keysort, but don't know what the argument value should be or how I determine what it should be. Thanks, Chris ? Chris Gauthier Senior Network Engineer | comScore, Inc. t +1 (503) 331-2704 | cgauthier at comscore.com 317 SW Alder Street, Suite 700 | Portland, OR 97204 United States comscore.com ???This e-mail (including any attachments) may contain information that is private, confidential, or protected by attorney-client or other privilege. If you received this e-mail in error, please delete it from your system and notify sender. -----Original Message----- From: heasley Date: Thursday, April 5, 2018 at 1:58 PM To: "Gauthier, Chris" Cc: heasley , "rancid-discuss at shrubbery.net" Subject: Re: [rancid] Questions about sub ProcessHistory Thu, Apr 05, 2018 at 08:18:57PM +0000, Gauthier, Chris: > That helps, but does not completely help me understand what values are "valid" in the 3rd arg. I couldn't quite figure it out from the code. I tried. I looked at the man page, different sections of the source, but it's just not making sense. a string; a number should also work but with keynsort. -------------- next part -------------- An HTML attachment was scrubbed... URL: From heas at shrubbery.net Thu Apr 5 23:15:10 2018 From: heas at shrubbery.net (heasley) Date: Thu, 5 Apr 2018 23:15:10 +0000 Subject: [rancid] Questions about sub ProcessHistory In-Reply-To: References: <21E12EC1-11CC-496A-BE4B-29853A770152@comscore.com> <20180405195235.GA45401@shrubbery.net> <20180405205756.GD45401@shrubbery.net> Message-ID: <20180405231510.GG45401@shrubbery.net> Thu, Apr 05, 2018 at 09:59:23PM +0000, Gauthier, Chris: > So, more specifically, how is that string used as an argument? What's the significance of the "D99" or the "F1" or whatever the other value is? That's the part I'm not sure about. I want to leverage the ProcessHistory function with the keysort, but don't know what the argument value should be or how I determine what it should be. its the sort key. what _is_ sorted. > Thanks, > Chris > > > ? > Chris Gauthier Senior Network Engineer | comScore, Inc. > t +1 (503) 331-2704 | > cgauthier at comscore.com > 317 SW Alder Street, Suite 700 | Portland, OR 97204 United States > comscore.com > ???This e-mail (including any attachments) may contain information that is private, confidential, or protected by attorney-client or other privilege. If you received this e-mail in error, please delete it from your system and notify sender. > -----Original Message----- > From: heasley > Date: Thursday, April 5, 2018 at 1:58 PM > To: "Gauthier, Chris" > Cc: heasley , "rancid-discuss at shrubbery.net" > Subject: Re: [rancid] Questions about sub ProcessHistory > > Thu, Apr 05, 2018 at 08:18:57PM +0000, Gauthier, Chris: > > That helps, but does not completely help me understand what values are "valid" in the 3rd arg. I couldn't quite figure it out from the code. I tried. I looked at the man page, different sections of the source, but it's just not making sense. > > a string; a number should also work but with keynsort. > From ler762 at gmail.com Thu Apr 5 23:44:49 2018 From: ler762 at gmail.com (Lee) Date: Thu, 5 Apr 2018 19:44:49 -0400 Subject: [rancid] Questions about sub ProcessHistory In-Reply-To: References: <21E12EC1-11CC-496A-BE4B-29853A770152@comscore.com> <20180405195235.GA45401@shrubbery.net> <20180405205756.GD45401@shrubbery.net> Message-ID: On 4/5/18, Gauthier, Chris wrote: > So, more specifically, how is that string used as an argument? What's the > significance of the "D99" or the "F1" or whatever the other value is? > That's the part I'm not sure about. I want to leverage the ProcessHistory > function with the keysort, but don't know what the argument value should be > or how I determine what it should be. I remember seeing a better explanation but this was the best I could find: ---------- Forwarded message ---------- From: john heasley Date: Tue, 28 Sep 2010 15:28:01 -0700 Subject: Re: [rancid] sorting output from custom commands... ProcessHistory(tag, command, command_arg, data) data is added the buffer, by command with command_arg (if specified), unless tag or command has changed since the last call, in which case the buffer would be flushed before calling command. a good example, where $aclsort = "ipsort" (the function) # order access-lists /^access-list\s+(\d\d?)\s+(\S+)\s+(\S+)/ && ProcessHistory("ACL $1 $2","$aclsort","$3","$_") && next; From sathish.i at ctrls.in Sun Apr 8 18:46:26 2018 From: sathish.i at ctrls.in (Sathish Kumar. Ippani) Date: Sun, 8 Apr 2018 18:46:26 +0000 Subject: [rancid] RANCID-Permission denied, please try again. Message-ID: Hi All, I have recently installed Rancid and added device. But when I try run ""/usr/local/rancid/bin/clogin"" I am getting Permission denied, please try again and Error: Check your passwd. But I am able to ssh same device with same logins, which I have configured in /home/rancid/.cloginrc. Could you please suggest where I have done mistake. Thanks, Sathish Ippani Network Team CtrlS is India's First and Asia's largest Tier 4 Datacenter operating across India, USA, and UAE Follow us on [Description: Description: Description: Description: Description: Description: Description: Description: http://www.ctrls.com/email-signature/images/linkedin.jpg] [Description: Description: Description: Description: Description: Description: Description: Description: http://www.ctrls.com/email-signature/images/twitter.jpg] [Description: Description: Description: Description: Description: Description: Description: Description: http://www.ctrls.com/email-signature/images/facebook.jpg] [Description: Description: Description: Description: Description: Description: Description: Description: Ctrls] CtrlS Datacenters Ltd 16,Software Units Layout, Madapur (HitechCity), Hyderabad 500081, Telangana, India Mob: +91 9515600544 Tel : +91 (40) 46474747 Ext 2592 Fax : +91 (40) 23116055 ________________________________ Disclaimer: The contents of this e-mail message and any attachments are confidential and are intended solely for the addressee. If you have received this transmission in error, please immediately notify the sender by return e-mail and delete this message and its attachments. Any unauthorized use, copying or dissemination of this transmission is prohibited. Neither the confidentiality nor the integrity of this message can be vouched for following transmission on the Internet. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.png Type: image/png Size: 40700 bytes Desc: image001.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image002.jpg Type: image/jpeg Size: 1297 bytes Desc: image002.jpg URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image003.jpg Type: image/jpeg Size: 1291 bytes Desc: image003.jpg URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image004.jpg Type: image/jpeg Size: 1290 bytes Desc: image004.jpg URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image005.jpg Type: image/jpeg Size: 659 bytes Desc: image005.jpg URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image006.jpg Type: image/jpeg Size: 21350 bytes Desc: image006.jpg URL: From heas at shrubbery.net Sun Apr 8 20:36:59 2018 From: heas at shrubbery.net (heasley) Date: Sun, 8 Apr 2018 20:36:59 +0000 Subject: [rancid] RANCID-Permission denied, please try again. In-Reply-To: References: Message-ID: <20180408203658.GC1676@shrubbery.net> Sun, Apr 08, 2018 at 06:46:26PM +0000, Sathish Kumar. Ippani: > > Hi All, > > I have recently installed Rancid and added device. But when I try run ""/usr/local/rancid/bin/clogin"" I am getting Permission denied, please try again and Error: Check your passwd. > But I am able to ssh same device with same logins, which I have configured in /home/rancid/.cloginrc. > > Could you please suggest where I have done mistake. see cloginrc(1) [Mm] options and the FAQ section 3 Q2.. From on at LEFerguson.com Mon Apr 9 00:55:11 2018 From: on at LEFerguson.com (on at LEFerguson.com) Date: Mon, 9 Apr 2018 00:55:11 +0000 Subject: [rancid] DLink and End of Run Found Message-ID: I have a bunch of old DLinks and have been working to find a way to monitor changes. I saw some past mail list notes on DLInk's, and I see the DLLOGIN and Dell.pm modules, that have some support. I could not get them to work in any straightforward way, so I spent a bit of time changing them, ending up splitting into two variations (e.g. " show running-config" (I used the type "mydlink" for those) vs "show config current_config" (I used dell) seemed a good dividing line). Lots of little stuff, disabling paging had different commands, even exit vs logout. I got them to work with a ton of kludges, and feel like I may have just missed something, as there are enough old DLinks out there I would expect a lot more chatter if they did not work. Was I missing something? For context, I'm attaching the patches I did. Caveat -- I have ONLY old DLINk's, so I may well have broken it for newer ones, and I am not suggesting these as corrections to the real rancid, but rather in case someone notices the issues and tells me the "right" way to fix it, or where the better support may already be in there. What bothered me about these most were minor things that were hard to fathom, like anchors at line end that wouldn't work as prompts almost all had a trailing space, or some prompts with escape sequences in them (I just hard coded removal of one such). It made me think there was no way these routines could work with these switches, so either there are other modules, or... well, as I said these are really old. I think spacing is a bit confused in these from tab expansion. This is against 3.7. Anyway... some code if it's ever useful to anyone, and I would welcome if there are better ways. I'm an awful perl programmer, in addition. Linwood $ diff -u /home/lferguson/rancid-3.7/lib/dell.pm lib/rancid/dell.pm --- /home/lferguson/rancid-3.7/lib/dell.pm 2018-03-03 20:30:16.689052000 -0600 +++ lib/rancid/dell.pm 2018-04-08 19:37:44.435813129 -0500 @@ -108,8 +108,9 @@ TOP: while(<$INPUT>) { tr/\015//d; - # XXX this match is not correct for DELL - if (/[>#]\s?exit$/) { + # XXX this match is not correct for DELL + ### LEF Patch add logout, and add colon + if ( (/[:>#]\s?(exit|logout)/) || (scalar(keys %commands) == 0) ) { ### LEF Patch - sometims logout doesn't show the final prompt+command, so just quit if all commands done $clean_run = 1; last; } @@ -119,12 +120,10 @@ $clean_run = 0; last; } - while (/^.+(#|\$)\s*($cmds_regexp)\s*$/) { - $cmd = $2; - # - D-Link prompts end with '#'. - if ($_ =~ m/^.+#/) { - $prompt = '.+#.*'; - } + while (/^(.+(#|\$)\s*)($cmds_regexp)\s*$/) { ## LEF patch grab full prompt at same time (next two lines differ also) and get rid of garbage some switches add + $cmd = $3; + $prompt = $1; + $prompt =~ s/\x1b\x5b\x4b//d; print STDERR ("HIT COMMAND:$_") if ($debug); if (! defined($commands{$cmd})) { print STDERR "$host: found unexpected command - \"$cmd\"\n"; @@ -145,6 +144,7 @@ } } } + return 0; ## LEF Patch - there were cases where this exited and caused an error and failure of the file, added 0 return } # This routine parses "get system" @@ -156,8 +156,9 @@ tr/\015//d; next if /^\s*$/; last if (/$prompt/); - - next if (/^system up time:/i); + ## LEF Patch - don't require it be tied to start of line (some have # prefi), and do two differet spelling of up/time. + next if (/system up time/i); + next if (/system uptime/i); #next if (/^\s*Virus-DB: .*/); #next if (/^\s*Extended DB: .*/); #next if (/^\s*IPS-DB: .*/); @@ -188,7 +189,7 @@ tr/\015//d; next if /^\s*$/; last if (/$prompt/); - + last if (/Connection\ closed/); # filter variabilities between configurations. password encryption # upon each display of the configuration. #if (/^\s*(set [^\s]*)\s(Enc\s[^\s]+)(.*)/i && $filter_pwds > 0 ) { $ diff -u /home/lferguson/rancid-3.7/bin/dllogin bin/dllogin --ignore-all-space --- /home/lferguson/rancid-3.7/bin/dllogin 2018-03-03 20:30:08.365052000 -0600 +++ bin/dllogin 2018-04-08 18:47:44.971940858 -0500 @@ -550,7 +550,7 @@ send_user "\nError: Check your passwd for $router\n"; catch {close}; catch {wait}; return 1 } - -re "\[Uu]ser\[nN]ame:" { + -re "\[Uu]ser\[ ]?\[nN]ame:" { sleep 1; send -- "$user\r" set uprompt_seen 1 @@ -585,7 +585,9 @@ # Disable output paging. send -- "disable clipaging\r" expect -re $prompt; - + ### LEF patch - older DLinks use this instead (errors just get ignored in this section so just send both) + send -- "terminal datadump\n" + expect -re $prompt; # handle escaped ;s in commands, and ;; and ^; regsub -all {([^\\]);;} $command "\\1;\u002;" esccommand regsub {^;} $esccommand "\u002;" command @@ -594,6 +596,7 @@ set sep "\u001" set commands [split $esccommand $sep] set num_commands [llength $commands] + for {set i 0} {$i < $num_commands} { incr i} { send -- "[subst [lindex $commands $i]]\r" # send_user "**************** [subst [lindex $commands $i]] ************\n" @@ -609,9 +612,11 @@ } # send_user "******* fuori da ciclo for *******\n" expect { - -re "$prompt$" { + -re "$prompt" { ## LEF Patch - this was previously just logout but some dlinks require exit (or maybe it was vice versa), just send both in case send "logout\r" sleep 0.5 + send "exit\r" + sleep 0.5 exp_continue } -re "\[\n\r]+" { exp_continue } $ diff -u /home/lferguson/rancid-3.7/etc/rancid.types.conf etc/rancid.types.conf --- /home/lferguson/rancid-3.7/etc/rancid.types.conf 2016-10-31 12:42:00.000000000 -0500 +++ etc/rancid.types.conf 2018-04-07 20:34:11.284974936 -0500 @@ -35,6 +35,15 @@ # save copies in rancid of configs from /tftpboot tftpcopy;script;rtftpcopy # +#based on DELL (which kind of works for DLink) but for some older DLinks +mydlink;script;rancid -t mydlink +mydlink;login;dllogin +mydlink;timeout;300 +mydlink;module;dell +mydlink;inloop;dell::inloop +mydlink;command;dell::GetSystem;show system +mydlink;command;dell::GetConf;show running-config +# -------------- next part -------------- An HTML attachment was scrubbed... URL: From lauri.haveri at alsocloudsolutions.fi Sat Apr 21 10:48:42 2018 From: lauri.haveri at alsocloudsolutions.fi (Lauri Haveri) Date: Sat, 21 Apr 2018 10:48:42 +0000 Subject: [rancid] Error when trying to back up a JunOS device, SRX100 In-Reply-To: <4FBAFC2ECF5D6244BA4A26C1C94A1E270D6B1331AF@exchange> References: <582251F8-A1B3-4A70-9E1B-79F2C9BD2877@shrubbery.net> <4FBAFC2ECF5D6244BA4A26C1C94A1E270D6B1331AF@exchange> Message-ID: <1dd1e2b7708d450b96f98167c905117a@alsocloudsolutions.fi> Hello, I just wanted to tell that little over one week ago I was able to fix this error by using an account that had admin-rights. The ones I used previously were root-account and read-only account. Now the same problem is facing me with a ?HP procurve 2510?. I have assigned an account with manager-rights and configured it to .cloginrc file. I am able to login to the HP Switch by using command ?/var/lib/rancid/bin/clogin DEVICENAME? Do you have any idea if there are any special things to be considered in HP Switches? Best regards, Lauri From: Emille Blanc Sent: torstai 22. maaliskuuta 2018 2.13 To: Heasley ; Lauri Haveri Cc: Rancid-discuss at shrubbery.net Subject: RE: [rancid] Error when trying to back up a JunOS device, SRX100 I've had no problems with our lonely SRX100b, in any versions of RANCID 3.x, up to and including 3.7. The SRX is running 12.1X46-D55.3 From: Rancid-discuss [mailto:rancid-discuss-bounces at shrubbery.net] On Behalf Of Heasley Sent: March-21-18 2:15 PM To: Lauri Haveri Cc: Rancid-discuss at shrubbery.net Subject: Re: [rancid] Error when trying to back up a JunOS device, SRX100 Am 21.03.2018 um 20:43 schrieb Lauri Haveri >: Hello all, I am setting up a test enviroment on Ubuntu 16.04 before Rancid will go to a production enviroment. Everytime I run Rancid I get the following error: ?Use of uninitialized value $_ in pattern match (m//) at /usr/share/perl5/rancid/junos.pm line 135 Use of uninitialized value $_ in pattern match (m//) at /usr/share/perl5/rancid/junos.pm line 140 00003-test-fw01: missed cmd(s): show configuration, show version invoke-on other-routing-engine, show system core-dumps, show version detail 00003-test-fw01: End of run not foud # Error: TIMEOUT reached? When I go the the part that the log (/usr/share/perl5/rancid/junos.pm) tells me, the part is following: ?$rval = {$commands{$cmd}}{$INPUT, $OUTPUT, $cmd}; delete($commands{$cmd}); if {$rval == -1} { // this is the line 135 $clean_run = 0; last TOP; } if (/>\s*quit/){ // this is line 140 $clean_run=1; last; }? The command I am using to run Rancid is: ?sudo su -c /var/lib/rancid/bin/rancid-run -s /bin/bash -l rancid? Could you please help me? You havent told us what version of rancid nor from where you retrieved it. If its not 3.7, please start there. If it already is, but it is a ubuntu package, please try an install from source. Kind regards, Lauri _______________________________________________ Rancid-discuss mailing list Rancid-discuss at shrubbery.net http://www.shrubbery.net/mailman/listinfo/rancid-discuss -------------- next part -------------- An HTML attachment was scrubbed... URL: From heas at shrubbery.net Sat Apr 21 15:44:07 2018 From: heas at shrubbery.net (Heasley) Date: Sat, 21 Apr 2018 15:44:07 +0000 Subject: [rancid] Error when trying to back up a JunOS device, SRX100 In-Reply-To: <1dd1e2b7708d450b96f98167c905117a@alsocloudsolutions.fi> References: <582251F8-A1B3-4A70-9E1B-79F2C9BD2877@shrubbery.net> <4FBAFC2ECF5D6244BA4A26C1C94A1E270D6B1331AF@exchange> <1dd1e2b7708d450b96f98167c905117a@alsocloudsolutions.fi> Message-ID: <20180421154406.GD49772@shrubbery.net> Sat, Apr 21, 2018 at 10:48:42AM +0000, Lauri Haveri: > Hello, > > I just wanted to tell that little over one week ago I was able to fix this error by using an account that had admin-rights. The ones I used previously were root-account and read-only account. the root account typically receives a unix prompt, which the scripts do not expect. > Now the same problem is facing me with a ?HP procurve 2510?. I have assigned an account with manager-rights and configured it to .cloginrc file. I am able to login to the HP Switch by using command ?/var/lib/rancid/bin/clogin DEVICENAME? > > Do you have any idea if there are any special things to be considered in HP Switches? rancid -t hp -C hostname will give you the complete command that rancid will run; use that for testing. Also, see the FAQ section 3 qestion 2. From lauri.haveri at alsocloudsolutions.fi Wed Apr 25 15:28:03 2018 From: lauri.haveri at alsocloudsolutions.fi (Lauri Haveri) Date: Wed, 25 Apr 2018 15:28:03 +0000 Subject: [rancid] Error when trying to back up a JunOS device, SRX100 In-Reply-To: <20180421154406.GD49772@shrubbery.net> References: <582251F8-A1B3-4A70-9E1B-79F2C9BD2877@shrubbery.net> <4FBAFC2ECF5D6244BA4A26C1C94A1E270D6B1331AF@exchange> <1dd1e2b7708d450b96f98167c905117a@alsocloudsolutions.fi> <20180421154406.GD49772@shrubbery.net> Message-ID: <29fdeeed30364875afce4ebd65b45782@alsocloudsolutions.fi> Thank you for the fast reply. Where should the command "rancid" be executed? I have logged in as the users "rancid" and "root" have ran the command "rancid -t hp -C DEVICENAME" in the folder ("/var/lib/rancid/bin/") that has the executable file "rancid", but it just produces "rancid: command not found". I also typed the whole path to command "/var/lib/rancid/bin/rancid -t hp -C hostname" I just get the following output: "hlogin -t 90 -c '' DEVICENAME. Am I doing it wrong? BR, Lauri -----Original Message----- From: Heasley Sent: lauantai 21. huhtikuuta 2018 18.44 To: Lauri Haveri Cc: Emille Blanc ; Rancid-discuss at shrubbery.net Subject: Re: [rancid] Error when trying to back up a JunOS device, SRX100 Sat, Apr 21, 2018 at 10:48:42AM +0000, Lauri Haveri: > Hello, > > I just wanted to tell that little over one week ago I was able to fix this error by using an account that had admin-rights. The ones I used previously were root-account and read-only account. the root account typically receives a unix prompt, which the scripts do not expect. > Now the same problem is facing me with a ?HP procurve 2510?. I have assigned an account with manager-rights and configured it to .cloginrc file. I am able to login to the HP Switch by using command ?/var/lib/rancid/bin/clogin DEVICENAME? > > Do you have any idea if there are any special things to be considered in HP Switches? rancid -t hp -C hostname will give you the complete command that rancid will run; use that for testing. Also, see the FAQ section 3 qestion 2. From heas at shrubbery.net Wed Apr 25 16:11:30 2018 From: heas at shrubbery.net (Heasley) Date: Wed, 25 Apr 2018 16:11:30 +0000 Subject: [rancid] Error when trying to back up a JunOS device, SRX100 In-Reply-To: <29fdeeed30364875afce4ebd65b45782@alsocloudsolutions.fi> References: <582251F8-A1B3-4A70-9E1B-79F2C9BD2877@shrubbery.net> <4FBAFC2ECF5D6244BA4A26C1C94A1E270D6B1331AF@exchange> <1dd1e2b7708d450b96f98167c905117a@alsocloudsolutions.fi> <20180421154406.GD49772@shrubbery.net> <29fdeeed30364875afce4ebd65b45782@alsocloudsolutions.fi> Message-ID: <20180425161130.GC37195@shrubbery.net> Wed, Apr 25, 2018 at 03:28:03PM +0000, Lauri Haveri: > Thank you for the fast reply. > > Where should the command "rancid" be executed? > > I have logged in as the users "rancid" and "root" have ran the command "rancid -t hp -C DEVICENAME" in the folder ("/var/lib/rancid/bin/") that has the executable file "rancid", but it just produces "rancid: command not found". > > I also typed the whole path to command "/var/lib/rancid/bin/rancid -t hp -C hostname" I just get the following output: "hlogin -t 90 -c '' DEVICENAME. > > Am I doing it wrong? Sorry; thats my fault; hp still uses the rancid 2.x method; so, hrancid -C hostname. > BR, > Lauri > > -----Original Message----- > From: Heasley > Sent: lauantai 21. huhtikuuta 2018 18.44 > To: Lauri Haveri > Cc: Emille Blanc ; Rancid-discuss at shrubbery.net > Subject: Re: [rancid] Error when trying to back up a JunOS device, SRX100 > > Sat, Apr 21, 2018 at 10:48:42AM +0000, Lauri Haveri: > > Hello, > > > > I just wanted to tell that little over one week ago I was able to fix this error by using an account that had admin-rights. The ones I used previously were root-account and read-only account. > > the root account typically receives a unix prompt, which the scripts do not expect. > > > Now the same problem is facing me with a ?HP procurve 2510?. I have assigned an account with manager-rights and configured it to .cloginrc file. I am able to login to the HP Switch by using command ?/var/lib/rancid/bin/clogin DEVICENAME? > > > > Do you have any idea if there are any special things to be considered in HP Switches? > > rancid -t hp -C hostname > > will give you the complete command that rancid will run; use that for testing. > Also, see the FAQ section 3 qestion 2.