• Re: cert-issuer=/C=US/O=Let's+20Encrypt/CN=R3, verifymsg=unable to get

    From Claus =?iso-8859-1?Q?A=DFmann?= @21:1/5 to Michael Grant on Tue Jan 16 03:32:03 2024
    Michael Grant wrote:

    I can't explain where the space character in the Let's Encrypt cert is getting replaced with '+20'.

    Did you check the fine documentation?

    6.7. Encoding of STARTTLS and AUTH related Macros

    Macros that contain STARTTLS and AUTH related
    data which comes from outside sources, e.g., all
    macros containing information from certificates, are
    encoded to avoid problems with non-printable or spe-
    cial characters. The latter are '\', '<', '>', '(',
    ')', '"', '+', and ' '. All of these characters are
    replaced by their value in hexadecimal with a leading
    '+'. For example:

    /C=US/ST=California/O=endmail.org/OU=private/CN=Darth Mail (Cert)/
    Email=darth+cert@endmail.org

    is encoded as:

    /C=US/ST=California/O=endmail.org/OU=private/
    CN=Darth+20Mail+20+28Cert+29/Email=darth+2Bcert@endmail.org

    (line breaks have been inserted for readability). The
    macros which are subject to this encoding are
    {cert_subject}, {cert_issuer}, {cn_subject}, {cn_is-
    suer}, as well as {auth_authen} and {auth_author}.


    --
    Note: please read the netiquette before posting. I will almost never
    reply to top-postings which include a full copy of the previous
    article(s) at the end because it's annoying, shows that the poster
    is too lazy to trim his article, and it's wasting the time of all readers.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Claus =?iso-8859-1?Q?A=DFmann?= @21:1/5 to Michael Grant on Tue Jan 16 04:03:46 2024
    Michael Grant wrote:

    STARTTLS=client, cert-subject=/CN=mail.networkguild.org, cert-issuer=/C=US/O=Let's+20Encrypt/CN=R3, verifymsg=unable to get
    issuer certificate

    My 'CN=mail.networkguild.org' depends on the 'CN=R3' cert. The
    'CN=R3' cert depends on a cert named 'CN = ISRG Root X1'. I
    definitely see that cert both in the chain my mail server presents and
    in /etc/ssl.

    Did you configure sendmail to use /etc/ssl for CACertPath?

    openssl s_client refers to some certs / paths via its
    config or builtin defaults.

    sendmail does not do that.


    --
    Note: please read the netiquette before posting. I will almost never
    reply to top-postings which include a full copy of the previous
    article(s) at the end because it's annoying, shows that the poster
    is too lazy to trim his article, and it's wasting the time of all readers.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Claus =?iso-8859-1?Q?A=DFmann?= @21:1/5 to Michael Grant on Tue Jan 16 11:38:27 2024
    Michael Grant wrote:
    Did you configure sendmail to use /etc/ssl for CACertPath?

    Yes, I have tried both /etc/ssl and /etc/ssl/certs

    Which of the two has the symbolic links for the CAs?
    Do you use different openssl versions (library for sendmail
    vs. openssl program)?

    openssl s_client refers to some certs / paths via its
    config or builtin defaults.

    sendmail does not do that.

    I'm not sure what you mean here. Do you think this might be an openssl issue?

    sendmail does not have any defaults for CAs,
    so config must provide the required information.

    "O=Let's Encrypt" in the issuer to "O=Let's+20Encrypt" in the encoded subject)? Could there be a bug here, I wonder? Just a hypothesis.

    "You can't be serious"...
    The encoding is only used for display purposes.

    The verification is done inside openssl, sendmail doesn't
    "mess" with that - it invokes the proper openssl setup
    functions with your CACertPath/CACertFile and leaves the rest
    to the openssl code.


    Anyway: I just tried it from one of my hosts using sendmail:

    STARTTLS=client, relay=strange.networkguild.org., version=TLSv1.3, verify=OK, cipher=TLS_AES_256_GCM_SHA384, bits=256/256

    so with the right setup it works fine...

    Check the openssl s_client (or verify) options: maybe it can show
    which CAs it uses for verification?

    --
    Note: please read the netiquette before posting. I will almost never
    reply to top-postings which include a full copy of the previous
    article(s) at the end because it's annoying, shows that the poster
    is too lazy to trim his article, and it's wasting the time of all readers.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kalevi Kolttonen@21:1/5 to Michael Grant on Wed Jan 17 17:03:02 2024
    Michael Grant <michael.grant@clinicalandherbal.com> wrote:
    [...]
    openssl s_client returns 'Verify: OK'. I have not found a way
    to get it to show me which files it's using, but it does output
    the certificates.

    Unfortunately I cannot help you with your main problem, but you
    can easily use Linux system call tracing to see which files
    are opened. Just prefix your command with:

    strace -o out -e open

    br,
    KK

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kalevi Kolttonen@21:1/5 to Kalevi Kolttonen on Wed Jan 17 17:25:53 2024
    Kalevi Kolttonen <kalevi@kolttonen.fi> wrote:
    Unfortunately I cannot help you with your main problem, but you
    can easily use Linux system call tracing to see which files
    are opened. Just prefix your command with:

    strace -o out -e open

    Hmm, that gives no matches, but try this instead:

    strace -o out -e openat

    br,
    KK

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Claus =?iso-8859-1?Q?A=DFmann?= @21:1/5 to Michael Grant on Sat Jan 20 03:40:57 2024
    Michael Grant wrote:

    openssl s_client returns 'Verify: OK'. I have not found a way to get it
    to show me which files it's using, but it does output the certificates.

    Write each of those certs into separate files
    and check whether you have them in CACertPath used by sendmail.
    Then check that the correct symbolic links exist too.
    Also make sure all of the involved certs/links are readable
    by everyone.

    If that doesn't help:
    post the output of openssl s_client,
    esp. the certs that are used.


    --
    Note: please read the netiquette before posting. I will almost never
    reply to top-postings which include a full copy of the previous
    article(s) at the end because it's annoying, shows that the poster
    is too lazy to trim his article, and it's wasting the time of all readers.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Claus =?iso-8859-1?Q?A=DFmann?= @21:1/5 to Michael Grant on Tue Jan 23 01:10:39 2024
    Michael Grant wrote:

    I would definitely lay some fault on sendmail here. It could have
    complained about the local cert was depending on an expired cert in its
    chain and that would have forced me to fix the problem without hours of

    Send a patch for another "DontBlameSendmail" option, including tests
    which check the "correctness" of the patch.

    --
    Note: please read the netiquette before posting. I will almost never
    reply to top-postings which include a full copy of the previous
    article(s) at the end because it's annoying, shows that the poster
    is too lazy to trim his article, and it's wasting the time of all readers.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Grant Taylor@21:1/5 to Michael Grant on Tue Jan 23 21:45:47 2024
    I don't see the OP's messages because of all the spam from Google Groups.

    Michael Grant wrote:
    I would definitely lay some fault on sendmail here. It could have
    complained about the local cert was depending on an expired cert in its
    chain and that would have forced me to fix the problem without hours of

    Sendmail is in good company; Apache HTTP Server, NginX, Postfix, and IIS
    will also happily start with expired certs somewhere in the chain.

    Most daemons that I use trust that the system administrator knows what
    they are doing and as such might have a good reason to start using an
    expired cert that is beyond the daemon's understanding.



    --
    Grant. . . .

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Grant Taylor@21:1/5 to Grant Taylor on Wed Jan 24 20:54:21 2024
    On 1/23/24 21:45, Grant Taylor wrote:
    I don't see the OP's messages because of all the spam from Google Groups.

    Thank you for emailing me directly Michael.

    I'm replying here in the hopes that what I write can help multiple people.

    On 1/24/24 19:12, Michael Grant wrote:
    When I send mail from one of my servers to the other (both using
    sendmail 8.17.2), I am seeing this in my mail logs:

    I believe I ran into a similar issue between some (then) 2-4 year old
    Sendmail installs on a pair of my systems a few years ago.

    STARTTLS=client, cert-subject=/CN=mail.networkguild.org, cert-issuer=/C=US/O=Let's+20Encrypt/CN=R3, verifymsg=unable to get
    issuer certificate

    This looks very familiar to me.

    If I verify the cert by hand using:

    openssl s_client -starttls smtp -showcerts -connect
    mail.networkguild.org:25 -servername mail.networkguild.org

    Please elaborate on what "verify" means in this context. Are you
    checking / comparing things by hand / script (grep, et al.)? Or are you
    using the `openssl verify` (sub)command?

    % time (openssl s_client -starttls smtp -showcerts -connect mail.networkguild.org:25 -servername mail.networkguild.org < /dev/null
    |& openssl verify)
    stdin: OK
    ( openssl s_client -starttls smtp -showcerts -connect
    mail.networkguild.org:2) 0.01s user 0.00s system 0% cpu 13.132 total

    Aside: I'm surprised that it's taking 13 seconds to do this. I can
    only assume that you have something akin to pre-greeting traffic
    filtering. Though I would think that would be after the TCP+TLS
    connection establishes and before the SMTP greeting banner.

    it verifies OK and sees all the certificates in the chain.

    This seems remarkably similar to an issue I had between the two systems
    running Sendmail alluded to above.

    From memory, what I found after hours of digging is that one of the
    root certificates that was then used to cross sign the Let's Encrypt certificates had expired.

    Like you I was providing the full chain.

    But something about the OpenSSL install I was using still wasn't happy.

    I don't have notes at hand, but I remember one of the root certificate
    files in /etc/ssl/certs contained the current LE root /and/ the expired
    cross signing cert (full chain of sorts). This expired cross signing
    cert was being found and used by OpenSSL /before/ the current cross
    signing cert in the same /etc/ssl/certs directory.

    ...

    Yep, looking back at the script that I'm using to manage certificates
    collected by acme.sh (I don't let acme.sh install things for me) I see
    that the ca.cer (PEM) file that it downloads contains two certificates:

    1st what is probably best described as an intermediate certificate:

    subject= /C=US/O=Let's Encrypt/CN=R3
    notBefore=Sep 4 00:00:00 2020 GMT
    notAfter=Sep 15 16:00:00 2025 GMT
    serial=912B084ACF0C18A753F6D62E25A75F5A
    issuer= /C=US/O=Internet Security Research Group/CN=ISRG Root X1

    2nd what is probably best described as the root certificate:

    subject= /C=US/O=Internet Security Research Group/CN=ISRG Root X1
    notBefore=Jan 20 19:14:03 2021 GMT
    notAfter=Sep 30 18:14:03 2024 GMT
    serial=4001772137D4E942B8EE76AA3C640AB7
    issuer= /O=Digital Signature Trust Co./CN=DST Root CA X3

    The above output came from the following command:

    cat ca.cer | awk 'BEGIN{cmd="openssl x509 -noout -subject -dates -serial -issuer -extensions subjectAltName; echo"}/BEGIN CERTIFICATE/,/END CERTIFICATE/{print | cmd}/END CERTIFICATE/{close(cmd)}'

    So, I'm having openssl read in ca.cer and write out the first
    certificate to another file. -- I then use /just/ the one certificate (currently serial=912B084ACF0C18A753F6D62E25A75F5A) and my certificate
    to generate a new chain that doesn't include the other (expired at the
    time I worked on this) certs in the chain.

    As best as I could tell, this was all about things in the full chain
    file from acme.sh (I don't know if it amalgamated it or if it acme.sh
    simply downloaded it from somewhere else, maybe Let's Encrypt
    themselves) being expired and the expired root cert being used /before/
    OpenSSL would use the (then) current / new root cert in /etc/ssl/certs.

    Upon spot checking this, I found that there was a smattering of
    different numbers of certs in different files in /etc/ssl/certs.

    Fortunately for me I was able to work around the problem for Let's
    Encrypt which is what I cared about.

    I am indeed using the fullchain.pem file in my sendmail config. I've
    tried using both fullchain.pem and cert.pem as the CAcert file,
    result is the same.

    I currently have the following in my sendmail.cf file (set via sendmail.mc):

    # CA directory
    O CACertPath=/etc/ssl/certs
    # CA file
    O CACertFile=/etc/mail/tls/letsencrypt-ca.cer

    I want to say that the CACertFile wasn't strictly necessary after I
    fixed things in the CACertPath.

    N.B. the CACertFile is the file I extract just the 1st certificate
    (currently serial=912B084ACF0C18A753F6D62E25A75F5A) into.

    My 'CN=mail.networkguild.org' depends on the 'CN=R3' cert. The 'CN=R3'
    cert depends on a cert named 'CN = ISRG Root X1'. I definitely see
    that cert both in the chain my mail server presents and in /etc/ssl.

    This seems strikingly familiar.

    I suspect that if (when) you dig, you will find that there may be an
    expired certificate in another file, possibly the full chain file, that
    is interfering with you.

    I'm not sure if this is a debian issue, a sendmail issue, or a cert
    issue. The fact that my cert verifies from other sites seems to
    indicate it may be a sendmail sending issue, but I'm not sure.

    The systems that I ran into this issue on was a (now) ~5 year old Ubuntu install. So it may be an upstream Debian issue that Ubuntu is inheriting.

    Or it may have been a bug in the acme.sh client version I was using at
    the time.

    Anyone have any ideas how to get sendmail to say this cert is valid?

    As you can see above, the system that I'm talking about thinks that your server's certificate /is/ valid and /does/ verify.

    This is a VERY DEEP in the weeds issue. I spent hours over a few days debugging this.

    I spent the time debugging this because my servers are using their
    certificate when they are sending / relaying through each other and I'm allowing relay based on CERTISSUER+CERTSUBJECT in AccessDB:

    # Allow <SERVER> to relay based on client TLS certificate.
    CERTISSUER:/C=US/O=Let's+20Encrypt/CN=R3 SUBJECT
    CERTSUBJECT:/CN=<SERVER1 subject> RELAY
    CERTSUBJECT:/CN=<SERVER2 subject> RELAY

    Please feel free to email me again if you'd like to discuss any private
    command output / investigation.

    I hope my write is helpful.



    --
    Grant. . . .

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)