Last active
June 24, 2019 11:20
-
-
Save faizalmansor/9436bb5de206e25057bf6110912109c5 to your computer and use it in GitHub Desktop.
Script to automate installation & configuration of mailx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script : ost-setup-mailx.sh | |
# Author : Osh <[email protected]> | |
# Title : Osh Automated Mailx Installer | |
# Description: Script to automate installation & configuration of mailx | |
# Target OS : Centos 7 | |
echo "Start Osh Automated Mailx Installer..." | |
yum -y update | |
yum install -y mailx | |
cat <<EOT >> /etc/mail.rc | |
set smtp-use-starttls | |
set smtp-auth=login | |
set smtp=smtp://smtp.gmail.com:587 | |
set from="[email protected](YOUR_PROJECT_NAME)" | |
set [email protected] | |
set smtp-auth-password=YOUR_GMAIL_PASSWORD | |
set ssl-verify=ignore | |
set nss-config-dir=~/certs | |
EOT | |
cd ~ | |
mkdir certs | |
certutil -N -d certs | |
wget https://www.geotrust.com/resources/root_certificates/certificates/GeoTrust_Global_CA.cer | |
mv GeoTrust_Global_CA.cer certs/ | |
echo -n | openssl s_client -connect smtp.gmail.com:465 -CAfile certs/GeoTrust_Global_CA.cer | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > GMAILCERT | |
certutil -A -n "Google Internet Authority" -t "C,," -d certs -i GMAILCERT | |
echo "Complete!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Change
YOUR_GMAIL, YOUR_GMAIL_PASSWORD, YOUR_PROJECT_NAME
to your actual settingsThen run
chmod +x ost-setup-mailx.sh
before running the script for the first time.