Mailing List Archive

RANCID no longer working with MikroTik RouterOS 6.49 and 7.1rc3 and 7.1rc4
Hello,

I just wanted to let you know - on the MikroTik forum I am seeing reports
that RANCID is no longer working to back up RouterOS versions 6.49 and
7.1rc3 and 7.1rc4. The commands still run and there were no documented
changes to the console or SSH on the MikroTik side recently, so I'm not
sure why this is happening suddenly. I was trying to go through the code to
see what the problem might be, but could not find anything.

Please see this post for details on the error:
https://forum.mikrotik.com/viewtopic.php?p=885246#p885246

I also tried loading up the output of the working 6.48.4 vs non-working
6.49 into a hex editor to see if there were any unexpected characters being
added that might be confusing RANCID but did not find anything of note. It
looks pretty much the same to me.
Re: RANCID no longer working with MikroTik RouterOS 6.49 and 7.1rc3 and 7.1rc4 [ In reply to ]
Mon, Oct 11, 2021 at 06:28:39PM -0700, Michael Ducharme:
> Hello,
>
> I just wanted to let you know - on the MikroTik forum I am seeing reports
> that RANCID is no longer working to back up RouterOS versions 6.49 and
> 7.1rc3 and 7.1rc4. The commands still run and there were no documented
> changes to the console or SSH on the MikroTik side recently, so I'm not
> sure why this is happening suddenly. I was trying to go through the code to
> see what the problem might be, but could not find anything.
>
> Please see this post for details on the error:
> https://forum.mikrotik.com/viewtopic.php?p=885246#p885246

Care to the attached patch?

> I also tried loading up the output of the working 6.48.4 vs non-working
> 6.49 into a hex editor to see if there were any unexpected characters being
> added that might be confusing RANCID but did not find anything of note. It
> looks pretty much the same to me.

I have access to only one Mikrotik and its running an older O/S. I've
tested the patch against it.
Re: RANCID no longer working with MikroTik RouterOS 6.49 and 7.1rc3 and 7.1rc4 [ In reply to ]
Hello,

I had a look at your patch and I'm not sure that would fix the issue. Also
show-sensitive only works with v7 and above and throws an error on RouterOS
v6.

Someone on the MikroTik forums found that there is no longer a newline
being generated after the output so the regexp doesn't match and so RANCID
no longer identifies the end of the command. You can see more detail here:
https://forum.mikrotik.com/viewtopic.php?t=179233#p885616

They came up with this patch to fix it and I confirmed that it works with
RouterOS v6.49 and v7. However I haven't tested with older RouterOS
versions, and I don't know if it might break something else:

