TL;DR: It works.
On 3/26/20 10:29 AM, Grant Taylor wrote:
> No, I have not tried it /yet/.
I have now tested using OpenSSL's s_client as an SMTPS mailer for
Sendmail and got it working.
Not only did I get it working, but I got it working with client
certificate and key to authenticate with the smart host to allow relaying.
> To be perfectly honest, I assumed that there was something I was
> overlooking and that it wouldn't work. I was counting on you informing
> me of my ignorance Claus. ;-)
Sometimes it's best to try things and see what happens. ;-)
> I also didn't want to disrupt my main mail server.
It's nice having multiple servers that aren't production mail servers to
test things on. }:-)
> I'll poke things on another server as soon as time permits.
I did have to remove the "-crlf" option to get things to work properly.
Things would start working with it, but would hang after the closing dot.
Here's what I currently have on the system that I'm testing things on:
Mrelay, P=/usr/bin/openssl,
F=mDFMuXa8,
S=EnvFromSMTP/HdrFromSMTP,
R=MasqSMTP,
E=\r\n,
L=2040,
T=DNS/RFC822/SMTP,
A=openssl s_client -host $h -port 465 -quiet -cert
/etc/mail/tls/server.crt -key /etc/mail/tls/server.key
For testing I edited
sendmail.cf directly. — I know shame on me.
I was able to test the following define(…) statement to make confirm
that it produces the proper mailer arguments (A=) line.
define(`RELAY_MAILER_ARGS', `openssl s_client -host $h -port 465 -quiet
-cert confCLIENT_CERT -key confCLIENT_KEY')dnl
Aside: I really like how it's possible to re-use the existing macros to
specify the client cert and key.
Note: I don't know how to specify that the relay mailer should use
"/usr/sbin/openssl" instead of "[IPC]" for the program path (P=). But,
I don't think that's strictly necessary for a proof of concept to make
Sendmail be an SMTPS client.
Finally, here's the access entries that I'm using to allow relaying
based on client certificate:
CERTISSUER:/C=US/O=Let's+20Encrypt/CN=Let's+20Encrypt+20Authority+20X3
SUBJECT
CERTSUBJECT:/CN=
server.example.com RELAY
CERTISSUER:…SUBJECT tells Sendmail to search for a CERTSUBJECT entry
with the a that matches the client certificate's subject. If said
CERTSUBJECT entry is RELAY, then the client is allowed to relay. }:-)