Discussion:
Mageia 9 - Certificate for sending email
(too old to reply)
Gilberto F da Silva
2023-03-19 01:12:06 UTC
Permalink
MSMTP needs a certificate to be able to send emails but it is not
available in Mageia 9 repositories.

- --

Abraços

Gilberto F da Silva
David W. Hodgins
2023-03-19 03:17:58 UTC
Permalink
Post by Gilberto F da Silva
MSMTP needs a certificate to be able to send emails but it is not
available in Mageia 9 repositories.
The msmtp is provided as it comes from the author. I use postfix instead which
includes an install scriptlet in the rpm package that creates the cert.

Before installing postfix, make sure the hostname is a valid dns name, not
localhost or localhost.localdomain.

Once installed modify /etc/postfix/aliases to have your loginid in place of
root where the comment says "# CHANGE THIS LINE to an account of a HUMAN",
then start it's deamon.

You could continue using msmtp, but you'd have to create a cert and ensure
it gets started at boot. It's much easier to just use postfix instead.

If you want to create a cert, the easiest way would be (after ensuring
the $HOSTNAME is a real dns valid hostname) run
/usr/share/rpm-helper/create-ssl-certificate msmtp 1 msmtp

Starting /usr/bin/msmtpd at boot would require either writing a systemd
config file or creating/modifying an initd script.

Regards, Dave Hodgins
Gilberto F da Silva
2023-03-19 14:00:44 UTC
Permalink
On Sat, 18 Mar 2023 21:12:06 -0400, Gilberto F da Silva
Post by Gilberto F da Silva
MSMTP needs a certificate to be able to send emails but it is
not available in Mageia 9 repositories.
The msmtp is provided as it comes from the author. I use postfix
instead which includes an install scriptlet in the rpm package that
creates the cert.
Before installing postfix, make sure the hostname is a valid dns
name, not localhost or localhost.localdomain.
Once installed modify /etc/postfix/aliases to have your loginid in
place of root where the comment says "# CHANGE THIS LINE to an
account of a HUMAN", then start it's deamon.
You could continue using msmtp, but you'd have to create a cert and
ensure it gets started at boot. It's much easier to just use
postfix instead.
If you want to create a cert, the easiest way would be (after
ensuring the $HOSTNAME is a real dns valid hostname) run
/usr/share/rpm-helper/create-ssl-certificate msmtp 1 msmtp
Starting /usr/bin/msmtpd at boot would require either writing a
systemd config file or creating/modifying an initd script.
I don't like switching programs unless absolutely necessary. msmtp is
working fine on the other distributions that are installed. One of
them doesn't use systemd. I would certainly have a lot of difficulty
adapting this solution in this case.

- --

Abraços

Gilberto F da Silva
Gilberto F da Silva
2023-03-19 14:16:24 UTC
Permalink
On Sat, 18 Mar 2023 21:12:06 -0400, Gilberto F da Silva
Post by Gilberto F da Silva
MSMTP needs a certificate to be able to send emails but it is
not available in Mageia 9 repositories.
The msmtp is provided as it comes from the author. I use postfix
instead which includes an install scriptlet in the rpm package that
creates the cert.
Before installing postfix, make sure the hostname is a valid dns
name, not localhost or localhost.localdomain.
Once installed modify /etc/postfix/aliases to have your loginid in
place of root where the comment says "# CHANGE THIS LINE to an
account of a HUMAN", then start it's deamon.
You could continue using msmtp, but you'd have to create a cert and
ensure it gets started at boot. It's much easier to just use
postfix instead.
If you want to create a cert, the easiest way would be (after
ensuring the $HOSTNAME is a real dns valid hostname) run
/usr/share/rpm-helper/create-ssl-certificate msmtp 1 msmtp
Starting /usr/bin/msmtpd at boot would require either writing a
systemd config file or creating/modifying an initd script.
ChatGPT provided the solution. It showed me how to get the
certificates with the command:

openssl s_client -connect smtp.gmail.com:465 -showcerts

Once shown the path, I got the certificates for yahoo as well. I
copied parts from:
- -----BEGIN CERTIFICATE-----
MIIFYjCCBEqgAwIBAgIQd70NbNs2+RrqIQ/E8FjTDTANBgkqhkiG9w0BAQsFADBX ...

Until
...
d0lIKO2d1xozclOzgjXPYovJJIultzkMu34qQb9Sz/yilrbCgj8=
- -----END CERTIFICATE-----

in a file with each certificate after the other without leaving any
blank spaces between them. I renamed the file as expected by msmtp and
placed it in the path also expected by msmtp.



- --

Abraços

Gilberto F da Silva

Loading...