[
{ssl, [{versions, ['tlsv1.2']}]},
{rabbit, [
{ssl_listeners, [5671]},
{ssl_options, [{cacertfile,"C:/Users/17126/AppData/Roaming/RabbitMQ/ssl/klca/cacert.pem"},
{certfile,"C:/Users/17126/AppData/Roaming/RabbitMQ/ssl/server/cert.pem"},
{keyfile,"C:/Users/17126/AppData/Roaming/RabbitMQ/ssl/server/key.pem"},
{depth, 2},
{verify,verify_peer},
{honor_cipher_order,true},
{honor_ecc_order, true},
{fail_if_no_peer_cert,false},
{versions, ['tlsv1.2']},
{ciphers, [
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
"TLS_DHE_RSA_WITH_AES_256_GCM_SHA384",
"TLS_DHE_RSA_WITH_AES_128_GCM_SHA256",
"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384",
"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256",
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384",
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",
"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA",
"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"
]
}
]}
]}
].
docker pull rabbitmq:3.11.2-management
在/etc目录下创建rabbitmq目录
cd /etc
mkdir rabbitmq
docker run --name rabbitmq -d -p 15672:15672 -p 5672:5672 -p 5671:5671 -v /etc/rabbitmq:/etc/rabbitmq 031f07386589
docker ps
docker exec -it 7c4548748ca9 /bin/bash
rabbitmq-plugins enable rabbitmq_management
#第一步:添加 admin 用户并设置密码
rabbitmqctl add_user admin 123456
#第二步:添加 admin 用户为administrator角色
rabbitmqctl set_user_tags admin administrator
#第三步:设置 admin 用户的权限,指定允许访问的vhost以及write/read
rabbitmqctl set_permissions -p "/" admin ".*" ".*" ".*"
#第四步:查看vhost(/)允许哪些用户访问
rabbitmqctl list_permissions -p /
#第五步:查看用户列表
rabbitmqctl list_users
exit
rabbitmq.conf
文件touch rabbitmq.conf
listeners.ssl.default = 5671
ssl_options.cacertfile=/etc/rabbitmq/ssl/klca/cacert.pem
ssl_options.certfile=/etc/rabbitmq/ssl/server/cert.pem
ssl_options.keyfile=/etc/rabbitmq/ssl/server/key.pem
ssl_options.verify=verify_peer
ssl_options.fail_if_no_peer_cert=false
ssl_options.depth=2
ssl_options.versions.1=tlsv1.2
ssl_options.honor_cipher_order=true
ssl_options.honor_ecc_order=true
ssl_options.ciphers.1 = TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
ssl_options.ciphers.2 = TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
ssl_options.ciphers.3 = TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
ssl_options.ciphers.4 = TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
ssl_options.ciphers.5 = TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
ssl_options.ciphers.6 = TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
ssl_options.ciphers.7 = TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
ssl_options.ciphers.8 = TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
ssl_options.ciphers.9 = TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
ssl_options.ciphers.10 = TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
ssl_options.ciphers.11= TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
ssl_options.ciphers.12 = TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
docker restart 7c4548748ca9
看到5671端口已启用,说明可以使用ssl方式访问rabbitmq。
密码套件
官方