我有一個內置在 .NET Standard 庫中的 RabbitMQ 集成,一些 .NET Framework 4.7.2 應用程式正在使用該庫。它被配置為通過埠 5671 安全地連接到 RabbitMQ 代理,并使用已安裝在我的本地計算機和我們的應用程式開發/測驗服務器的受信任的根證書頒發機構中的自簽名證書。
開發服務器和 RabbitMQ 代理都在我們“本地”網路內的 AWS EC2 實體上運行。
當我在本地機器上除錯這些應用程式時(通過 VPN 連接到“本地”網路),與 RabbitMQ 代理的安全連接已正確初始化,一切都按預期作業。
但是,當我嘗試在開發服務器上運行應用程式時,連接失敗并出現以下例外:
AuthenticationException: The remote certificate is invalid according to the validation procedure.
System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult) 8343681
System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result) 76
System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization) 83
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 31
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 60
RabbitMQ.Client.Impl.<>c__DisplayClass2_0.<TcpUpgrade>b__0(SslOption opts) 82
RabbitMQ.Client.Impl.SslHelper.TcpUpgrade(Stream tcpStream, SslOption options) 512
RabbitMQ.Client.Impl.SocketFrameHandler..ctor(AmqpTcpEndpoint endpoint, Func`2 socketFactory, TimeSpan connectionTimeout, TimeSpan readTimeout, TimeSpan writeTimeout) 830
RabbitMQ.Client.ConnectionFactory.CreateFrameHandler(AmqpTcpEndpoint endpoint) 122
RabbitMQ.Client.EndpointResolverExtensions.SelectOne(IEndpointResolver resolver, Func`2 selector) 191
更奇怪的是,當我通過開發服務器上的瀏覽器導航到安全的 RabbitMQ 管理 UI(埠 15671)時,瀏覽器正確地將證書識別為有效。
考慮到這可能是防火墻/埠問題,我確保將開發服務器防火墻設定為允許到埠 5671 的出站 TCP 流量,但這也沒有解決問題。
我錯過了什么?是否需要一些我不知道的額外 IIS 配置?
謝謝!
uj5u.com熱心網友回復:
答案很簡單。我錯誤地將證書安裝在開發服務器的管理員用戶Trusted Root Authorities 中,而不是機器的Trusted Root Authorities 中。由于應用程式設定為與其他用戶一起運行,因此該用戶無權訪問已安裝的證書。一旦我將它安裝在機器的受信任的根權限中,連接就會按預期作業。
RabbitMQ 團隊向 Luke Bakken 提供的答案:https ://groups.google.com/g/rabbitmq-users/c/tJHnDEnCZxM
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/508668.html
標籤:C#。网ssl兔子MQ
下一篇:TLS1.3解密如何作業?