--- /usr/libexec/rancid/mtrancid-orig 2021-10-14
03:44:22.102333666 +0200+++ /usr/libexec/rancid/mtrancid
2021-10-13 07:16:22.567538444 +0200@@ -348,7 +348,7 @@
$clean_run=0;
last;
}- while (/\s*($cmds_regexp)\s*$/) {+ while
(/\s*($cmds_regexp)\s*/) {
$cmd = $1;
if (!defined($prompt)) {
$prompt = "\] > "; # crude but effective


On Fri, Oct 15, 2021 at 1:20 PM heasley <heas@shrubbery.net> wrote:

> Mon, Oct 11, 2021 at 06:28:39PM -0700, Michael Ducharme:
> > Hello,
> >
> > I just wanted to let you know - on the MikroTik forum I am seeing reports
> > that RANCID is no longer working to back up RouterOS versions 6.49 and
> > 7.1rc3 and 7.1rc4. The commands still run and there were no documented
> > changes to the console or SSH on the MikroTik side recently, so I'm not
> > sure why this is happening suddenly. I was trying to go through the code
> to
> > see what the problem might be, but could not find anything.
> >
> > Please see this post for details on the error:
> > https://forum.mikrotik.com/viewtopic.php?p=885246#p885246
>
> Care to the attached patch?
>
> > I also tried loading up the output of the working 6.48.4 vs non-working
> > 6.49 into a hex editor to see if there were any unexpected characters
> being
> > added that might be confusing RANCID but did not find anything of note.
> It
> > looks pretty much the same to me.
>
> I have access to only one Mikrotik and its running an older O/S. I've
> tested the patch against it.
>
Re: RANCID no longer working with MikroTik RouterOS 6.49 and 7.1rc3 and 7.1rc4 [ In reply to ]
Fri, Oct 15, 2021 at 01:39:18PM -0700, Michael Ducharme:
> Hello,
>
> I had a look at your patch and I'm not sure that would fix the issue. Also
> show-sensitive only works with v7 and above and throws an error on RouterOS
> v6.
>
> Someone on the MikroTik forums found that there is no longer a newline
> being generated after the output so the regexp doesn't match and so RANCID
> no longer identifies the end of the command. You can see more detail here:
> https://forum.mikrotik.com/viewtopic.php?t=179233#p885616

ah, thats a separate problem. thats fun. without looking-up that esc
code, looks like some fancy cmdline hanlding. Maybe this will avoid
that stupidity?

diff --git a/lib/routeros.pm.in b/lib/routeros.pm.in
index 3b1b7dae..4ab9730e 100644
--- a/lib/routeros.pm.in
+++ b/lib/routeros.pm.in
@@ -23,6 +23,8 @@ use rancid @VERSION@;

# load-time initialization
sub import {
+ $ENV{'TERM'} = "vt100";
+
$timeo = 90; # mtlogin timeout in seconds

0;

or "network" or "dumb", if it has either in its termcap.

> They came up with this patch to fix it and I confirmed that it works with
> RouterOS v6.49 and v7. However I haven't tested with older RouterOS
> versions, and I don't know if it might break something else:

it could match other output unintentionally - maybe.

> --- /usr/libexec/rancid/mtrancid-orig 2021-10-14
> 03:44:22.102333666 +0200+++ /usr/libexec/rancid/mtrancid
> 2021-10-13 07:16:22.567538444 +0200@@ -348,7 +348,7 @@
> $clean_run=0;
> last;
> }
> - while (/\s*($cmds_regexp)\s*$/) {
> + while (/\s*($cmds_regexp)\s*/) {
> $cmd = $1;
> if (!defined($prompt)) {
> $prompt = "\] > "; # crude but effective

_______________________________________________
Rancid-discuss mailing list
Rancid-discuss@www.shrubbery.net
https://www.shrubbery.net/mailman/listinfo/rancid-discuss
Re: RANCID no longer working with MikroTik RouterOS 6.49 and 7.1rc3 and 7.1rc4 [ In reply to ]
Hello,

Unfortunately, that does not fix it, and neither does "network" or "dumb".
Something that I might suggest is that you install the free CHR (cloud
hosted router) as a VM rather easily, as long as you have a hypervisor, and
test against that.

On Fri, Oct 15, 2021 at 1:56 PM heasley <heas@shrubbery.net> wrote:

> Fri, Oct 15, 2021 at 01:39:18PM -0700, Michael Ducharme:
> > Hello,
> >
> > I had a look at your patch and I'm not sure that would fix the issue.
> Also
> > show-sensitive only works with v7 and above and throws an error on
> RouterOS
> > v6.
> >
> > Someone on the MikroTik forums found that there is no longer a newline
> > being generated after the output so the regexp doesn't match and so
> RANCID
> > no longer identifies the end of the command. You can see more detail
> here:
> > https://forum.mikrotik.com/viewtopic.php?t=179233#p885616
>
> ah, thats a separate problem. thats fun. without looking-up that esc
> code, looks like some fancy cmdline hanlding. Maybe this will avoid
> that stupidity?
>
> diff --git a/lib/routeros.pm.in b/lib/routeros.pm.in
> index 3b1b7dae..4ab9730e 100644
> --- a/lib/routeros.pm.in
> +++ b/lib/routeros.pm.in
> @@ -23,6 +23,8 @@ use rancid @VERSION@;
>
> # load-time initialization
> sub import {
> + $ENV{'TERM'} = "vt100";
> +
> $timeo = 90; # mtlogin timeout in seconds
>
> 0;
>
> or "network" or "dumb", if it has either in its termcap.
>
> > They came up with this patch to fix it and I confirmed that it works with
> > RouterOS v6.49 and v7. However I haven't tested with older RouterOS
> > versions, and I don't know if it might break something else:
>
> it could match other output unintentionally - maybe.
>
> > --- /usr/libexec/rancid/mtrancid-orig 2021-10-14
> > 03:44:22.102333666 +0200+++ /usr/libexec/rancid/mtrancid
> > 2021-10-13 07:16:22.567538444 +0200@@ -348,7 +348,7 @@
> > $clean_run=0;
> > last;
> > }
> > - while (/\s*($cmds_regexp)\s*$/) {
> > + while (/\s*($cmds_regexp)\s*/) {
> > $cmd = $1;
> > if (!defined($prompt)) {
> > $prompt = "\] > "; # crude but effective
>
Re: RANCID no longer working with MikroTik RouterOS 6.49 and 7.1rc3 and 7.1rc4 [ In reply to ]
Sat, Oct 16, 2021 at 05:35:16PM -0700, Michael Ducharme:
> Hello,
>
> Unfortunately, that does not fix it, and neither does "network" or "dumb".
> Something that I might suggest is that you install the free CHR (cloud
> hosted router) as a VM rather easily, as long as you have a hypervisor, and
> test against that.

Does this fix the issue for you?

https://github.com/haussli/rancid/commit/fef0b6ec166ae2892e8fc6e6a3d0f2de82379c29

_______________________________________________
Rancid-discuss mailing list
Rancid-discuss@www.shrubbery.net
https://www.shrubbery.net/mailman/listinfo/rancid-discuss
Re: RANCID no longer working with MikroTik RouterOS 6.49 and 7.1rc3 and 7.1rc4 [ In reply to ]
Hello,

Yes, that fixes it.

On Thu, Nov 11, 2021 at 3:52 PM heasley <heas@shrubbery.net> wrote:

> Sat, Oct 16, 2021 at 05:35:16PM -0700, Michael Ducharme:
> > Hello,
> >
> > Unfortunately, that does not fix it, and neither does "network" or
> "dumb".
> > Something that I might suggest is that you install the free CHR (cloud
> > hosted router) as a VM rather easily, as long as you have a hypervisor,
> and
> > test against that.
>
> Does this fix the issue for you?
>
>
> https://github.com/haussli/rancid/commit/fef0b6ec166ae2892e8fc6e6a3d0f2de82379c29
>
>