Re: Pyro4 ver 4.35 hmac key config not symmetric

Katelyn Thode <[email protected]> Mon, 13 Apr 2015 09:39:49 -0700
Newsgroups gmane.comp.python.pyro
Message-ID <CAODs+1OA0tsE2GSdS26MzPucNHiF9JX7FG5NrJQOwoWfJfji1Q@mail.gmail.com>
--===============1060668700533249951==
Content-Type: multipart/alternative; boundary=001a113f92243837dd05139dc36b

--001a113f92243837dd05139dc36b
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Thanks for the response.  I have updated the code to the following:
daemon =3D Pyro4.Daemon(*IP*)
key =3D "test1"
daemon._pyroHmacKey =3D key
nameServer =3D Pyro4.locateNS(*IP*)
nameServer._pyroHmacKey =3D key
uri =3D daemon.register(*self*)
nameServer.register(name, uri)

I am still getting the HMAC key not symmetric error at the
nameServer.register line.  Any ideas?

Thanks,
Katelyn

On Sat, Apr 11, 2015 at 3:39 PM, Irmen de Jong <[email protected]> wrote:

> On 10-4-2015 22:23, Katelyn Thode wrote:
> > Hello,
> >
>
> Hello Katelyn
>
>
> > I am having an issue when attempting to set up the hmac key for Pyro4 i=
n
> code.  The
> > versions being used are as follows:
> > Pyro 4: 4.35
> > Python: 2.7.9
> >
> > The error message is:
> > Pyro4.errors.SecurityError: hmac key config not symmetric
> >
> > The code that is being used is below:
> > daemon =3D Pyro4.Daemon(/IP/)
> > key =3D str(/self/.get_hmac_key())
> > daemon._pyroHmacKey =3D key
> > nameServer =3D Pyro4.locateNS(/IP/)
> > nameServer._pyroHmacKey =3D key
> > uri =3D daemon.register(/self/)
> > nameServer.register(name, uri)
> >
> > get_hmac_key():
> >      key =3D =E2=80=9Ctest1"
> >      msg =3D =E2=80=9Ctest2"
> >      hmac_obj =3D hmac.new(key, msg, hashlib.sha256)
> >      hmac_key =3D hmac_obj.hexdigest()
> >      returnhmac_key
> >
> > The line that the error is thrown at is nameServer.register(name, uri).
> Please advise
> > on what I am doing incorrectly.
> >
>
> I think the problem is in the way you're providing the hmac key to Pyro.
> You should not be encoding it / hmac'ing it yourself; just provide the ke=
y
> to Pyro
> directly. If I understand your code correctly, your key is "test1".
> I assume you have started your nameserver with the "-k test1" argument?
> So just set _pyroHmacKey=3D"test1".
>
> See
>
> https://pythonhosted.org/Pyro4/security.html#preventing-arbitrary-connect=
ions-hmac-signature
>
>
> > Thanks,
> > Katelyn
>
> Hope the above helps you to get your code working. Let us know!
>
>
> Cheers
> Irmen
>
>
>
> -------------------------------------------------------------------------=
-----
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live
> exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual-
> event?utm_
> source=3DSourceforge_BPM_Camp_5_6_15&utm_medium=3Demail&utm_campaign=3DVA=
_SF
> _______________________________________________
> Pyro-core mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pyro-core
>

--001a113f92243837dd05139dc36b
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Thanks for the response.=C2=A0 I have updated the code to =
the following:<div><div style=3D"font-size:12.8000001907349px"><span style=
=3D"font-stretch:normal;font-size:10px;font-family:Consolas">daemon =3D Pyr=
o4.Daemon(</span><span style=3D"font-size:10px;font-family:Consolas"><i>IP<=
/i>)</span></div><div style=3D"font-size:12.8000001907349px"><span style=3D=
"font-size:10px"><span style=3D"font-family:Consolas">key =3D &quot;test1&q=
uot;</span></span></div><div style=3D"font-size:12.8000001907349px"><span s=
tyle=3D"font-size:10px"><span style=3D"font-family:Consolas">daemon._pyroHm=
acKey =3D key</span></span></div><div style=3D"font-size:12.8000001907349px=
"><span style=3D"font-size:10px"><span style=3D"font-family:Consolas">nameS=
erver =3D Pyro4.locateNS(<i>IP</i>)</span></span></div><div style=3D"font-s=
ize:12.8000001907349px"><span style=3D"font-size:10px"><span style=3D"font-=
family:Consolas">nameServer._pyroHmacKey =3D key</span></span></div><div st=
yle=3D"font-size:12.8000001907349px"><span style=3D"font-size:10px"><span s=
tyle=3D"font-family:Consolas">uri =3D daemon.register(<i>self</i>)</span></=
span></div><div style=3D"font-size:12.8000001907349px"><span style=3D"font-=
family:Consolas"><span style=3D"font-size:10px">nameServer.register(name, u=
ri)</span></span></div></div><div style=3D"font-size:12.8000001907349px"><s=
pan style=3D"font-family:Consolas"><span style=3D"font-size:10px"><br></spa=
n></span></div><div>I am still getting the HMAC key not symmetric error at =
the nameServer.register line.=C2=A0 Any ideas?<br></div><div><br></div><div=
>Thanks,</div><div>Katelyn</div></div><div class=3D"gmail_extra"><br><div c=
lass=3D"gmail_quote">On Sat, Apr 11, 2015 at 3:39 PM, Irmen de Jong <span d=
ir=3D"ltr">&lt;<a href=3D"mailto:[email protected]" target=3D"_blank">irm=
[email protected]</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote"=
 style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On=
 10-4-2015 22:23, Katelyn Thode wrote:<br>
