当前位置:   article > 正文

rabbitmq ssl/tls及pika tls认证连接方法_pika使用tls连接

pika使用tls连接

rabbitmq开启ssl:

# Enable AMQPS
listeners.ssl.default = 5671
ssl_options.cacertfile = PIKA_DIR/testdata/certs/ca_certificate.pem
ssl_options.certfile = PIKA_DIR/testdata/certs/server_certificate.pem
ssl_options.keyfile = PIKA_DIR/testdata/certs/server_key.pem
ssl_options.verify = verify_peer
ssl_options.fail_if_no_peer_cert = true

# Enable HTTPS
management.listener.port = 15671
management.listener.ssl = true
management.listener.ssl_opts.cacertfile = PIKA_DIR/testdata/certs/ca_certificate.pem
management.listener.ssl_opts.certfile = PIKA_DIR/testdata/certs/server_certificate.pem
management.listener.ssl_opts.keyfile = PIKA_DIR/testdata/certs/server_key.pem
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

connection的参数中默认是不直接支持ssl的,需要传递SSLOptions参数

使用ssl方法:

class SSLOptions(object):
    def __init__(self, context, server_hostname=None):
        """
        :param ssl.SSLContext context: SSLContext i
  • 1
  • 2
  • 3
本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/Guff_9hys/article/detail/798569
推荐阅读
相关标签
  

闽ICP备14008679号