Connection reset by peer (rabbitmq) #6776
Replies: 3 comments 2 replies
-
@Opperessor it is very strange to configure the default AMQP port You have RabbitMQ configured to request a client certificate:
...yet your Python code does not provide one. It looks like I need to update the Pika documentation. You should use code like this: import pika
import ssl
context = ssl.create_default_context()
context.verify_mode = ssl.CERT_REQUIRED
context.load_verify_locations(cafile="/path/to/ca_certificate.pem")
context.load_cert_chain(
certfile="/path/to/client_certificate.pem",
keyfile="/path/to/cclient_key.pem",
)
credentials = pika.PlainCredentials("guest", "guest")
parameters = pika.ConnectionParameters(
host="localhost",
port=5672,
credentials=credentials,
ssl_options=pika.SSLOptions(context),
)
connection = pika.BlockingConnection(parameters) Please see this pull request to update the documentation: pika/pika#1412 |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
@Opperessor we encountered similar issues, the log is
it similar with this issue rabbitmq/rabbitmq-java-client#620 the root cause is the rabbitmq server requires SSL authorization, but the client config we use RabbitAutoConfiguration, RabbitProperties.Ssl in spring-boot-autoconfigure-2.7.4.jar, the init critical code is the following: public void configure(RabbitConnectionFactoryBean factory) {
// ...
RabbitProperties.Ssl ssl = this.rabbitProperties.getSsl();
if (ssl.determineEnabled()) {
factory.setUseSSL(true);
map.from(ssl::getAlgorithm).whenNonNull().to(factory::setSslAlgorithm);
map.from(ssl::getKeyStoreType).to(factory::setKeyStoreType);
map.from(ssl::getKeyStore).to(factory::setKeyStore);
map.from(ssl::getKeyStorePassword).to(factory::setKeyStorePassphrase);
map.from(ssl::getKeyStoreAlgorithm).whenNonNull().to(factory::setKeyStoreAlgorithm);
map.from(ssl::getTrustStoreType).to(factory::setTrustStoreType);
map.from(ssl::getTrustStore).to(factory::setTrustStore);
map.from(ssl::getTrustStorePassword).to(factory::setTrustStorePassphrase);
map.from(ssl::getTrustStoreAlgorithm).whenNonNull().to(factory::setTrustStoreAlgorithm);
map.from(ssl::isValidateServerCertificate)
.to((validate) -> factory.setSkipServerCertificateValidation(!validate));
map.from(ssl::getVerifyHostname).to(factory::setEnableHostnameVerification);
}
// ...
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Python / Pika code
on the server side tls is enabled
rabbitmq.conf
:refered from this site:https://pika.readthedocs.io/en/stable/examples/tls_server_authentication.html unable to connect to the server would someone help me out kinda new to rabbitmq this is the error im getting
Beta Was this translation helpful? Give feedback.
All reactions