• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

google LDAP connection failed

Scheduled Pinned Locked Moved General pfSense Questions
16 Posts 5 Posters 3.2k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B
    BossaOps @viktor_g
    last edited by BossaOps Mar 4, 2021, 2:42 PM Mar 4, 2021, 2:37 PM

    @viktor_g So, one thing I'm wondering about is if the LDAP code in pfsense is compiled without SNI, as google specifically says :

    OpenSSL client/library does not support SNI (Server Name Indication)
    
    During the connectivity test, the following output might be returned:
    
    Verify return code: 18 (self signed certificate)
    
    The Secure LDAP service requires a TLS client that supports and initiates a TLS session using SNI (Server Name Indication). If the TLS client does not support SNI, then the TLS server (ldap.google.com) returns a self-signed certificate that will not pass CA validation checks, to indicate that SNI is required.
    
    

    I get the same error if I run ldapsearch without the certificate, and with the certificate included.. however running openssl s_client I get a fully qualfied cert and intermediate cert.

     echo | openssl s_client -showcerts -connect ldap.google.com:636
    CONNECTED(00000003)
    depth=2 OU = GlobalSign Root CA - R2, O = GlobalSign, CN = GlobalSign
    verify return:1
    depth=1 C = US, O = Google Trust Services, CN = GTS CA 1O1
    verify return:1
    depth=0 C = US, ST = California, L = Mountain View, O = Google LLC, CN = ldap.google.com
    verify return:1
    ---
    Certificate chain
     0 s:C = US, ST = California, L = Mountain View, O = Google LLC, CN = ldap.google.com
       i:C = US, O = Google Trust Services, CN = GTS CA 1O1
    -----BEGIN CERTIFICATE-----
    MIIFljCCBH6gAwIBAgIRAIoX7ziwr6xtAwAAAADLP4gwDQYJKoZIhvcNAQELBQAw
    QjELMAkGA1UEBhMCVVMxHjAcBgNVBAoTFUdvb2dsZSBUcnVzdCBTZXJ2aWNlczET
    MBEGA1UEAxMKR1RTIENBIDFPMTAeFw0yMTAx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S5jcmwwggEFBgorBgEEAdZ5AgQCBIH2
    BIHzAPEAdwD2XJQv0XcwIhRUGAgwlFaO400TGTO/3wwvIAvMTvFk4wAAAXc+HT/v
    AAAEAwBIMEYCIQC7cv324GDRYdeRJ0Befkpg+HtRQliMsG5GwE20hRS/1wIhAJAc
    knuz/JvQYkWoeZuNIN8nlyIJgihBhFmuamTfc8tXAHYARJRlLrDuzq/EQAfYqP4o
    wNrmgr7YyzG1P9MzlrW2gagAAAF3Ph1AKwAABAMARzBFAiEAyMzXk/cGMvCDP44J
    djHjmB31Xxk05WbTO43FXL2kS8oCIAzWIM2Ci0XSrAp8ggGcnvV6gWfk1MTwtdPx
    sS9iet3FMA0GCSqGSIb3DQEBCwUAA4IBAQBA8iajNZTnWSG4sMaCwe7H5pIqXmdp
    aPSB7O+kz47sgXmNvHxKDYKImRwNy0pOOozk7FoGclSn3uN4gez97cpKvmS3cigL
    PcWI7yAr0AliiEryl+MG6K4dRgw3ndTMdPoRU7D+UScHxKdGXM4sp2+259gSRsFo
    T89mXnjdNScYqxfbvC0eGOYZ3ubST8PxyvP7S+iRm4pyi7/47N6BW/HkPRfd8JOS
    zuUrhPsvSE/CgNZBBpMLLQhk+HWStQz+2JaRUo7lYTiITz/YJUMeT2CjbI5UPFjG
    WdB9MzyTemh66KlfM8HF6ZXyJqYW8AnfGi4xJ6/kA5+T/X0wA4uHxBsS
    -----END CERTIFICATE-----
     1 s:C = US, O = Google Trust Services, CN = GTS CA 1O1
       i:OU = GlobalSign Root CA - R2, O = GlobalSign, CN = GlobalSign
    -----BEGIN CERTIFICATE-----
    MIIESjCCAzKgAwIBAgINAeO0mqGNiqmBJWlQuDANBgkqhkiG9w0BAQsFADBMMSAw
    HgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFs
    U2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjAeFw0xNzA2MTUwMDAwNDJaFw0yMTEy
    MTUwMDAwNDJaM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azpswWC9aJ9xju4tWDQH8NVU6YZZ/XteDSGU9YzJqPjY8q3MDxrz
    mqepBCf5o8mw/wJ4a2G6xzUr6Fb6T8McDO22PLRL6u3M4Tzs3A2M1j6bykJYi8wW
    IRdAvKLWZu/axBVbzYmqmwkm5zLSDW5nIAJbELCQCZwMH56t2Dvqofxs6BBcCFIZ
    USpxu6x6td0V7SvJCCosirSmIatj/9dSSVDQibet8q/7UK4v4ZUN80atnZz1yg==
    -----END CERTIFICATE-----
    ---
    Server certificate
    subject=C = US, ST = California, L = Mountain View, O = Google LLC, CN = ldap.google.com
    
    issuer=C = US, O = Google Trust Services, CN = GTS CA 1O1
    
    ---
    No client certificate CA names sent
    Requested Signature Algorithms: ECDSA+SHA256:RSA-PSS+SHA256:RSA+SHA256:ECDSA+SHA384:RSA-PSS+SHA384:RSA+SHA384:RSA-PSS+SHA512:RSA+SHA512:RSA+SHA1
    Shared Requested Signature Algorithms: ECDSA+SHA256:RSA-PSS+SHA256:RSA+SHA256:ECDSA+SHA384:RSA-PSS+SHA384:RSA+SHA384:RSA-PSS+SHA512:RSA+SHA512
    Peer signing digest: SHA256
    Peer signature type: RSA-PSS
    Server Temp Key: X25519, 253 bits
    ---
    SSL handshake has read 3062 bytes and written 429 bytes
    Verification: OK
    ---
    New, TLSv1.3, Cipher is TLS_AES_256_GCM_SHA384
    Server public key is 2048 bit
    Secure Renegotiation IS NOT supported
    Compression: NONE
    Expansion: NONE
    No ALPN negotiated
    Early data was not sent
    Verify return code: 0 (ok)
    ---
    DONE
    
    
    1 Reply Last reply Reply Quote 0
    • A
      assitenzatecnicaistituto
      last edited by Mar 5, 2021, 6:48 AM

      Thanks BossaOps, I'm not exactly an expert, it was easy enough to do.
      So there's no way to fix it?

      B 2 Replies Last reply Mar 5, 2021, 10:00 AM Reply Quote 0
      • V
        viktor_g Netgate
        last edited by Mar 5, 2021, 8:21 AM

        Could you check /var/log/system.log for LDAP bind errors?

        pfSense PHP version supports SNI:
        OPENSSL_TLSEXT_SERVER_NAME = true
        see https://www.php.net/manual/en/openssl.constsni.php
        and ldapsearch is not used for it

        Redmine issue created: https://redmine.pfsense.org/issues/11626

        B 2 Replies Last reply Mar 5, 2021, 10:12 AM Reply Quote 0
        • B
          BossaOps @assitenzatecnicaistituto
          last edited by Mar 5, 2021, 10:00 AM

          @assitenzatecnicaistituto I think it's going to take a little while to understand what changed, it should be solvable.

          1 Reply Last reply Reply Quote 0
          • B
            BossaOps @viktor_g
            last edited by Mar 5, 2021, 10:12 AM

            @viktor_g just that same old error I always get:

            4 11:23:19 office-gateway php-fpm[35209]: /diag_authentication.php: ERROR! Could not bind to LDAP server Gsuite. Please check the bind credentials.
            
            

            Same thing more or less in auth.log

            Feb 24 17:12:58 office-gateway openvpn[345]: /openvpn.auth-user.php: ERROR! Could not bind to LDAP server Gsuite. Please check the bind credentials.
            Mar  2 11:02:41 office-gateway php-fpm[96371]: /diag_authentication.php: ERROR! Could not bind to LDAP server Gsuite. Please check the bind credentials.
            
            

            Is there any way to get a more complete error from that code? I had to add --ZZ to ldapsearch to get it to state what the error was, it would be nice to understand which of the many reasons the connection fails. As an aside, Cloud Identity LDAP does not actually use the bind credentials (you can connect without them). They will use them if the client insists on sending them.

            Why do I need both a certificate and access credentials to authenticate LDAP clients?
            
            Only the certificate authenticates the LDAP client. The access credentials only exist if the client insists upon also sending a username and password. On their own, the access credentials don’t confer any access to the LDAP server or user data, but they should be kept secret to prevent them from being used to log in to certain LDAP clients.
            
            In the case where an LDAP client requires access credentials, we authenticate LDAP clients with both certificates and access credentials.
            
            1 Reply Last reply Reply Quote 0
            • B
              BossaOps @viktor_g
              last edited by BossaOps Mar 8, 2021, 9:30 AM Mar 8, 2021, 9:30 AM

              @viktor_g I guess your bug tracker is private, but I'd really like to inform Jim P that

              1. Cloud Identity LDAP stopped working only when we upgraded to 2021.02
              2. Services that are using connections to the same directory continue to run without issue so a google change is not the most likely culprit.
              3. If you set up the stunnel part per this: https://docs.netgate.com/pfsense/en/latest/recipes/auth-google-gsuite.html it works.
              1 Reply Last reply Reply Quote 1
              • B
                BossaOps @assitenzatecnicaistituto
                last edited by Mar 8, 2021, 9:45 AM

                @assitenzatecnicaistituto Actually, if you set up the stunnel package as per this page: https://docs.netgate.com/pfsense/en/latest/recipes/auth-google-gsuite.html#install-the-stunnel-pfsense-package-ce-or-2-4-4-release

                and configure it as indicated, the LDAP works again.

                A R 2 Replies Last reply Mar 8, 2021, 3:33 PM Reply Quote 1
                • A
                  assitenzatecnicaistituto @BossaOps
                  last edited by Mar 8, 2021, 3:33 PM

                  @bossaops thanks! You save me..

                  B 1 Reply Last reply Mar 8, 2021, 4:28 PM Reply Quote 0
                  • B
                    BossaOps @assitenzatecnicaistituto
                    last edited by Mar 8, 2021, 4:28 PM

                    @assitenzatecnicaistituto Piacere mio!

                    1 Reply Last reply Reply Quote 0
                    • R
                      racecarr @BossaOps
                      last edited by Apr 30, 2021, 7:54 PM

                      @bossaops Thank you for providing this as a work around. Worked for my organization, as well. Hard to believe that NetGate would release an update that breaks existing functionality and not provide some notice about the fix.
                      I upgraded yesterday from 2.4.5 to 21.02.2 and the LDAP connection to Google IdP that had been working for almost a year instantly broke.
                      Switched to using stunnel as you suggested and we're back in business.

                      1 Reply Last reply Reply Quote 0
                      • A
                        Albertopfsense
                        last edited by Jul 20, 2021, 5:00 PM

                        good morning
                        i have the same problem
                        this is last row of error report
                        69034 /diag_authentication.php: ERROR! Could not bind to LDAP server Google. Please check the bind credentials.
                        Jul 20 18:51:20 stunnel 69347 LOG5[0]: Connection reset: 0 byte(s) sent to TLS, 0 byte(s) sent to socket
                        Jul 20 18:51:20 stunnel 69347 LOG3[0]: SSL_accept: /build/ce-crossbuild-252/sources/FreeBSD-src/crypto/openssl/ssl/record/rec_layer_s3.c:1544: error:14094418:SSL routines:ssl3_read_bytes:tlsv1 alert unknown ca
                        Jul 20 18:51:20 stunnel 69347 LOG6[0]: Peer certificate not required
                        Jul 20 18:51:20 stunnel 69347 LOG5[0]: Service [Google] accepted connection from 127.0.0.1:50399
                        Jul 20 18:50:45 stunnel 67696 LOG5[ui]: Switched to chroot directory: /var/tmp/stunnel
                        Jul 20 18:50:45 stunnel 67696 LOG5[ui]: Configuration successful

                        what can i try to test the ldap functionality ?
                        thanks Alberto

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                          [[user:consent.lead]]
                          [[user:consent.not_received]]