RabbitMQ server on RHEL7 resets SSL connection
<p>I've been trying to connect to RabbitMQ server on RHEL7 which listens to 5671 port for SSL connections.</p>

<pre><code>RabbitMQ server's SSL listener has been configured like this:
[
  {rabbit, [
     {ssl_listeners, [5671]},
     {ssl_options, [{cacertfile,"/etc/pki/tls/certs/samqp.dcu.ie.chain"},
                {certfile,"/etc/pki/tls/certs/samqp.dcu.ie.crt"},
                {keyfile,"/etc/pki/tls/private/samqp.dcu.ie.key"},
                {verify,verify_peer},
                {fail_if_no_peer_cert,false}]}
   ]}
]
</code></pre>

<p>On a client side I get this exception message:</p>

<p>The client machine is Ubuntu 14.04 LTS.</p>

<p>The client is a Moodle custom plugin using 'videlalvaro/php-amqplib' library to communicate with server.</p>

<p>Here are actual paths and file names for my self signed certificates created according to docs on: <a href="https://www.rabbitmq.com/ssl.html" rel="nofollow">https://www.rabbitmq.com/ssl.html</a></p>

<pre><code>$sslOptions = array(
            'cafile' =&gt; '/home/duro/testca/cacert.pem',
            'local_cert' =&gt; '/home/duro/client/key-cert.pem',
            'peer_name'=&gt;'samqp.dcu.ie',
            'verify_peer_name' =&gt; true
            );
</code></pre>

<p>PHP apparently has a requirement to use certificate and key concatenated to one file, hence the 'key-cert.pem'.</p>

<p>This is how I connect from client, including actual url:</p>

<pre><code>$connection = new AMQPSSLConnection('samqp.dcu.ie.crt', 5671, 'rMQUsername', 'rMQPasswd', '/', $sslOptions)
</code></pre>

<p>On the client side I get this exception message:</p>

<pre><code>"stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed" 
</code></pre>

<p>On the server side, looking to /var/log/rabbitmq/rabbit@sphinx.log, I see this error:</p>

<pre><code>=ERROR REPORT==== 3-Mar-2016::14:08:26 ===
SSL: certify: ssl_alert.erl:93:Fatal error: unknown ca
</code></pre>

<p>So, how to make this connection work?</p>