<div class="gmail_quote">On Tue, Jun 15, 2010 at 2:55 PM, Cleaver, Japheth <span dir="ltr"><<a href="mailto:jcleaver@soe.sony.com">jcleaver@soe.sony.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
I've been adding testing of https URLs into our system and noticed that while the expiration date checking is nice, Xymon doesn't seem to be checking testing the common name at all for validity (in the manner that a browser might).<br>

<br>
I've been examining contest.c and bbtest-net.c/h looking for the best way of exposing this data back up to the status determination near line ~1800 of bbtest-net.c, but can't seem to properly add things to the testitem struct to get things passed properly.<br>

<br>
E.g.:<br>
contest.c:649:        item->certcommonname = strdup(X509_NAME_get_text_by_NID(X509_get_subject_name(peercert), NID_commonName, NULL, 0));<br>
<br>
<br>
Has anyone tried to solve this problem before? Or, perchance, have a patch?</blockquote><div><br></div><div>I don't recall anyone else mentioning this as a problem.    A fairly easy workaround would be to roll your own check.  For example, this:</div>
<div><br></div><div>     curl -v <a href="https://mail.google.com">https://mail.google.com</a></div><div><br></div><div>returns:</div><div><br></div><div>     * Server certificate:</div><div>     *        subject: C=US; ST=California; L=Mountain View; O=Google Inc; CN=<a href="http://mail.google.com">mail.google.com</a></div>
<div>     *        start date: 2009-12-18 00:00:00 GMT</div><div>     *        expire date: 2011-12-18 23:59:59 GMT</div><div>     *        common name: <a href="http://mail.google.com">mail.google.com</a> (matched)</div>
<div>     *        issuer: C=ZA; O=Thawte Consulting (Pty) Ltd.; CN=Thawte SGC CA</div><div>     *        SSL certificate verify ok. </div><div>     > GET / HTTP/1.1</div><div><br></div><div>among other things.  It wouldn't be too hard to grep out "common name" from that and go from there.  If there's anything hinky about the cert, curl will return an error.  If you use the "-k" option, it'll ignore the error and give you the page along with info about what was wrong.</div>
<div><br></div><div>Ralph Mitchell</div><div><br></div></div>