<!-- 
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-3174] 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-3174</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;Initial Description of the issue ref :&#160;&lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-3113&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/CSHARP-3113&lt;/a&gt;&lt;/p&gt;

&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&#160;&lt;span class=&quot;error&quot;&gt;&amp;#91;Debug&amp;#93;&lt;/span&gt;&#160;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;/p&gt;

&lt;p&gt;&lt;font color=&quot;#FF0000&quot;&gt;&lt;b&gt;Activity Performed by us after steps recommended by Mongodb :&lt;/b&gt;&#160;&lt;/font&gt;&lt;/p&gt;

&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;th class=&apos;confluenceTh&apos;&gt;openssl pkcs12 -export -in &quot;${CLIENT_PEM}&quot; &amp;#124;&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th class=&apos;confluenceTh&apos;&gt;-out &quot;${MONGO_X509_CLIENT_P12}&quot; &amp;#124;&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th class=&apos;confluenceTh&apos;&gt;-name &quot;Drivers Client Certificate&quot; &amp;#124;&lt;/th&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;

&lt;p&gt;&lt;font color=&quot;#FF0000&quot;&gt;&lt;b&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;/b&gt;&lt;/font&gt;&lt;/p&gt;

&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;</description>
                <environment>Production</environment>
        <key id="1425434">CSHARP-3174</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="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="jeff.yemin@mongodb.com">Jeffrey Yemin</assignee>
                                    <reporter username="developer.avisha@gmail.com">Bhaskar Avisha</reporter>
                        <labels>
                    </labels>
                <created>Fri, 31 Jul 2020 12:28:07 +0000</created>
                <updated>Fri, 31 Jul 2020 13:40:16 +0000</updated>
                            <resolved>Fri, 31 Jul 2020 13:40:16 +0000</resolved>
                                                                    <component>Configuration</component>
                    <component>Connectivity</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="3315483" author="jeff.yemin" created="Fri, 31 Jul 2020 13:39:58 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=developer.avisha%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;developer.avisha@gmail.com&quot;&gt;developer.avisha@gmail.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I reviewed the two cases, and at this point it looks like it&apos;s a support issue rather than a driver bug.  To help you further, 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;br/&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;Thank you!&lt;/p&gt;</comment>
                            <comment id="3315477" author="JIRAUSER1254402" created="Fri, 31 Jul 2020 13:34:29 +0000"  >&lt;p&gt;@Jeffery : thanks for the update, this is the ticket where previous recommendation were made, we took some time in implementing these steps , by the time we came back to ticket it was already closed&#160;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-3113&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/CSHARP-3113&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3315459" author="jeff.yemin" created="Fri, 31 Jul 2020 13:20:14 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=developer.avisha%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;developer.avisha@gmail.com&quot;&gt;developer.avisha@gmail.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You said in the description that you had performed steps recommended by MongoDB. Where were those recommendations made to you?&lt;/p&gt;

&lt;p&gt;If it was in a ticket you opened as part of a support contract, it would be best to follow up there or with a new ticket in the support portal.&lt;/p&gt;

&lt;p&gt;Regards,&lt;br/&gt;
Jeff&lt;/p&gt;</comment>
                            <comment id="3315375" author="JIRAUSER1254402" created="Fri, 31 Jul 2020 12:30:09 +0000"  >&lt;p&gt;Tried creating another ticket by cloning old ticket but it was directly assigned to&#160;&#160;&quot;Vincent Kam&quot; who looks inactive at MongoDB , so created this new ticket again&#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|hxkbrz:</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>