User Tools

Site Tools


hpc:rabbitmq

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
hpc:rabbitmq [2014/03/18 13:45]
jchilders
hpc:rabbitmq [2014/03/18 13:48]
jchilders
Line 8: Line 8:
    * Followed <html><a href="http://www.rabbitmq.com/ssl.html" target="_blank">RabbitMQ documentation</a></html> to produce SSL server/client certificates.    * Followed <html><a href="http://www.rabbitmq.com/ssl.html" target="_blank">RabbitMQ documentation</a></html> to produce SSL server/client certificates.
    * Added this code to the RabbitMQ Server configuration file:    * Added this code to the RabbitMQ Server configuration file:
-<code>+<code python>
 [ [
   {rabbit, [   {rabbit, [
      {ssl_listeners, [5671]},      {ssl_listeners, [5671]},
-     {ssl_options, [{cacertfile,"/Users/childers/workarea/rabbitmq/testca/cacert.pem"}, +     {ssl_options, [{cacertfile,"/path/to/testca/cacert.pem"}, 
-                    {certfile,"/Users/childers/workarea/rabbitmq/server/cert.pem"}, +                    {certfile,"/path/to/server/cert.pem"}, 
-                    {keyfile,"/Users/childers/workarea/rabbitmq/server/key.pem"},+                    {keyfile,"/path/to/server/key.pem"},
                     {verify,verify_peer},                     {verify,verify_peer},
                     {fail_if_no_peer_cert,true}]}                     {fail_if_no_peer_cert,true}]}
    ]}    ]}
 ]. ].
 +</code>
 +   * Added this code to the RabbitMQ Client (via Pika) Setup:
 +<code python>
 +#!/usr/bin/env python
 +import pika
 +import sys,ssl
 +
 +# Setup our ssl options
 +ssl_options = {"ca_certs": "/path/to/testca/cacert.pem",
 +               "certfile": "/path/to/client/cert.pem",
 +               "keyfile": "/path/to/client/key.pem",
 +               "cert_reqs": ssl.CERT_REQUIRED,
 +              }
 +
 +connection = pika.BlockingConnection(pika.ConnectionParameters(host='servername.com',port=5671,ssl=True,ssl_options=ssl_options))
 +channel = connection.channel()
 +
 +channel.queue_declare(queue='hello')
 +
 +channel.basic_publish(exchange='',
 +                      routing_key='hello',
 +                      body='Hello World!')
 +print " [x] Sent 'Hello World!'"
 +
 +connection.close()
 </code> </code>
hpc/rabbitmq.txt · Last modified: 2016/06/24 16:28 by jchilders