-
Notifications
You must be signed in to change notification settings - Fork 558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UnixDomainSocketBinding default security on Windows doesn't work #5621
Comments
On working out why the tests weren't failing, I found where the fix needs to be. In if (address.Identity == null)
{
var hostIdentity = new DnsEndpointIdentity(address.Uri.Host ?? "localhost");
var uriBuilder = new UriBuilder(address.Uri);
uriBuilder.Host = null;
address = new EndpointAddress(uriBuilder.Uri, hostIdentity,address.Headers.ToArray());
} The null check on if (address.Identity == null)
{
var hostIdentity = new DnsEndpointIdentity(string.IsNullOrEmpty(address.Uri.Host) ? "localhost" : address.Uri.Host);
var uriBuilder = new UriBuilder(address.Uri);
uriBuilder.Host = null;
address = new EndpointAddress(uriBuilder.Uri, hostIdentity,address.Headers.ToArray());
} |
@imcarolwang, can you create a PR to fix this issue. Take a look at the CoreWCF issue for a comment with a description of why the tests didn't fail in the unit tests there and make sure any of those issues are fixed in the WCF tests too. Basically don't use UriBuilder and make sure there isn't an extra catch block. |
Hi @mconnew , I checked the WCF test, it doesn’t include a catch block. And in CoreWCF, the Test in WCF: link Update: |
On Windows, it uses NegotiateStream to establish the connection. As part of that, we pass a target name to NegotiateStream.AuthenticateAsClientAsync which is used to get a Kerberos ticket or decide to use NTLM. There's shared code which implicitly uses the hostname from the endpoint address Uri, but with UDS there is no hostname. This results in a bad target name being used (it ends up using
host/
) and authentication failing.Workaround:
Construct you EndpointAddress like this:
This will override the implicit target name to be
host/localhost
and the NegotiateStream authentication will succeed.A few options to fix this.
host/localhost
, but if the hostname is empty, generate the target name String.Empty. I have verified String.Empty successfully authenticates.The text was updated successfully, but these errors were encountered: