<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 20, 2015 at 4:40 PM, Emilien Kia <span dir="ltr"><<a href="mailto:kiae.dev@gmail.com" target="_blank">kiae.dev@gmail.com</a>></span> wrote:<br><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Some precisions:<br><br></div>we are not alone, some projects had similar problem: <a href="http://bugs.bitlbee.org/bitlbee/ticket/785" target="_blank">http://bugs.bitlbee.org/bitlbee/ticket/785</a><br></div>And the problem is really coming from NSS initialization. Discussion about the issue here : <a href="http://osdir.com/ml/mozilla.crypto/2002-08/msg00016.html" target="_blank">http://osdir.com/ml/mozilla.crypto/2002-08/msg00016.html</a><br></div></div></blockquote><div><br></div><div>Wow! Congratulations on finding the source of the problem, I bet this wasn't easy!<br><br></div><div>I'm glad to see that NUT isn't faulty :-)<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div></div><div>There is a workaround to use NSS with fork but it is more setting a flag to share some resources (primarily sockets) but must (re)initialize NSS library on all children.<br><br></div><div>AFAIK why we initialize NSS library before becoming user and forking is to be able to access and read certificates and keys which is readable only by root and should not be readable in userland. This behavior is this because it was the behavior used when using OpenSSL. Modifying this behavior implies to modify key/certificate storage and acces right policy.<span class="HOEnZb"><font color="#888888"><br></font></span></div></div></blockquote><div><br></div><div>Well, NUT uses a dedicated unpriviledged user to run ("nut" in my case) so why not initialize the SSL stuff after forking?<br><br>Before forking, just check that the SSL cert/key files belong to the same user as the user which started "upsd" and throw an error message to the logs if it's not the case to warn the user. Then it's your decision whether to "disable SSL usage" and continue or refuse "upsd" execution if conditions are not met.<br><br></div><div>If it's convenient, make this part NSS dependent with the usual #ifdef spaghetti :-) to avoid influence on the OpenSSL code.<br></div></div><br clear="all"><br>-- <br><div class="gmail_signature">Unix _IS_ user friendly, it's just selective about who its friends are.</div>
</div></div>