<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
<link rel="self" type="application/atom+xml" href="https://forum.yubico.com/feed.php?f=5&amp;t=2658" />

<title>Yubico Forum</title>
<subtitle>...visit our web-store at</subtitle>
<link href="https://forum.yubico.com/index.php" />
<updated>2017-06-27T21:32:12+01:00</updated>

<author><name><![CDATA[Yubico Forum]]></name></author>
<id>https://forum.yubico.com/feed.php?f=5&amp;t=2658</id>
<entry>
<author><name><![CDATA[nitmpez715]]></name></author>
<updated>2017-06-27T21:32:12+01:00</updated>
<published>2017-06-27T21:32:12+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=2658&amp;p=9637#p9637</id>
<link href="https://forum.yubico.com/viewtopic.php?t=2658&amp;p=9637#p9637"/>
<title type="html"><![CDATA[ykval-queue:synclib:Timeout.]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=2658&amp;p=9637#p9637"><![CDATA[
I been trying to setup ssl syncing between validation servers and so far have had no luck.<br /><br /><br /><br />I've created certificates for both servers using openssl.  <br />I then added the certificate to the /etc/ssl/certs/ca-certificates.crt for both servers.  This fixed the issue of me calling curl and getting a cert error.  I thought everything would be working now, since I could manually call a sync and get a good status, but logged onto the mysql dabase and saw my queue was full.  I then checked /var/log/syslog and saw the following error:<br />Jun 27 15:22:38 testval1 ykval[3982]: LOG_DEBUG:ykval-queue:synclib:handle indicated to be for <!-- m --><a class="postlink" href="https://testval2/wsapi/2.0/sync">https://testval2/wsapi/2.0/sync</a><!-- m -->.<br />Jun 27 15:22:38 testval2 ykval[3982]: LOG_NOTICE:ykval-queue:synclib:Timeout. Stopping queue resync for server <!-- m --><a class="postlink" href="https://testval2/wsapi/2.0/sync">https://testval2/wsapi/2.0/sync</a><!-- m --><br /><br />If i call curl directly using:<br />curl 'https://testval2/wsapi/2.0/sync?otp=&lt;otpval&gt;&amp;modified=&lt;mod_val&gt;&amp;yk_publicname=&lt;public_id&gt;yk_counter=5&amp;yk_use=5&amp;yk_high=229&amp;yk_low=52183&amp;nonce=&lt;nonce&gt;,local_counter=5&amp;local_use=4'<br /><br />The status comes back as OK.<br /><br />Any help would be appreciated.<br /><br /><br />Update:<br />My current work around until I can get a better fix is to set verifypeer to false in the curl options:<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">$baseParams&#91;'__YKVAL_SYNC_CURL_OPTS__'&#93; = array(<br />        CURLOPT_SSL_VERIFYPEER =&gt; false<br />);</div><br /><br /><br />What I found was it appears I'm getting a CURLE_SSL_CACERT error from ykval-queue.  I created a simple test.php to debug this with the following:<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">&lt;?php<br /><br />$urls = array(<br />   &quot;https://testval2/wsapi/2.0/verify?id=1&amp;nonce=sopxxrlklguqquyvbkwwqthyvofukjzc&amp;otp=llkddjeccccckgvidcnbhhjvbvuicbdjnhblitfhvlfr&amp;timestamp=1&quot;,<br />   &quot;http://testval2/wsapi/2.0/verify?id=1&amp;nonce=sopxxrlklguqquyvbkwwqthyvofukjzd&amp;otp=llkddjeccccckgvidcnbhhjvbvuicbdjnhblitfhvlfr&amp;timestamp=1&quot;<br />);<br /><br />$mh = curl_multi_init();<br /><br />var_dump('start');<br />foreach ($urls as $i =&gt; $url) {<br />    $conn&#91;$i&#93; = curl_init($url);<br />    curl_setopt($conn&#91;$i&#93;, CURLOPT_RETURNTRANSFER, 1);<br />//    curl_setopt($conn&#91;$i&#93;, CURLOPT_CAPATH, &quot;/etc/ssl/certs/&quot;);<br />//    curl_setopt($conn&#91;$i&#93;, CURLOPT_CAINFO, &quot;/etc/ssl/certs/ca-certificates.crt&quot;);<br />    curl_setopt($conn&#91;$i&#93;, CURLOPT_CAINFO, &quot;/test/blah.pem&quot;);<br />//    curl_setopt($conn&#91;$i&#93;, CURLOPT_SSL_VERIFYPEER, 0);<br />    curl_multi_add_handle($mh, $conn&#91;$i&#93;);<br />}<br /><br />var_dump('doloop');<br />do {<br />    $status = curl_multi_exec($mh, $active);<br />    $info = curl_multi_info_read($mh);<br />    if (false !== $info) {<br />        var_dump($info);<br />    }<br />} while ($status === CURLM_CALL_MULTI_PERFORM || $active);<br /><br />var_dump('another loop');<br />foreach ($urls as $i =&gt; $url) {<br />    $res&#91;$i&#93; = curl_multi_getcontent($conn&#91;$i&#93;);<br />    curl_close($conn&#91;$i&#93;);<br />}<br /><br />var_dump('enddump');<br />var_dump(curl_multi_info_read($mh));<br /><br />?&gt;<br /><br /></div><br /><br />Which gives me the following:<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">string(5) &quot;start&quot;<br />string(6) &quot;doloop&quot;<br />array(3) {<br />  &#91;&quot;msg&quot;&#93;=&gt;<br />  int(1)<br />  &#91;&quot;result&quot;&#93;=&gt;<br />  int(60) &lt;--- HERE IS THE CURLE_SSL_CACERT ERROR<br />  &#91;&quot;handle&quot;&#93;=&gt;<br />  resource(5) of type (curl)<br />}<br />array(3) {<br />  &#91;&quot;msg&quot;&#93;=&gt;<br />  int(1)<br />  &#91;&quot;result&quot;&#93;=&gt;<br />  int(0)<br />  &#91;&quot;handle&quot;&#93;=&gt;<br />  resource(6) of type (curl)<br />}<br />string(12) &quot;another loop&quot;<br />string(7) &quot;enddump&quot;<br />bool(false)<br /></div><br /><br />So my manual example is as follows, i moved my certificate out of the /etc/ssl/certs/ca-certificates.crt file to just a /test/blah.pem file, and get the following:<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">curl 'https://testval2/wsapi/2.0/verify?id=1&amp;nonce=sopxxrlklguqquyvbkwwqthyvofukjzc&amp;otp=llkddjeccccckgvidcnbhhjvbvuicbdjnhblitfhvlfr&amp;timestamp=1'<br />curl: (60) server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none<br />More details here: http://curl.haxx.se/docs/sslcerts.html<br /><br />curl performs SSL certificate verification by default, using a &quot;bundle&quot;<br /> of Certificate Authority (CA) public keys (CA certs). If the default<br /> bundle file isn't adequate, you can specify an alternate file<br /> using the --cacert option.<br />If this HTTPS server uses a certificate signed by a CA represented in<br /> the bundle, the certificate verification probably failed due to a<br /> problem with the certificate (it might be expired, or the name might<br /> not match the domain name in the URL).<br />If you'd like to turn off curl's verification of the certificate, use<br /> the -k (or --insecure) option.<br /></div><br /><br />And pointing to the cert:<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent"> curl --cacert blah.pem 'https://testval2/wsapi/2.0/verify?id=1&amp;nonce=sopxxrlklguqquyvbkwwqthyvofukjzc&amp;otp=llkddjeccccckgvidcnbhhjvbvuicbdjnhblitfhvlfr&amp;timestamp=1'<br />h=RoeWTtwokPc0wbIQ17rOqHrGux8=<br />t=2017-06-29T15:15:08Z0971<br />otp=llkddjeccccckgvidcnbhhjvbvuicbdjnhblitfhvlfr<br />nonce=sopxxrlklguqquyvbkwwqthyvofukjzc<br />status=REPLAYED_OTP<br /></div><br /><br />For some reason calling curl from command line with the certificate in /etc/ssl/certs/ca-certificates.crt file has no issue.  It will automatically pickup the cert, but the ykval-queue and test.php for some reason is having issues with the cert.  I tried setting some curl_opts to specify the cert, but had no luck with those.<br /><br />Again any help would be appreciated, as I don't think setting the verifypeer option to false is a great work around.<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=4830">nitmpez715</a> — Tue Jun 27, 2017 9:32 pm</p><hr />
]]></content>
</entry>
</feed>