none
LDAP Authentifizierung RRS feed

  • Frage

  • Hi,

    ich habe eine Lücke beim Verständnis mit Ldap.

    Mit nachstehendem Code kann ich mich beim AD anmelden.

    var connection = new LdapConnection(GetServer());
    connection.AuthType = AuthType.Negotiate;
    connection.Credential = new System.Net.NetworkCredential("User", "PW";

    Ändere ich den AuthType auf 'Basic', kann ich mich nicht mehr beim AD anmelden.

    Was genau verbirgt sich hinter dem Authentifizierungstyp 'Negotiate' in Verbindung mit dem AD?

    Wenn ich es richtig verstehe, verbirgt sich hinter 'Negotiate' etwas Microsoft spezifisches, d.h. bei einem anderen LDAP Verzeichnis (nicht das AD) müsste das Authentifzierungsverfahren 'Basic' angewendet werden.

    Über Infos würde ich mich sehr freuen.

    Viele Grüße

    Christian

     

    Mittwoch, 19. Januar 2011 14:31

Antworten

  • Hallo Christian,

    [AuthType-Enumeration (System.DirectoryServices.Protocols)]
    http://msdn.microsoft.com/de-de/library/system.directoryservices.protocols.authtype.aspx

    Also eben:

    • Basic:  
      Gibt an, dass die Standardauthentifizierung für die Verbindung verwendet werden soll. (Der Wert ist gleich 1). 
    • Negotiate:  
      Gibt an, dass die Negotiate-Authentifizierung von Microsoft für die Verbindung verwendet werden soll. (Der Wert ist gleich 2). 

    Man soll normal die Negotiate-Authentifizierung während RPC-Anmeldungen verwenden.
    Dadurch kann die Clientanwendung die am besten geeignete Authentifizierungsmethode (NTLM oder Kerberos) auswählen.

    Beachte auch, dass bereits die Konstruktoren der LdapConnection dementsprechend dokumentiert sind:

    [LdapConnection-Konstruktor (System.DirectoryServices.Protocols)]
    http://msdn.microsoft.com/de-de/library/system.directoryservices.protocols.ldapconnection.ldapconnection.aspx

    Zitat auch: "All of the directories support the Windows Negotiate authentication method. If no option is specified for the Machine store, Windows Negotiate authentication is used. The default for Domain and ApplicationDirectory, however, is Windows Negotiate with both signing and sealing." [Quelle]

          -> "Es wird die Negotiate-Authentifizierung verwendet."
          -> "Mithilfe der Anmeldeinformationen und der Negotiate-Authentifizierung wird eine
               Verbindung zum LDAP-Server hergestellt.
    "

    Etwas allgemeiner ist das Negotiate-Paradigma ja auch über die HTTP->"AuthenticationSchemes->Negotiate" bekannt:

    [Grundlagen der HTTP-Authentifizierung]
    http://msdn.microsoft.com/de-de/library/ms789031.aspx

    Hier bedeutet Negotiate:

    Beim Aushandeln der Authentifizierung wird automatisch, je nach Verfügbarkeit, zwischen dem Kerberos-Protokoll und der NTLM-Authentifizierung gewählt. Das Kerberos-Protokoll wird verwendet, wenn es zur Verfügung steht, anderenfalls wird versucht NTML zu verwenden. Die Kerberos-Authentifizierung stellt eine wesentliche Verbesserung der NTLM-Authentifizierung dar. Die Kerberos-Authentifizierung ist schneller als NTLM und ermöglicht den Einsatz einer gegenseitigen Authentifizierung und die Weiterleitung der Anmeldeinformationen an Remote-Computer.
    _____________

    Bei Basic-Authentifizierungs-Einstellung ensteht normal immer das Problem, dass Benutzernamen und Kennwörter nur aus technischen Gründen codiert, jedoch nicht verschlüsselt werden, also ggf. ein sichheits-relevante Schwachstelle sein "können".

    Es gibt auch Erweiterungen:

    [Einführung der Erweiterungen zum Negotiate-Authentifizierungspaket]
    http://technet.microsoft.com/de-de/library/dd560645(WS.10).aspx

    BTW: ich nehme oft eher DirectoryEntry [MSDN] um auf LDAP zuzugreifen, aber gut, es gibt Szenarien, da muss man LdapConnection nehmen. Ansonsten:

    Negotiate

    Microsoft Negotiate is an SSP that acts as an application layer between the Security Support Provider Interface (SSPI) and the other SSPs. When an application calls into SSPI to log on to a network, it can specify an SSP to process the request. If the application specifies Negotiate, Negotiate analyzes the request and selects the best SSP to handle the request based on the configured security policy.

    Currently, the Negotiate SSP selects either the Kerberos or NTLM protocol. Negotiate selects the Kerberos protocol unless it cannot be used by one of the systems involved in the authentication or if the client application did not provide a target name as a service principal name (SPN), a user principal name (UPN), or a NetBIOS account name. Otherwise, Negotiate will select the NTLM protocol.

    A server that uses the Negotiate SSP can respond to client applications that specifically select either the Kerberos or NTLM protocol. However, a client application must first query the server to determine if it supports the Negotiate package before using Negotiate. (Negotiate is supported on Windows operating systems beginning with Windows Server 2003 and Windows XP.) A server that does not support Negotiate cannot always respond to requests from clients that specify Negotiate as the SSP.

    For information about this protocol package, see Microsoft Negotiate (Windows) in the MSDN Library.
    ______________________

    Code-Beispiele auch:

    [Authentication Using SDSP]
    http://alt.pluralsight.com/wiki/default.aspx/SDS/AuthenticationUsingSDSP.html?diff=y

    [Ldap Reset Password - C# | Dream.In.Code]
    http://www.dreamincode.net/forums/topic/175808-ldap-reset-password/


    ciao Frank
    • Als Antwort markiert Christian315 Donnerstag, 20. Januar 2011 07:42
    Mittwoch, 19. Januar 2011 15:42
  • Hallo Christian,

    Was genau verbirgt sich hinter dem Authentifizierungstyp 'Negotiate' in Verbindung mit dem AD?


    Bei Verwendung von AD ohne SSL kann AuthType.Negotiate dazu verwendet werden, die Credentials durch (Kerberos)-Verschlüsselung zu schützen. Dabei setzt man zusätzlich connection.SessionOptions.Sealing bzw. connection.SessionOptions.Signing auf true.

    s. LdapSessionOptions:
    http://msdn.microsoft.com/en-us/library/system.directoryservices.protocols.ldapsessionoptions.aspx

    Gruß
    Marcel

    • Als Antwort markiert Christian315 Donnerstag, 20. Januar 2011 07:42
    Mittwoch, 19. Januar 2011 16:07
    Moderator

Alle Antworten

  • Hallo Christian,

    [AuthType-Enumeration (System.DirectoryServices.Protocols)]
    http://msdn.microsoft.com/de-de/library/system.directoryservices.protocols.authtype.aspx

    Also eben:

    • Basic:  
      Gibt an, dass die Standardauthentifizierung für die Verbindung verwendet werden soll. (Der Wert ist gleich 1). 
    • Negotiate:  
      Gibt an, dass die Negotiate-Authentifizierung von Microsoft für die Verbindung verwendet werden soll. (Der Wert ist gleich 2). 

    Man soll normal die Negotiate-Authentifizierung während RPC-Anmeldungen verwenden.
    Dadurch kann die Clientanwendung die am besten geeignete Authentifizierungsmethode (NTLM oder Kerberos) auswählen.

    Beachte auch, dass bereits die Konstruktoren der LdapConnection dementsprechend dokumentiert sind:

    [LdapConnection-Konstruktor (System.DirectoryServices.Protocols)]
    http://msdn.microsoft.com/de-de/library/system.directoryservices.protocols.ldapconnection.ldapconnection.aspx

    Zitat auch: "All of the directories support the Windows Negotiate authentication method. If no option is specified for the Machine store, Windows Negotiate authentication is used. The default for Domain and ApplicationDirectory, however, is Windows Negotiate with both signing and sealing." [Quelle]

          -> "Es wird die Negotiate-Authentifizierung verwendet."
          -> "Mithilfe der Anmeldeinformationen und der Negotiate-Authentifizierung wird eine
               Verbindung zum LDAP-Server hergestellt.
    "

    Etwas allgemeiner ist das Negotiate-Paradigma ja auch über die HTTP->"AuthenticationSchemes->Negotiate" bekannt:

    [Grundlagen der HTTP-Authentifizierung]
    http://msdn.microsoft.com/de-de/library/ms789031.aspx

    Hier bedeutet Negotiate:

    Beim Aushandeln der Authentifizierung wird automatisch, je nach Verfügbarkeit, zwischen dem Kerberos-Protokoll und der NTLM-Authentifizierung gewählt. Das Kerberos-Protokoll wird verwendet, wenn es zur Verfügung steht, anderenfalls wird versucht NTML zu verwenden. Die Kerberos-Authentifizierung stellt eine wesentliche Verbesserung der NTLM-Authentifizierung dar. Die Kerberos-Authentifizierung ist schneller als NTLM und ermöglicht den Einsatz einer gegenseitigen Authentifizierung und die Weiterleitung der Anmeldeinformationen an Remote-Computer.
    _____________

    Bei Basic-Authentifizierungs-Einstellung ensteht normal immer das Problem, dass Benutzernamen und Kennwörter nur aus technischen Gründen codiert, jedoch nicht verschlüsselt werden, also ggf. ein sichheits-relevante Schwachstelle sein "können".

    Es gibt auch Erweiterungen:

    [Einführung der Erweiterungen zum Negotiate-Authentifizierungspaket]
    http://technet.microsoft.com/de-de/library/dd560645(WS.10).aspx

    BTW: ich nehme oft eher DirectoryEntry [MSDN] um auf LDAP zuzugreifen, aber gut, es gibt Szenarien, da muss man LdapConnection nehmen. Ansonsten:

    Negotiate

    Microsoft Negotiate is an SSP that acts as an application layer between the Security Support Provider Interface (SSPI) and the other SSPs. When an application calls into SSPI to log on to a network, it can specify an SSP to process the request. If the application specifies Negotiate, Negotiate analyzes the request and selects the best SSP to handle the request based on the configured security policy.

    Currently, the Negotiate SSP selects either the Kerberos or NTLM protocol. Negotiate selects the Kerberos protocol unless it cannot be used by one of the systems involved in the authentication or if the client application did not provide a target name as a service principal name (SPN), a user principal name (UPN), or a NetBIOS account name. Otherwise, Negotiate will select the NTLM protocol.

    A server that uses the Negotiate SSP can respond to client applications that specifically select either the Kerberos or NTLM protocol. However, a client application must first query the server to determine if it supports the Negotiate package before using Negotiate. (Negotiate is supported on Windows operating systems beginning with Windows Server 2003 and Windows XP.) A server that does not support Negotiate cannot always respond to requests from clients that specify Negotiate as the SSP.

    For information about this protocol package, see Microsoft Negotiate (Windows) in the MSDN Library.
    ______________________

    Code-Beispiele auch:

    [Authentication Using SDSP]
    http://alt.pluralsight.com/wiki/default.aspx/SDS/AuthenticationUsingSDSP.html?diff=y

    [Ldap Reset Password - C# | Dream.In.Code]
    http://www.dreamincode.net/forums/topic/175808-ldap-reset-password/


    ciao Frank
    • Als Antwort markiert Christian315 Donnerstag, 20. Januar 2011 07:42
    Mittwoch, 19. Januar 2011 15:42
  • Hallo Christian,

    Was genau verbirgt sich hinter dem Authentifizierungstyp 'Negotiate' in Verbindung mit dem AD?


    Bei Verwendung von AD ohne SSL kann AuthType.Negotiate dazu verwendet werden, die Credentials durch (Kerberos)-Verschlüsselung zu schützen. Dabei setzt man zusätzlich connection.SessionOptions.Sealing bzw. connection.SessionOptions.Signing auf true.

    s. LdapSessionOptions:
    http://msdn.microsoft.com/en-us/library/system.directoryservices.protocols.ldapsessionoptions.aspx

    Gruß
    Marcel

    • Als Antwort markiert Christian315 Donnerstag, 20. Januar 2011 07:42
    Mittwoch, 19. Januar 2011 16:07
    Moderator
  • Hi Frank,

    vielen Dank für die ausführlichen Infos. Sie haben mir sehr geholfen.

    Viele Grüße

    Christian

    Donnerstag, 20. Januar 2011 07:39
  • Hi Marcel,

    vielen Dank auch für Deine wertvollen Informationen.

    Viele Grüße

    Christian

    Donnerstag, 20. Januar 2011 07:43