&gt; Hello,<br>
&gt;<br>
<br>
Hello Katelyn<br>
<span class=3D""><br>
<br>
&gt; I am having an issue when attempting to set up the hmac key for Pyro4 =
in code.=C2=A0 The<br>
&gt; versions being used are as follows:<br>
&gt; Pyro 4: 4.35<br>
&gt; Python: 2.7.9<br>
&gt;<br>
&gt; The error message is:<br>
&gt; Pyro4.errors.SecurityError: hmac key config not symmetric<br>
&gt;<br>
&gt; The code that is being used is below:<br>
</span>&gt; daemon =3D Pyro4.Daemon(/IP/)<br>
&gt; key =3D str(/self/.get_hmac_key())<br>
&gt; daemon._pyroHmacKey =3D key<br>
&gt; nameServer =3D Pyro4.locateNS(/IP/)<br>
&gt; nameServer._pyroHmacKey =3D key<br>
&gt; uri =3D daemon.register(/self/)<br>
<span class=3D"">&gt; nameServer.register(name, uri)<br>
&gt;<br>
&gt; get_hmac_key():<br>
&gt;=C2=A0 =C2=A0 =C2=A0 key =3D =E2=80=9Ctest1&quot;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 msg =3D =E2=80=9Ctest2&quot;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 hmac_obj =3D hmac.new(key, msg, hashlib.sha256)<br=
>
&gt;=C2=A0 =C2=A0 =C2=A0 hmac_key =3D hmac_obj.hexdigest()<br>
&gt;=C2=A0 =C2=A0 =C2=A0 returnhmac_key<br>
&gt;<br>
&gt; The line that the error is thrown at is nameServer.register(name, uri)=
.=C2=A0 Please advise<br>
&gt; on what I am doing incorrectly.<br>
&gt;<br>
<br>
</span>I think the problem is in the way you&#39;re providing the hmac key =
to Pyro.<br>
You should not be encoding it / hmac&#39;ing it yourself; just provide the =
key to Pyro<br>
directly. If I understand your code correctly, your key is &quot;test1&quot=
;.<br>
I assume you have started your nameserver with the &quot;-k test1&quot; arg=
ument?<br>
So just set _pyroHmacKey=3D&quot;test1&quot;.<br>
<br>
See<br>
<a href=3D"https://pythonhosted.org/Pyro4/security.html#preventing-arbitrar=
y-connections-hmac-signature" target=3D"_blank">https://pythonhosted.org/Py=
ro4/security.html#preventing-arbitrary-connections-hmac-signature</a><br>
<br>
<br>
&gt; Thanks,<br>
&gt; Katelyn<br>
<br>
Hope the above helps you to get your code working. Let us know!<br>
<br>
<br>
Cheers<br>
Irmen<br>
<br>
<br>
---------------------------------------------------------------------------=
---<br>
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT<br>
Develop your own process in accordance with the BPMN 2 standard<br>
Learn Process modeling best practices with Bonita BPM through live exercise=
s<br>
<a href=3D"http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual-=
" target=3D"_blank">http://www.bonitasoft.com/be-part-of-it/events/bpm-camp=
-virtual-</a> event?utm_<br>
source=3DSourceforge_BPM_Camp_5_6_15&amp;utm_medium=3Demail&amp;utm_campaig=
n=3DVA_SF<br>
_______________________________________________<br>
Pyro-core mailing list<br>
<a href=3D"mailto:[email protected]">[email protected]=
rge.net</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/pyro-core" target=
=3D"_blank">https://lists.sourceforge.net/lists/listinfo/pyro-core</a><br>
</blockquote></div><br></div>

--001a113f92243837dd05139dc36b--


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

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
--===============1060668700533249951==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Pyro-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyro-core

--===============1060668700533249951==--