<div dir="ltr"><div>Thanks a lot Wadii for your answer</div><div>I already use sqlcacher for all public keys, but for my private key, I want to store it securely (maybe crypted it, if I use a DB)</div><div>for your needs, you catch your private key with rest_client.so, right ? In France we get all keys thanks to the French state's central API, and this API is protected by Oauth2 authentication, so I think use an external dev.</div><div><a class="gmail_plusreply" id="plusReplyChip-0">++</a><br></div><div><br></div><div><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le lun. 29 mai 2023 à 17:01, Wadii ELMAJDI | Evenmedia <<a href="mailto:wadii@evenmedia.fr">wadii@evenmedia.fr</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg5897426764627621749">
<div lang="FR" style="overflow-wrap: break-word;">
<div class="m_5897426764627621749WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hello Mickael
<br>
<br>
if the goal is only to keep your key out of opensips plain sight, the simplest way is using exec.so module, load the private key from a local file or an external data source with an external command, and then store it securely in the local cache for future
calls stirshaken signing. <u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">you could also use the rest_client.so module and get your key/certificate from a secure external webservice (my personal fav)<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">another option is avpops module to get your private key from a sql database on demand (or sqlcacher to full cache your table on script startup)<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">in case you're considering using the avpops module with its default table, the value column can by default only hold 128 characters. for an RSA private key in PEM format, it can go up
to 800 chars.<u></u><u></u></span></p>
<p class="MsoNormal"><span>hope this helps<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0cm 0cm">
<p class="MsoNormal"><b>De :</b> Users <<a href="mailto:users-bounces@lists.opensips.org" target="_blank">users-bounces@lists.opensips.org</a>> <b>De la part de</b> Mickael Hubert<br>
<b>Envoyé :</b> lundi 29 mai 2023 14:55<br>
<b>À :</b> OpenSIPS users mailling list <<a href="mailto:users@lists.opensips.org" target="_blank">users@lists.opensips.org</a>><br>
<b>Objet :</b> Re: [OpenSIPS-Users] Stir Shaken: Failed to load certificate<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Hi,<u></u><u></u></p>
<div>
<p class="MsoNormal">Can you tell me what is the best way to load our private key please ?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">It would be great not to have it as clear text in opensips's configuration.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">thanks in advance<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">Le lun. 21 nov. 2022 à 13:39, ryan embgrets <<a href="mailto:rembgrets@gmail.com" target="_blank">rembgrets@gmail.com</a>> a écrit :<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
<div>
<p class="MsoNormal">That was it. <u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Working flawlessly.Thanks Vlad Patrascu<br>
<br>
Ryan<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Mon, 21 Nov 2022 at 17:24, Vlad Patrascu <<a href="mailto:vladp@opensips.org" target="_blank">vladp@opensips.org</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal">Hi Ryan,<br>
<br>
You have to provide to the stir_shaken_auth() function the actual <br>
content of the certificate file and not just the path. The same goes for <br>
the private key.<br>
<br>
Regards,<br>
<br>
-- <br>
Vlad Patrascu<br>
OpenSIPS Core Developer<br>
<a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a><br>
<br>
On 21.11.2022 14:02, ryan embgrets wrote:<br>
> Greetings<br>
><br>
> I am trying to generate an Identity header by using the stir_shaken <br>
> module of the opensips.<br>
><br>
> But I am encountering the below error each time upon call.<br>
><br>
> Nov 21 11:15:20 local /usr/sbin/opensips[5051]: <br>
> ERROR:stir_shaken:w_stir_verify: Failed to load certificate<br>
> Nov 21 11:15:20 local /usr/sbin/opensips[5051]: <br>
> ERROR:stir_shaken:load_cert: Failed to parse certificate<br>
><br>
> #Module section.<br>
> loadmodule "stir_shaken.so"<br>
><br>
> route{<br>
><br>
> $var(cert) = "/etc/opensips/certs.pem";<br>
> $var(privKey) = "/etc/opensips/key.pem";<br>
> stir_shaken_auth("A", "",$var(cert), $var(privKey), <br>
> "<a href="https://domain.org/cert.pem" target="_blank">https://domain.org/cert.pem</a>");<br>
> }<br>
><br>
> Though the cert looks valid, has proper permission for the opensips to <br>
> access them and cross checked with openssl for the verification.<br>
><br>
> Any pointer on what might be causing this?<br>
><br>
> Ryan<br>
><br>
> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">
http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal">_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><u></u><u></u></p>
</blockquote>
</div>
</div>
</div>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</div></blockquote></div></div>