Re: Pyro4 ver 4.35 hmac key config not symmetric

Katelyn Thode <[email protected]> Mon, 13 Apr 2015 09:56:54 -0700
Newsgroups gmane.comp.python.pyro
Message-ID <CAODs+1N6KhSSFkNSMo9xrB+JCKs=hpWPOKw0eUjO=xwhGEdZog@mail.gmail.com>
--===============9085339277879156010==
Content-Type: multipart/alternative; boundary=001a1132f2144d16a805139e0038

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

Sorry, I responded too soon.  I was not starting the HMAC server with the
key.  Now, I have updated to start the name server with the -k "test1"
argument, and I also had to add in the hmac_key parameter in the locateNS
call, but now everything seems to be working.  Thanks for your help!

Katelyn

On Mon, Apr 13, 2015 at 9:39 AM, Katelyn Thode <[email protected]>
wrote:

> 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
>> in 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
>> key 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-connec=
tions-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=3DV=
A_SF
>> _______________________________________________
>> Pyro-core mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/pyro-core
>>
>
>

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

<div dir=3D"ltr">Sorry, I responded too soon.=C2=A0 I was not starting the =
HMAC server with the key.=C2=A0 Now, I have updated to start the name serve=
r with the -k &quot;test1&quot; argument, and I also had to add in the hmac=
_key parameter in the locateNS call, but now everything seems to be working=
.=C2=A0 Thanks for your help!<div><br></div><div>Katelyn</div></div><div cl=
ass=3D"gmail_extra"><br><div class=3D"gmail_quote">On Mon, Apr 13, 2015 at =
9:39 AM, Katelyn Thode <span dir=3D"ltr">&lt;<a href=3D"mailto:katelyn.thod=
[email protected]" target=3D"_blank">[email protected]</a>&gt;</span> wrote=
:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-le=
ft:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">Thanks for the respons=
e.=C2=A0 I have updated the code to the following:<div><div style=3D"font-s=
ize:12.8000001907349px"><span style=3D"font-stretch:normal;font-size:10px;f=
ont-family:Consolas">daemon =3D Pyro4.Daemon(</span><span style=3D"font-siz=
e: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-fam=
ily:Consolas">key =3D &quot;test1&quot;</span></span></div><div style=3D"fo=
nt-size:12.8000001907349px"><span style=3D"font-size:10px"><span style=3D"f=
ont-family:Consolas">daemon._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">nameServer =3D Pyro4.locateNS(<i>IP</i>)</spa=
n></span></div><div style=3D"font-size:12.8000001907349px"><span style=3D"f=
ont-size:10px"><span style=3D"font-family:Consolas">nameServer._pyroHmacKey=
 =3D key</span></span></div><div style=3D"font-size:12.8000001907349px"><sp=
an style=3D"font-size:10px"><span style=3D"font-family:Consolas">uri =3D da=
emon.register(<i>self</i>)</span></span></div><div style=3D"font-size:12.80=
00001907349px"><span style=3D"font-family:Consolas"><span style=3D"font-siz=
e:10px">nameServer.register(name, uri)</span></span></div></div><div style=
=3D"font-size:12.8000001907349px"><span style=3D"font-family:Consolas"><spa=
n style=3D"font-size:10px"><br></span></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"HOEnZb"><div class=3D"h5"><div class=3D"gmail_extra"><br><div =
class=3D"gmail_quote">On Sat, Apr 11, 2015 at 3:39 PM, Irmen de Jong <span =
dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]" target=3D"_blank">ir=
[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">O=
n 10-4-2015 22:23, Katelyn Thode wrote:<br>
&gt; Hello,<br>
&gt;<br>
<br>
Hello Katelyn<br>
<span><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>&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]" target=3D"_blank">Pyro-c=
[email protected]</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>
</div></div></blockquote></div><br></div>

--001a1132f2144d16a805139e0038--


--===============9085339277879156010==
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
--===============9085339277879156010==
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

--===============9085339277879156010==--