<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:44:35 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CSHARP-3172] Getting &quot;Authentication failed because the remote party has closed the transport stream&quot; while connection mongodb V4.0 using C# driver.</title>
                <link>https://jira.mongodb.org/browse/CSHARP-3172</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;We are trying to implement SSL authentication with the MongoDB 4.0 version using the below connection string and facing authentication issues.&lt;/p&gt;

&lt;p&gt;&#160;&lt;b&gt;mongodb://username:password@hostname:27017/?authSource=admin&amp;amp;readPreference=primary&amp;amp;ssl=true&amp;amp;sslPEMKeyFile=C:/etc/ssl/client.pem&quot;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;At MongoDB log, we see the application connections are closing immediately with error message :&lt;/p&gt;

&lt;p&gt;&lt;b&gt;encountered a network error during SourceMessage: SocketE&lt;/b&gt;&lt;b&gt;xception: no shared cipher&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;application log:&#160;&lt;br/&gt;
2020-02-20 12:39:53 &lt;span class=&quot;error&quot;&gt;&amp;#91;Debug&amp;#93;&lt;/span&gt; Failed to authenticate HTTPS connection.&lt;br/&gt;
 Properties: { EventId: &lt;/p&gt;
{ Id: 1 }
&lt;p&gt;, SourceContext: &quot;Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionMiddleware&quot;, ConnectionId: &quot;0HLTM5FID0INL&quot;, Application: &quot;DCDService&quot; }&lt;br/&gt;
 MachineName: NB1999-01924579&lt;br/&gt;
 System.IO.IOException: Authentication failed because the remote party has closed the transport stream.&lt;br/&gt;
 &#160;&#160;&#160;at System.Net.Security.SslStream.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)&lt;br/&gt;
 &#160;&#160;&#160;at System.Net.Security.SslStream.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)&lt;br/&gt;
 &#160;&#160;&#160;at System.Net.Security.SslStream.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)&lt;br/&gt;
 &#160;&#160;&#160;at System.Net.Security.SslStream.ProcessAuthentication(LazyAsyncResult lazyResult, CancellationToken cancellationToken)&lt;br/&gt;
 &#160;&#160;&#160;at System.Net.Security.SslStream.BeginAuthenticateAsServer(SslServerAuthenticationOptions sslServerAuthenticationOptions, CancellationToken cancellationToken, AsyncCallback asyncCallback, Object asyncState)&lt;br/&gt;
 &#160;&#160;&#160;at System.Net.Security.SslStream.&amp;lt;&amp;gt;c.&amp;lt;AuthenticateAsServerAsync&amp;gt;b__69_0(SslServerAuthenticationOptions arg1, CancellationToken arg2, AsyncCallback callback, Object state)&lt;br/&gt;
 &#160;&#160;&#160;at System.Threading.Tasks.TaskFactory`1.FromAsyncImpl&lt;span class=&quot;error&quot;&gt;&amp;#91;TArg1,TArg2&amp;#93;&lt;/span&gt;(Func`5 beginMethod, Func`2 endFunction, Action`1 endAction, TArg1 arg1, TArg2 arg2, Object state, TaskCreationOptions creationOptions)&lt;br/&gt;
 &#160;&#160;&#160;at System.Threading.Tasks.TaskFactory.FromAsync&lt;span class=&quot;error&quot;&gt;&amp;#91;TArg1,TArg2&amp;#93;&lt;/span&gt;(Func`5 beginMethod, Action`1 endMethod, TArg1 arg1, TArg2 arg2, Object state, TaskCreationOptions creationOptions)&lt;br/&gt;
 &#160;&#160;&#160;at System.Threading.Tasks.TaskFactory.FromAsync&lt;span class=&quot;error&quot;&gt;&amp;#91;TArg1,TArg2&amp;#93;&lt;/span&gt;(Func`5 beginMethod, Action`1 endMethod, TArg1 arg1, TArg2 arg2, Object state)&lt;br/&gt;
 &#160;&#160;&#160;at System.Net.Security.SslStream.AuthenticateAsServerAsync(SslServerAuthenticationOptions sslServerAuthenticationOptions, CancellationToken cancellationToken)&lt;br/&gt;
 &#160;&#160;&#160;at Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionMiddleware.InnerOnConnectionAsync(ConnectionContext context)&lt;br/&gt;
&#160;&lt;br/&gt;
&#160;&lt;br/&gt;
&#160;&lt;br/&gt;
&#160;&lt;/p&gt;</description>
                <environment>Production</environment>
        <key id="1422008">CSHARP-3172</key>
            <summary>Getting &quot;Authentication failed because the remote party has closed the transport stream&quot; while connection mongodb V4.0 using C# driver.</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="developer.avisha@gmail.com">Bhaskar Avisha</reporter>
                        <labels>
                    </labels>
                <created>Mon, 27 Jul 2020 15:53:01 +0000</created>
                <updated>Thu, 13 Aug 2020 13:59:13 +0000</updated>
                            <resolved>Thu, 13 Aug 2020 13:59:13 +0000</resolved>
                                                                    <component>Configuration</component>
                    <component>Connectivity</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="3336898" author="jeff.yemin" created="Thu, 13 Aug 2020 13:59:04 +0000"  >&lt;p&gt;Hi there, thank you for reaching out. As this sounds like a support issue, I wanted to give you some resources to get this questioned answered more quickly:&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;our MongoDB support portal, located at &lt;a href=&quot;https://support.mongodb.com/welcome&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;support.mongodb.com&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;our MongoDB community portal, located &lt;a href=&quot;https://developer.mongodb.com/community/forums/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;If you are an Atlas customer, there is free support offered 24/7 in the lower right hand corner of the UI.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Just in case you have already opened a support case and are not receiving sufficient help, please let me know and I can facilitate escalating your issue.&lt;/p&gt;

