- Erlang 20.2.2
- RabbitMQ 3.7.3
- Pika 0.11.2
- SSL certs generated by
michaelklishin/tls-gen
"basic" profile
Last active
April 19, 2018 15:55
-
-
Save lukebakken/6d091c1452b01c8bec24db2360fecfb7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ssl | |
import pika | |
ssl_opts = dict( | |
ssl_version=ssl.PROTOCOL_TLSv1, | |
ca_certs='/home/lbakken/development/michaelklishin/tls-gen/basic/testca/cacert.pem', | |
keyfile='/home/lbakken/development/michaelklishin/tls-gen/basic/client/key.pem', | |
certfile='/home/lbakken/development/michaelklishin/tls-gen/basic/client/cert.pem', | |
cert_reqs=ssl.CERT_REQUIRED) | |
print(ssl_opts) | |
credentials = pika.PlainCredentials('guest', 'guest') | |
params = pika.ConnectionParameters(port=5671, host='localhost', credentials=credentials, ssl=True, ssl_options=ssl_opts) | |
connection = pika.BlockingConnection(params) | |
channel = connection.channel() | |
result = channel.queue_declare(exclusive=True) | |
queue_name = result.method.queue | |
print('queue: {}'.format(queue_name)) | |
def callback(ch, method, properties, body): | |
print(body) | |
channel.basic_consume(callback, queue=queue_name, no_ack=True) | |
channel.start_consuming() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{rabbit, | |
[ | |
{ssl_listeners,[5671]}, | |
{ssl_options, | |
[{cacertfile,"/home/lbakken/development/michaelklishin/tls-gen/basic/testca/cacert.pem"}, | |
{certfile,"/home/lbakken/development/michaelklishin/tls-gen/basic/server/cert.pem"}, | |
{keyfile,"/home/lbakken/development/michaelklishin/tls-gen/basic/server/key.pem"}, | |
{verify, verify_peer}, | |
{depth, 5}, | |
{fail_if_no_peer_cert, true}, | |
{ciphers, [{rsa,aes_256_cbc,sha256}, | |
{rsa,aes_128_cbc,sha256}, | |
{rsa,aes_256_cbc,sha}, | |
{rsa,'3des_ede_cbc',sha}, | |
{rsa,aes_128_cbc,sha}, | |
{rsa,des_cbc,sha}]} | |
]} | |
] | |
}]. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment