Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NegotiateStream rejecting clients that aren't local admins

I have a very basic client/server test set up that fails with the message:

The server has rejected the client credentials.

Unless the client is logged on as an account that has admin rights on the server. This is something I do not want.

Here is my client code:

var formatter = new BinaryFormatter();

...

using (var client = new TcpClient(ip, 1248))
using (var stream = client.GetStream())
using (var negStream = new NegotiateStream(stream, false))
{
    await negStream.AuthenticateAsClientAsync(CredentialCache.DefaultNetworkCredentials, string.Empty, ProtectionLevel.EncryptAndSign, TokenImpersonationLevel.Identification));
    formatter.Serialize(negStream, "This is a test!");
}

And here is my server code:

var listener = new TcpListener.Create(1248);
listener.Start();

var tcpClient = listener.AcceptTcpClient();
using (var stream = tcpClient.GetStream())
using (var negStream = new NegotiateStream(stream, false))
{
    await negStream.AuthenticateAsServerAsync(CredentialCache.DefaultNetworkCredentials, ProtectionLevel.EncryptAndSign, TokenImpersonationLevel.Identification));
    Console.WriteLine(formatter.Deserialize(negStream));
}

How do I configure the server to accept any logged on user? Is there another setting I need to look at? Is there another way to authenticate a stream with domain credentials?

like image 394
joe_coolish Avatar asked Nov 09 '22 14:11

joe_coolish


1 Answers

This May sound crazy, but you can give it a try, ,it worked for me anyway

open folder-> view tab -> options -> view tab -> scroll down and uncheck "use sharing wizard"

like image 196
Hussein Khalil Avatar answered Nov 15 '22 12:11

Hussein Khalil