&lt;p&gt;Thank you!&lt;/p&gt;

&lt;p&gt;P.S.  Please double-check that you have followed all the steps in &lt;a href=&quot;https://docs.mongodb.com/manual/tutorial/configure-x509-client-authentication/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/manual/tutorial/configure-x509-client-authentication/&lt;/a&gt;, in particular &lt;a href=&quot;https://docs.mongodb.com/manual/tutorial/configure-x509-client-authentication/#add-x-509-certificate-subject-as-a-user&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/manual/tutorial/configure-x509-client-authentication/#add-x-509-certificate-subject-as-a-user&lt;/a&gt;. &lt;/p&gt;</comment>
                            <comment id="3307590" author="JIRAUSER1254402" created="Mon, 27 Jul 2020 15:56:16 +0000"  >&lt;p&gt;Hello,&#160;&lt;/p&gt;

&lt;p&gt;I have followed by steps mentioned in Previous ticket&#160;&lt;/p&gt;

&lt;p&gt;1) Create a pfx format file using below instructions&#160;&lt;/p&gt;
&lt;div class=&apos;table-wrap&apos;&gt;
&lt;table class=&apos;confluenceTable&apos;&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;openssl pkcs12 -export -in &quot;${CLIENT_PEM}&quot; &amp;#124;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;-out &quot;${MONGO_X509_CLIENT_P12}&quot; &amp;#124;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;-name &quot;Drivers Client Certificate&quot; &amp;#124;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;-password &quot;pass:${MONGO_X509_CLIENT_CERTIFICATE_PASSWORD}&quot;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;


&lt;p&gt;2) Code Snippet from the app config file&#160;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Here is the code used to connect with the x509 cert:&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; public static IContextOptions UseMongoFactory(this IContextOptions options, DatabaseSettings settings)&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var setting = new MongoClientSettings&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // if a username is null, the distinguished name from the certificate will be used&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Credential = MongoCredential.CreateMongoX509Credential(null),&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SslSettings = new SslSettings&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;{&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ClientCertificates = new List&amp;lt;X509Certificate&amp;gt;()&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;/p&gt;

{ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Instert Pem File Location and Passphrase &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; new X509Certificate2(settings.CertificatePath, settings.Passphrase) &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}

&lt;p&gt;,&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; },&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; UseTls = true,&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Server = new MongoServerAddress(settings.ServerName, settings.PortNumber),&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // For testing using self-signed certs, use this option to skip validation.&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // DO NOT USE THIS OPTION FOR PRODUCTION USES&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; AllowInsecureTls = true&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; };&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var context = new MongoClient(setting);&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; options.DatabaseName = settings.DatabaseName;&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; options.Logger = Log.Logger;&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; options.Factory = new MongoFactory(options, context);&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return options;&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }&lt;/p&gt;

&lt;p&gt;Exception Details :&#160;&lt;/p&gt;

&lt;p&gt;Exception:&lt;/p&gt;

&lt;p&gt;MongoDB.Driver.MongoAuthenticationException&lt;/p&gt;

&lt;p&gt;HResult=0x80131500&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Message=Unable to authenticate username &apos;&apos; using protocol &apos;MONGODB-X509&apos;.&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Source=MongoDB.Driver&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;StackTrace:&lt;/p&gt;

&lt;p&gt;at MongoDB.Driver.Linq.MongoQueryProviderImpl`1.Execute(Expression expression)&lt;/p&gt;

&lt;p&gt;at MongoDB.Driver.Linq.MongoQueryableImpl`2.GetEnumerator()&lt;/p&gt;

&lt;p&gt;at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)&lt;/p&gt;

&lt;p&gt;at System.Linq.Enumerable.ToList&lt;span class=&quot;error&quot;&gt;&amp;#91;TSource&amp;#93;&lt;/span&gt;(IEnumerable`1 source)&lt;/p&gt;

&lt;p&gt;at RemoteDbContextStd.MongoEntity`1.ToList() in C:\Users\gbaril\source\repos\Experiments\RemoteDbContextStd\RemoteDbContextStd\MongoEntity.cs:line 143&lt;/p&gt;

&lt;p&gt;at ConfigServer.Features.ConfigServer.Services.ConfigServices.&amp;lt;GetConfigCollection&amp;gt;b__5_0() in C:\Users\gbaril\source\repos\ConfigService\ConfigService\Features\ConfigServer\Services\ConfigServices.cs:line 81&lt;/p&gt;

&lt;p&gt;at System.Threading.Tasks.Task`1.InnerInvoke()&lt;/p&gt;

&lt;p&gt;at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10720">
                    <name>Cloners</name>
                                            <outwardlinks description="clones">
                                        <issuelink>
            <issuekey id="1363465">CSHARP-3113</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hxjryv:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>