Loading ...
Sorry, an error occurred while loading the content.

trouble with ldaps in ldap lookup map

Expand Messages
  • btb
    (apologies if i m reposting this. i forget i hadn t resubscribed before sending initially) hi- i m having some trouble using ldaps in a lookup map for
    Message 1 of 37 , Jun 26, 2009
    • 0 Attachment
      (apologies if i'm reposting this. i forget i hadn't resubscribed before
      sending initially)

      hi-

      i'm having some trouble using ldaps in a lookup map for
      virtual_mailbox_domains (among others).

      here's my lookup map:

      >cat virtual_mailbox_domains.cf
      version = 3
      tls_ca_cert_file = /etc/ssl/certs/ca-certificates.crt
      server_host = ldaps://ldap.example.com
      bind_dn = cn=postfix,ou=services,ou=accounts,dc=example,dc=com
      bind_pw = xxxxxxxxxxxxxx
      search_base = ou=domains,ou=mail,dc=example,dc=com
      query_filter = (&(objectClass=mailDomain)(host=%s)(description=virtual))
      result_attribute = description

      testing with postmap returns:
      >postmap -q 'example.com' ldap:./virtual_mailbox_domains.cf
      postmap: warning: dict_ldap_set_tls_options: Unable to allocate new TLS
      context -1: Can't contact LDAP server

      however, if i switch from ldaps:// to ldap://, it's successful.

      the same ldaps query via ldapsearch (on the same computer as postmap)
      appears to be successful:

      >ldapsearch -LLLxP 3 -H 'ldaps://ldap.ltn.lvc.com' -D
      'cn=postfix,ou=services,ou=accounts,dc=example,dc=com' -w
      'xxxxxxxxxxxxx' -b 'dc=example,dc=com'
      "(&(objectClass=mailDomain)(host=example.com)(description=virtual))"
      description
      dn: host=example.com,ou=domains,ou=mail,dc=example,dc=com
      description: virtual

      also - testing with s_client seems to indicate that the certificate file
      /etc/ssl/certs/ca-certificates.crt is ok, as the return code is 0 (ok)
      when using -CAfile and 21 (unable to verify the first certificate) when
      not used (i'll spare the pages of s_client for the moment.)

      what am i doing wrong?

      postfix 2.6.2-RC1
      openldap 2.4.11
      debian testing

      thanks
      -ben
    • Viktor Dukhovni
      ... Yes it is better now, though it took many tries to get a cached session, since session ticket support in OpenSSL 1.0 makes the Postfix SMTP server session
      Message 37 of 37 , Jul 7 6:41 PM
      • 0 Attachment
        On Sun, Jul 07, 2013 at 08:02:53PM -0400, D'Arcy J.M. Cain wrote:

        > > > > > > > When sending several mails in succession, failure and
        > > > > > > > success seem to alternate (i.e. exactly one failed
        > > > > > > > handshake, then a successful one, then a failed one again,
        > > > > > > > etc.). And not using a TLS session cache for smtp(8)
        > > > > > > > (smtp_tls_session_cache_database) seems to work around the
        > > > > > > > problem.
        > > >
        > > > Odd. No one else has mentioned this issue. Could it be a
        > > > combination of versions between the client and server?
        > >
        > > No, all client versions I tried, ranging from 0.9.8j through 1.0.1e
        > > exhibit the issue. All evidence so far points to a server bug.
        > > The system that exhibits the bug consistently is also running NetBSD
        > > 5.1.
        >
        > I have just upgraded all of my systems. Postfix and SSL are now both
        > in the base system. Can you test it again please.

        Yes it is better now, though it took many tries to get a cached
        session, since session ticket support in OpenSSL 1.0 makes the
        Postfix SMTP server session cache mostly ineffective. This will
        be fixed in Postfix 2.11 and 2.10.2 (Wietse has patches for both
        in his queue):

        [ Most SMTP servers don't have high enough traffic loads to be
        overly concerned about lack of TLS session caching, so don't worry
        about that, but you can upgrade when 2.10.2 comes out ]

        $ posttls-finger -c -Lsummary,cache,debug -r 1 "[mail.vex.net]:25"
        posttls-finger: initializing the client-side TLS engine
        posttls-finger: Connected to mail.vex.net[98.158.139.68]:25
        posttls-finger: setting up TLS connection to mail.vex.net[98.158.139.68]:25
        posttls-finger: mail.vex.net[98.158.139.68]:25: TLS cipher list "aNULL:-aNULL:ALL:!EXPORT:!LOW:+RC4:@STRENGTH:!aNULL"
        posttls-finger: looking for session [98.158.139.68]:25&4DFC02A9282C7A786072E811D659A26A14B1127FA5522B7475BFC43B2DB05765 in memory cache
        posttls-finger: SSL_connect:before/connect initialization
        posttls-finger: SSL_connect:SSLv2/v3 write client hello A
        posttls-finger: SSL_connect:SSLv3 read server hello A
        posttls-finger: mail.vex.net[98.158.139.68]:25: depth=1 verify=0 subject=/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO SSL CA
        posttls-finger: mail.vex.net[98.158.139.68]:25: depth=1 verify=0 subject=/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO SSL CA
        posttls-finger: mail.vex.net[98.158.139.68]:25: depth=0 verify=1 subject=/OU=Domain Control Validated/OU=Hosted by Tucows/OU=COMODO SSL Wildcard/CN=*.vex.net
        posttls-finger: SSL_connect:SSLv3 read server certificate A
        posttls-finger: SSL_connect:SSLv3 read server key exchange A
        posttls-finger: SSL_connect:SSLv3 read server done A
        posttls-finger: SSL_connect:SSLv3 write client key exchange A
        posttls-finger: SSL_connect:SSLv3 write change cipher spec A
        posttls-finger: SSL_connect:SSLv3 write finished A
        posttls-finger: SSL_connect:SSLv3 flush data
        posttls-finger: SSL_connect:SSLv3 read server session ticket A
        posttls-finger: SSL_connect:SSLv3 read finished A
        posttls-finger: save session [98.158.139.68]:25&4DFC02A9282C7A786072E811D659A26A14B1127FA5522B7475BFC43B2DB05765 to memory cache
        posttls-finger: certificate verification failed for mail.vex.net[98.158.139.68]:25: untrusted issuer /C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root
        posttls-finger: mail.vex.net[98.158.139.68]:25: subject_CN=*.vex.net, issuer_CN=COMODO SSL CA, fingerprint=D7:7B:08:13:41:F8:B8:B1:CA:DC:A8:5D:56:98:69:25:0A:FD:B4:86, pkey_fingerprint=AD:60:1D:5E:A9:65:65:84:D1:2C:44:29:74:29:2E:F7:B6:BD:C2:BC
        posttls-finger: Untrusted TLS connection established to mail.vex.net[98.158.139.68]:25: TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)
        posttls-finger: Reconnecting after 1 seconds
        posttls-finger: looking for session [98.158.139.68]:25&4DFC02A9282C7A786072E811D659A26A14B1127FA5522B7475BFC43B2DB05765 in memory cache
        posttls-finger: reloaded session [98.158.139.68]:25&4DFC02A9282C7A786072E811D659A26A14B1127FA5522B7475BFC43B2DB05765 from memory cache
        posttls-finger: SSL_connect:before/connect initialization
        posttls-finger: SSL_connect:SSLv3 write client hello A
        posttls-finger: SSL_connect:SSLv3 read server hello A
        posttls-finger: SSL_connect:SSLv3 read finished A
        posttls-finger: SSL_connect:SSLv3 write change cipher spec A
        posttls-finger: SSL_connect:SSLv3 write finished A
        posttls-finger: SSL_connect:SSLv3 flush data
        posttls-finger: mail.vex.net[98.158.139.68]:25: Reusing old session
        posttls-finger: mail.vex.net[98.158.139.68]:25: re-using session with untrusted certificate, look for details earlier in the log
        posttls-finger: Untrusted TLS connection established to mail.vex.net[98.158.139.68]:25: TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)

        --
        Viktor.
      Your message has been successfully submitted and would be delivered to recipients shortly.