Skip to content

Windows to Linux Authentication with Kerberos #3432

@99littlebugs

Description

@99littlebugs

Hi,

This may not be a strictly npgsql problem, but hoping someone in this community can help clarify. We are running our database server on Linux with only Kerberos authentication enabled and have 2 scenarios for clients:

  • Clients running on Linux - this works as expected with Integrated Security=True
  • Development on Windows - when we run the same code, we get the following exception/error message:
System.AggregateException
  HResult=0x80131500
  Message=One or more errors occurred. (XXUUU: accepting GSS security context failed: An unsupported mechanism was requested: Unknown error)
  Source=System.Private.CoreLib
  StackTrace:
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at [redacted]
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.<UseStartup>b__2(IApplicationBuilder app)
   at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.<Configure>g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.GenericWebHostService.<StartAsync>d__31.MoveNext()

  This exception was originally thrown at this call stack:
	Npgsql.NpgsqlConnector.AuthenticateGSS(bool)
	System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
	System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
	System.Runtime.CompilerServices.TaskAwaiter.GetResult()
	Npgsql.NpgsqlConnector.Authenticate(string, Npgsql.Util.NpgsqlTimeout, bool, System.Threading.CancellationToken)
	System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
	System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
	System.Runtime.CompilerServices.TaskAwaiter.GetResult()
    ...
    [Call Stack Truncated]
Inner Exception 1:
PostgresException: XXUUU: accepting GSS security context failed: An unsupported mechanism was requested: Unknown error

The code that reproduces the issue is just the standard code found on Getting Started. We also get the same error when using the Visual Studio extension.

Npgsql version: 5.0.0
Operating system: Windows 7 😢

Do we need to do anything special to make Windows to Linux Kerberos authentication work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions