· 8 years ago · Sep 22, 2017, 04:14 PM
1~]$ certutil -L -d certs
2
3Certificate Nickname Trust Attributes
4 SSL,S/MIME,JAR/XPI
5
6GeoTrust SSL CA ,,
7VeriSign Class 3 Secure Server CA - G3 ,,
8Microsoft Internet Authority ,,
9VeriSign Class 3 Extended Validation SSL CA ,,
10Akamai Subordinate CA 3 ,,
11MSIT Machine Auth CA 2 ,,
12Google Internet Authority ,,
13
14~]$ certutil -L -n 'Google Internet Authority' -d certs -a > google.cert.asc
15
16~]$ certutil -A -t "C,," -n 'Google Internet Authority' -d certs -i google.cert.asc
17
18~]$ certutil -L -d certs
19
20Certificate Nickname Trust Attributes
21 SSL,S/MIME,JAR/XPI
22...
23Google Internet Authority C,,
24
25~]$ /bin/mailx -A gmail -s "Whadda ya no" somebody@acompany.com
26ho ho ho
27EOT
28~]$
29
30~]$ certutil -A -t "C,,"
31 -n 'gmail.com'
32 -d certs
33 -i 'http://google.com/cert/this...'
34
35# Create a certificate directory
36~]$ mkdir certs
37
38# Create a new database in the certs dir
39~]$ certutil -N -d certs
40
41# Need now a chain certificate - May 18, 2015
42~]$ wget https://www.geotrust.com/resources/root_certificates/certificates/GeoTrust_Global_CA.cer
43
44# Need now a chain certificate part 2 - May 18, 2015
45~]$ mv GeoTrust_Global_CA.cer certs/
46
47# Fetch the certificate from Gmail, saving in the text file GMAILCERT
48# Added the CA opion - May 18, 2015
49~]$ echo -n | openssl s_client -connect smtp.gmail.com:465 -CAfile certs/GeoTrust_Global_CA.cer | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > GMAILCERT
50
51# Import the new cert file into the new database in the new dir
52~]$ certutil -A -n "Google Internet Authority" -t "C,," -d certs -i GMAILCERT
53
54# Double Check
55~]$ certutil -L -d certs
56
57Certificate Nickname Trust Attributes
58 SSL,S/MIME,JAR/XPI
59
60Google Internet Authority C,,
61
62# Create a certificate directory
63mkdir ~/.certs
64
65# Create a new database in the certs dir (dont forget to enter your pass phrase!)
66certutil -N -d ~/.certs
67
68# Create three files for the cert chain
69touch ~/.certs/google ~/.certs/geotrust ~/.certs/equifax
70
71# Copy the cert chain for smtp.google.com:465 over to my_certs file (don't forget the -showcerts option, CTRL + C to end this command)
72openssl s_client -showcerts -connect smtp.gmail.com:465 > ~/.certs/my_certs
73
74# Open your my_certs file you made earlier and copy the google cert (usually the first one)
75nano ~/.certs/my_certs
76
77# Open your google file, paste the google cert that you just copied, and save and close
78nano ~/.certs/google
79
80# Open your my_certs file you made earlier and copy the geotrust cert (usually the second one)
81nano ~/.certs/my_certs
82
83# Open your geotrust file, paste the geotrust cert that you just copied, and save and close
84nano ~/.certs/geotrust
85
86# Open your my_certs file you made earlier and copy the equifax cert (usually the third one)
87nano ~/.certs/my_certs
88
89# Open your equifax file, paste the equifax cert that you just copied, and save and close
90nano ~/.certs/equifax
91
92# Import the google cert into the db
93certutil -A -n "Google Internet Authority" -t "TC,," -d ~/.certs -i ~/.certs/google
94
95# Import the geotrust cert into the db
96certutil -A -n "GeoTrust Global CA" -t "TC,," -d ~/.certs -i ~/.certs/geotrust
97
98# Import the equifax cert into the db
99certutil -A -n "Equifax Secure Certificate Authority" -t "TCP,," -d ~/.certs -i ~/.certs/equifax
100
101# Double check to make sure everything imported correctly into the db
102certutil -L -d ~/.certs
103
104Certificate Nickname Trust Attributes
105 SSL,S/MIME,JAR/XPI
106
107Google Internet Authority CT,,
108GeoTrust Global CA CT,,
109Equifax Secure Certificate Authority CT,,
110
111# Remove all unnecessary files since the db has the certs :)
112rm -rf ~/.certs/google ~/.certs/geotrust ~/.certs/equifax ~/.certs/my_certs
113
114# Now run a test to make sure mailx is sending correctly now (don't forget to change yourname@example.com to the email address you'd like to send to)
115echo "Your message" | mail -s "Message Subject" yourname@example.com
116
117# /etc/mail.rc options added to the bottom
118set smtp-use-starttls
119set smtp-auth=login
120set smtp=smtp://smtp.gmail.com:587
121set from="your.from.user@gmail.com(Web01 Server)"
122set smtp-auth-user=your.smtp.user@gmail.com
123set smtp-auth-password=your.pass
124set ssl-verify=ignore
125set nss-config-dir=/root/.certs