I needed my script to email admin if there is a problem, and the company only uses Gmail. Following a few posts instructions I was able to set up mailx using a .mailrc file. there was first the error of nss-config-dir I solved that by copying some .db files from a firefox directory. to ./certs and aiming to it in mailrc. A mail was sent.
However, the error above came up. By some miracle, there was a Google certificate in the .db. It showed up with this command:
~]$ certutil -L -d certs
Certificate Nickname Trust Attributes
SSL,S/MIME,JAR/XPI
GeoTrust SSL CA ,,
VeriSign Class 3 Secure Server CA - G3 ,,
Microsoft Internet Authority ,,
VeriSign Class 3 Extended Validation SSL CA ,,
Akamai Subordinate CA 3 ,,
MSIT Machine Auth CA 2 ,,
Google Internet Authority ,,
Most likely, it can be ignored, because the mail worked anyway. Finally, after pulling some hair and many googles, I found out how to rid myself of the annoyance.
First, export the existing certificate to a ASSCII file:
~]$ certutil -L -n 'Google Internet Authority' -d certs -a > google.cert.asc
Now re-import that file, and mark it as a trusted for SSL certificates, ala:
~]$ certutil -A -t "C,," -n 'Google Internet Authority' -d certs -i google.cert.asc
After this, listing shows it trusted:
~]$ certutil -L -d certs
Certificate Nickname Trust Attributes
SSL,S/MIME,JAR/XPI
...
Google Internet Authority C,,
And mailx sends out with no hitch.
~]$ /bin/mailx -A gmail -s "Whadda ya no" [email protected]
ho ho ho
EOT
~]$
I hope it is helpful to someone looking to be done with the error.
Also, I am curious about somethings.
How could I get this certificate, if it were not in the mozilla database by chance? Is there for instance, something like this?
~]$ certutil -A -t "C,," \
-n 'gmail.com' \
-d certs \
-i 'http://google.com/cert/this...'
Well it is not the one liner I wanted, but this is how to fetch and import a certificate from scratch:
Yaa! and thanks to the answer on this ticket
This post needs to be updated again. I was having trouble with my mailx install on my CentOS 7 box. Mail would send but I was still receiving the "Error in certified: Peer's certificate issuer is not recognized." error.
I found the solution here, had to translate it though.
Here is a quick way to do it:
Now copy each certificate including the --BEGIN CERTIFICATE-- and --END CERTIFICATE-- and paste them into their respective files you created earlier (google, geotrust, equifax) and now save those files.
Now we have to import each of these certs into the db.
Example output:
Clean up time (optional)
That should be it, you shouldn't receive the "Error in certified: Peer's certificate issuer is not recognized." error any more!
Notes:
You might have noticed that I changed the dir from
/certs
to~/.certs
. mailx runs as root so I just made these changes as root/. "~/" means HOME directory put it all together~/.certs
means/root/.certs/
. I'm sure you knew that but hey just in case you never know who might be reading this!Just in case you need this, here is the configuration options I added to the bottom of
/etc/mail.rc
Make sure to change your.from.user, your.smtp.user, and your.pass to their respective variables.
I created a little script, based on the replies in this thread, that will automatically pull, parse, and install the current gmail smtp certs. It should be able to handle it if the number of certs changes again.
Here's a pastebin with syntax highlighting as well
@pyr0ball, just updated little changes in your script and thanks for sharing nice approach :)