Re: [rancid] Fortinet private key problem

Ugo Bellavance <[email protected]> Fri, 26 Jul 2019 09:31:41 -0400
Newsgroups gmane.network.rancid
Message-ID <CACSSk+Uz3r0bv1Rezobgxhys6UoE4TFZ9qftEt=5jKOnHb4G9A@mail.gmail.com>
--===============3688281024923678102==
Content-Type: multipart/alternative; boundary="000000000000afc146058e9590ff"

--000000000000afc146058e9590ff
Content-Type: text/plain; charset="UTF-8"

I found a fix:

In fnrancid (version 3724 2017-08-01 17:58:06Z), I had to change the regex
a bit because on my system (Fortiweb, not Fortigate), the double quote is
on another line.

I haven't been able to make it work with the new line (tried \n and \r\n)
and it didn't work so I just removed the double quote in the regex.

#               if (/^\s*-----END (RSA|ENCRYPTED) PRIVATE KEY-----"/) {
                if (/^\s*-----END (RSA|ENCRYPTED) PRIVATE KEY-----/) {

I'm not sure how future-proof this is but tips are welcome to make the
regex work with this input:


OSnA0DuUpx2/FvoFbJM9jmx=
-----END ENCRYPTED PRIVATE KEY-----
"
        unset passwd

Thanks,

On Thu, Jul 25, 2019 at 3:17 PM john heasley <[email protected]> wrote:

> Thu, Jul 25, 2019 at 02:52:42PM -0400, Ugo Bellavance:
> > Hi,
> >
> > I'm trying to get rancid to work with my Fortinet device.  It seems to
> work
> > OK, except for the fact that it doesn't collect the whole config. It
> looks
> > like it's stuck in the removal of the private key.  It stops like this:
> >
> > #        set private-key "-----BEGIN ENCRYPTED PRIVATE KEY-----
> > # <removed>
> > Connection to server.xxx.xxx closed.
> >
> > I checked the code for filter cycling RSA private keys, but I don't know
> > where would be the problem.
> >
> > Any help or suggestion would be appreciated.
>
> what version of rancid?  show us example input.  test that you can run the
> command with the login script and receive the full output.
>


-- 
Ugo Bellavance ([email protected])

--000000000000afc146058e9590ff
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>I found a fix:</div><div><br></div><div>In fnrancid (=
version 3724 2017-08-01 17:58:06Z), I had to change the regex a bit because=
 on my system (Fortiweb, not Fortigate), the double quote is on another lin=
e.</div><div><br></div><div>I haven&#39;t been able to make it work with th=
e new line (tried \n and \r\n) and it didn&#39;t work so I just removed the=
 double quote in the regex.</div><div><br></div><div># =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (/^\s*-----END (RSA|ENCRYPTED) PRIVATE KEY-=
----&quot;/) {<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 i=
f (/^\s*-----END (RSA|ENCRYPTED) PRIVATE KEY-----/) {</div><div><br></div><=
div>I&#39;m not sure how future-proof this is but tips are welcome to make =
the regex work with this input:</div><div><br></div><div><br></div><div>OSn=
A0DuUpx2/FvoFbJM9jmx=3D<br>-----END ENCRYPTED PRIVATE KEY-----<br>&quot;<br=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 unset passwd</div><div><br></div><div>Thanks,<=
br></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gma=
il_attr">On Thu, Jul 25, 2019 at 3:17 PM john heasley &lt;<a href=3D"mailto=
:[email protected]">[email protected]</a>&gt; wrote:<br></div><blockquote=
 class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px so=
lid rgb(204,204,204);padding-left:1ex">Thu, Jul 25, 2019 at 02:52:42PM -040=
0, Ugo Bellavance:<br>
&gt; Hi,<br>
&gt; <br>
&gt; I&#39;m trying to get rancid to work with my Fortinet device.=C2=A0 It=
 seems to work<br>
&gt; OK, except for the fact that it doesn&#39;t collect the whole config. =
It looks<br>
&gt; like it&#39;s stuck in the removal of the private key.=C2=A0 It stops =
like this:<br>
&gt; <br>
&gt; #=C2=A0 =C2=A0 =C2=A0 =C2=A0 set private-key &quot;-----BEGIN ENCRYPTE=
D PRIVATE KEY-----<br>
&gt; # &lt;removed&gt;<br>
&gt; Connection to server.xxx.xxx closed.<br>
&gt; <br>
&gt; I checked the code for filter cycling RSA private keys, but I don&#39;=
t know<br>
&gt; where would be the problem.<br>
&gt; <br>
&gt; Any help or suggestion would be appreciated.<br>
<br>
what version of rancid?=C2=A0 show us example input.=C2=A0 test that you ca=
n run the<br>
command with the login script and receive the full output.<br>
</blockquote></div><br clear=3D"all"><br>-- <br><div dir=3D"ltr" class=3D"g=
mail_signature">Ugo Bellavance (<a href=3D"mailto:[email protected]" target=3D"=
_blank">[email protected]</a>)<br></div>

--000000000000afc146058e9590ff--


--===============3688281024923678102==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Rancid-discuss mailing list
[email protected]
http://www.shrubbery.net/mailman/listinfo/rancid-discuss

--===============3688281024923678102==--