Пример #1
0
        /// <summary>
        /// Configures the rabbit mq client connection for Sll properties.
        /// </summary>
        /// <param name="builder">Builder with appropriate properties set.</param>
        /// <returns>A connection factory builder</returns>
        /// <remarks>
        /// SSL configuration in Rabbit MQ is a complex topic.  In order to ensure that rabbit can work without client presenting a client certificate
        /// and working just like an SSL enabled web-site which does not require certificate you need to have the following settings in your rabbitmq.config
        /// file.
        ///      {ssl_options, [{cacertfile,"/path_to/cacert.pem"},
        ///            {certfile,"/path_to/server/cert.pem"},
        ///            {keyfile,"/path_to/server/key.pem"},
        ///            {verify,verify_none},
        ///            {fail_if_no_peer_cert,false}]}
        /// The last 2 lines are the important ones.
        /// </remarks>
        public ConnectionFactoryBuilder Configure(ConnectionFactoryBuilder builder)
        {
            builder.Add(connectionFactory =>
            {
                connectionFactory.Ssl.Enabled = true;
                if (!_clientCertificateRequired)
                {
                    // These properties need to be set as empty for the Rabbit MQ client. Null's cause an exception in the client library.
                    connectionFactory.Ssl.CertPath       = string.Empty;
                    connectionFactory.Ssl.CertPassphrase = string.Empty;
                    connectionFactory.Ssl.ServerName     = string.Empty;
                    // Because no client certificate is present we must allow the remote certificate name mismatch for the connection to succeed.
                    _acceptablePolicyErrors = _acceptablePolicyErrors
                                              | SslPolicyErrors.RemoteCertificateNameMismatch;
                }
                else
                {
                    connectionFactory.Ssl.CertPath       = _certificatePath;
                    connectionFactory.Ssl.CertPassphrase = _passphrase;
                    connectionFactory.Ssl.ServerName     = _serverName;
                }
                connectionFactory.Ssl.AcceptablePolicyErrors = _acceptablePolicyErrors;
                connectionFactory.Ssl.Version = SslProtocols.Tls;

                return(connectionFactory);
            });

            return(builder);
        }
        /// <summary>
        /// Configures the rabbit mq client connection for Sll properties.
        /// </summary>
        /// <param name="builder">Builder with appropriate properties set.</param>
        /// <returns>A connection factory builder</returns>
        /// <remarks>
        /// SSL configuration in Rabbit MQ is a complex topic.  In order to ensure that rabbit can work without client presenting a client certificate
        /// and working just like an SSL enabled web-site which does not require certificate you need to have the following settings in your rabbitmq.config
        /// file.
        ///      {ssl_options, [{cacertfile,"/path_to/cacert.pem"},
        ///            {certfile,"/path_to/server/cert.pem"},
        ///            {keyfile,"/path_to/server/key.pem"},
        ///            {verify,verify_none},
        ///            {fail_if_no_peer_cert,false}]}
        /// The last 2 lines are the important ones.
        /// </remarks>
        public ConnectionFactoryBuilder Configure(ConnectionFactoryBuilder builder)
        {
            builder.Add(connectionFactory =>
                {
                    connectionFactory.Ssl.Enabled = true;
                    if (!_clientCertificateRequired)
                    {
                        // These properties need to be set as empty for the Rabbit MQ client. Null's cause an exception in the client library.
                        connectionFactory.Ssl.CertPath = string.Empty;
                        connectionFactory.Ssl.CertPassphrase = string.Empty;
                        connectionFactory.Ssl.ServerName = string.Empty;
                        // Because no client certificate is present we must allow the remote certificate name mismatch for the connection to succeed.
                        _acceptablePolicyErrors = _acceptablePolicyErrors
                                                  | SslPolicyErrors.RemoteCertificateNameMismatch;
                    }
                    else
                    {
                        connectionFactory.Ssl.CertPath = _certificatePath;
                        connectionFactory.Ssl.CertPassphrase = _passphrase;
                        connectionFactory.Ssl.ServerName = _serverName;
                    }
                    connectionFactory.Ssl.AcceptablePolicyErrors = _acceptablePolicyErrors;
                    connectionFactory.Ssl.Version = SslProtocols.Tls;

                    return connectionFactory;
                });

            return builder;
        }
Пример #3
0
        public ConnectionFactoryBuilder Configure(ConnectionFactoryBuilder builder)
        {
            builder.Add(connectionFactory =>
            {
                connectionFactory.Ssl.Enabled                = true;
                connectionFactory.Ssl.ServerName             = _serverName;
                connectionFactory.Ssl.AcceptablePolicyErrors = _acceptablePolicyErrors;
                return(connectionFactory);
            });

            return(builder);
        }
        public ConnectionFactoryBuilder Configure(ConnectionFactoryBuilder builder)
        {
            builder.Add(connectionFactory =>
                {
                    connectionFactory.Ssl.Enabled = true;
                    connectionFactory.Ssl.CertPath = _certificatePath;
                    connectionFactory.Ssl.CertPassphrase = _passphrase;
                    connectionFactory.Ssl.ServerName = _serverName;
                    connectionFactory.Ssl.AcceptablePolicyErrors = _acceptablePolicyErrors;
                    connectionFactory.Ssl.Version = SslProtocols.Tls;

                    return connectionFactory;
                });

            return builder;
        }
Пример #5
0
        public ConnectionFactoryBuilder Configure(ConnectionFactoryBuilder builder)
        {
            builder.Add(connectionFactory =>
            {
                connectionFactory.Ssl.Enabled                = true;
                connectionFactory.Ssl.CertPath               = _certificatePath;
                connectionFactory.Ssl.CertPassphrase         = _passphrase;
                connectionFactory.Ssl.ServerName             = _serverName;
                connectionFactory.Ssl.AcceptablePolicyErrors = _acceptablePolicyErrors;
                connectionFactory.Ssl.Version                = SslProtocols.Tls;

                return(connectionFactory);
            });

            return(builder);
        }
 public ConnectionFactoryBuilder Configure(ConnectionFactoryBuilder builder)
 {
     builder.Add(Configure);
     return(builder);
 }
 public ConnectionFactoryBuilder Configure(ConnectionFactoryBuilder builder)
 {
     builder.Add(Configure);
     return builder;
 }