Skip to content
This repository has been archived by the owner on Jan 27, 2024. It is now read-only.

Commit

Permalink
Issue #399
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentTNT committed Oct 12, 2017
1 parent 3ab278d commit 410e7ea
Show file tree
Hide file tree
Showing 5 changed files with 215 additions and 12 deletions.
71 changes: 67 additions & 4 deletions build/EFA/EFA-Init
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,31 @@ function func_ask-adminemail() {
}
# +---------------------------------------------------+

# +---------------------------------------------------+
function func_ask-mailwatchemail() {
func_echo-header
echo -e "$green[eFa]$clean Please enter the email address to be used within MailWatch to send reports "
echo -e "$green[eFa]$clean This address will be the source of all related notifications from MailWatch"
echo -e -n "$green[eFa]$clean : "
read MAILWATCHEMAIL
mailwatchemailcheck=1
while [ $mailwatchemailcheck != 0 ]
do
if [[ $MAILWATCHEMAIL =~ ^[-_.@Aa-zA-Z0-9]{2,256}+[a-zA-Z0-9]+([\-\.]{1}[a-zA-Z0-9]+)*\.[a-z]{2,6}$ ]]
then
mailwatchemailcheck=0
else
echo -e " $red ERROR: The address $MAILWATCHEMAIL seems to be invalid"
echo -e " ERROR: please re-enter the MailWatch email address$clean"
echo -e "$green[eFa]$clean Please enter the email address to be used within MailWatch to send reports "
echo -e "$green[eFa]$clean This address will be the source of all related notifications from MailWatch"
echo -e -n "$green[eFa]$clean : "
read MAILWATCHEMAIL
fi
done
}
# +---------------------------------------------------+

# +---------------------------------------------------+
function func_ask-postmasteremail() {
func_echo-header
Expand All @@ -112,18 +137,52 @@ function func_ask-postmasteremail() {
if [[ $POSTMASTEREMAIL =~ ^[-_.@Aa-zA-Z0-9]{2,256}+[a-zA-Z0-9]+([\-\.]{1}[a-zA-Z0-9]+)*\.[a-z]{2,6}$ ]]
then
postmasteremailcheck=0
# Change postfix configuration
postconf -e notify_classes="resource, software, delay, bounce"
postconf -e 2bounce_notice_recipient="$POSTMASTEREMAIL"
postconf -e bounce_notice_recipient="$POSTMASTEREMAIL"
postconf -e delay_notice_recipient="$POSTMASTEREMAIL"
postconf -e error_notice_recipient="$POSTMASTEREMAIL"
else
echo -e " $red ERROR: The address $POSTMASTEREMAIL seems to be invalid"
echo -e " ERROR: please re-enter the admin email address$clean"
echo -e "$green[eFa]$clean Please enter the email address of an admin "
echo -e "$green[eFa]$clean This user will receive eFa related notifications"
echo -e "$green[eFa]$clean This user will receive eFa related postfix notifications"
echo -e -n "$green[eFa]$clean : "
read POSTMASTEREMAIL
fi
done
}
# +---------------------------------------------------+




# +---------------------------------------------------+
function func_ask-cronsourceemail() {
func_echo-header
echo -e "$green[eFa]$clean Please enter the email address to be used when sending system alerts "
echo -e "$green[eFa]$clean This address will be the source of all related notifications from local system alerts"
echo -e -n "$green[eFa]$clean : "
read CRONSOURCEEMAIL
cronsourceemailcheck=1
while [ $cronsourceemailcheck != 0 ]
do
if [[ $CRONSOURCEEMAIL =~ ^[-_.@Aa-zA-Z0-9]{2,256}+[a-zA-Z0-9]+([\-\.]{1}[a-zA-Z0-9]+)*\.[a-z]{2,6}$ ]]
then
cronsourceemailcheck=0
else
echo -e " $red ERROR: The address $CRONSOURCEEMAIL seems to be invalid"
echo -e " ERROR: please re-enter the Cron Source email address$clean"
echo -e "$green[eFa]$clean Please enter the email address to be used when sending system alerts "
echo -e "$green[eFa]$clean This address will be the source of all related notifications from local system alerts"
echo -e -n "$green[eFa]$clean : "
read CRONSOURCEEMAIL
fi
done
}
# +---------------------------------------------------+

# +---------------------------------------------------+
function func_ask-ipaddress() {
func_echo-header
Expand Down Expand Up @@ -863,9 +922,9 @@ function func_configure-system() {

# +--------------------------------------------------+
echo -e "$green[eFa]$clean - Configuring MailWatch"
sed -i "/^define('QUARANTINE_FROM_ADDR',/ c\define('QUARANTINE_FROM_ADDR', 'postmaster@$DOMAINNAME');" /var/www/html/mailscanner/conf.php
#sed -i "/^define('QUARANTINE_FROM_ADDR',/ c\define('QUARANTINE_FROM_ADDR', 'postmaster@$DOMAINNAME');" /var/www/html/mailscanner/conf.php
sed -i "/^define('TIME_ZONE',/ c\define('TIME_ZONE', '$TZONE');" /var/www/html/mailscanner/conf.php
sed -i "/^define('MAILWATCH_FROM_ADDR'/ c\define('MAILWATCH_FROM_ADDR', '$POSTMASTEREMAIL');" /var/www/html/mailscanner/conf.php
sed -i "/^define('MAILWATCH_FROM_ADDR'/ c\define('MAILWATCH_FROM_ADDR', '$MAILWATCHEMAIL');" /var/www/html/mailscanner/conf.php
sed -i "/^define('MAILWATCH_HOSTURL'/ c\define('MAILWATCH_HOSTURL', 'https:\/\/' . rtrim(gethostname()) . '\/mailscanner');" /var/www/html/mailscanner/conf.php
# +--------------------------------------------------+

Expand Down Expand Up @@ -1070,6 +1129,8 @@ function func_end() {
echo "MYSQLROOTPWD:$MYSQLROOTPWD" >> /etc/EFA-Config
echo "MUNINPWD:$MUNINPWD" >> /etc/EFA-Config
echo "POSTMASTEREMAIL:$POSTMASTEREMAIL" >> /etc/EFA-Config
echo "MAILWATCHEMAIL:$MAILWATCHEMAIL" >> /etc/EFA-Config
echo "CRONSOURCEEMAIL:$CRONSOURCEEMAIL" >> /etc/EFA-Config
if [[ "$enableupdates" -eq 1 ]]; then
echo "AUTOUPDATES:ENABLED" >> /etc/EFA-Config
else
Expand Down Expand Up @@ -1277,7 +1338,9 @@ if [ $CONFIGURED == "NO" ]
func_ask-hostname
func_ask-domainname
func_ask-adminemail
func_ask-postmasteremail
func_ask-postmasteremail
func_ask-mailwatchemail
func_ask-cronsourceemail
func_ask-ipaddress
func_ask-netmask
func_ask-gateway
Expand Down
8 changes: 8 additions & 0 deletions build/EFA/lib-EFA-Configure/func_dkim_dmarc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ func_echo-header


#Remove Apps and saved files
service opendmarc stop
chkconfig opendmarc off
service opendkim stop
chkconfig opendkim off
yum remove -y opendkim opendmarc
rm -rf /etc/opendmarc.conf.rpmsave
rm -rf /etc/opendkim.conf.rpmsave
Expand Down Expand Up @@ -139,6 +143,7 @@ func_echo-header
echo -e -n "$green[eFa]$clean : "
read DMARCRepDomain
fi
done


echo -e "$green[eFa]$clean $DMARCRepDomain will be the organization used to to send reports."
Expand All @@ -160,12 +165,15 @@ func_echo-header
echo -e -n "$green[eFa]$clean : "
read DMARCRepEmail
fi
done
echo -e "$green[eFa]$clean $DMARCRepEmail will be the address used to to send reports."
echo "DMARCREPEMAIL:$DMARCRepEmail" >> /etc/EFA-Config

echo -e "Starting services..."
service opendmarc start
chkconfig opendmarc on
service opendkim start
chkconfig opendkim on
service postfix stop
service postfix start
echo -e "System is ready to use OpenDKIM and OpenDMARC"
Expand Down
123 changes: 120 additions & 3 deletions build/EFA/lib-EFA-Configure/func_mailsettings
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ func_mail-settings(){
echo -e "3) Admin Email"
echo -e "4) Transport settings"
echo -e "5) Postmaster Email"
echo -e "6) MailWatch Email"
echo -e "7) Cron Source Email"
echo -e "8) DMARC Reporter Email"
echo -e ""
echo -e "e) Return to main menu"
echo -e ""
Expand All @@ -26,6 +29,9 @@ func_mail-settings(){
3) func_adminemail;;
4) func_transport-settings;;
5) func_postmasteremail;;
6) func_mailwatchemail;;
7) func_cronsourceemail;;
8) func_dmarcrepemail;;
e) menu=1 && return ;;
*) echo -e "Error \"$choice\" is not an option..." && pause
esac
Expand Down Expand Up @@ -244,7 +250,7 @@ func_adminemail(){
func_echo-header
echo -e ""
echo -e "Description:"
echo -e "With this option you can change the E.F.A. admin email address."
echo -e "With this option you can change the eFa admin email address."
echo -e "This address is used for various system alerts and notifications."
echo -e ""
echo -e "Current settings are:"
Expand Down Expand Up @@ -286,7 +292,7 @@ func_postmasteremail(){
func_echo-header
echo -e ""
echo -e "Description:"
echo -e "With this option you can change the E.F.A. postmaster email address."
echo -e "With this option you can change the eFa postmaster email address."
echo -e "This address is used for various postfix alerts and notifications."
echo -e ""
echo -e "Current settings are:"
Expand Down Expand Up @@ -330,6 +336,117 @@ func_postmasteremail(){
}
# +---------------------------------------------------+

# +---------------------------------------------------+
# Configure MailWatch email
# +---------------------------------------------------+
func_mailwatchemail(){
mwemenu=1
MAILWATCHEMAIL="`cat /etc/EFA-Config | grep MAILWATCHEMAIL | sed 's/.*://'`"
while [ $mwemenu == "1" ]
do
func_echo-header
echo -e ""
echo -e "Description:"
echo -e "With this option you can change MailWatch email address."
echo -e "This address is used for sending MailWatch reports and notifications."
echo -e ""
echo -e "Current settings are:"
echo -e "1) MailWatch email: $MAILWATCHEMAIL"
echo -e ""
echo -e "e) Return to main menu"
local choice
read -p "Enter setting you want to change: " choice
case $choice in
1) mwemenu=0
echo -e ""
echo -e "Enter your new admin email address"
echo -e ""
read -p "> " MAILWATCHEMAIL
sed -i "/MAILWATCHEMAIL\:/ c\MAILWATCHEMAIL\:$MAILWATCHEMAIL" /etc/EFA-Config
sed -i "/^define('MAILWATCH_FROM_ADDR'/ c\define('MAILWATCH_FROM_ADDR', '$MAILWATCHEMAIL');" /var/www/html/mailscanner/conf.php

mwemenu=1
;;
e) mailmenu=1 && return ;;
*) echo -e "Error \"$choice\" is not an option..." && pause
esac
done
}
# +---------------------------------------------------+

# +---------------------------------------------------+
# Configure Cron Source email
# +---------------------------------------------------+
func_cronsourceemail(){
csemenu=1
CRONSOURCEEMAIL="`cat /etc/EFA-Config | grep CRONSOURCEEMAIL | sed 's/.*://'`"
while [ $csemenu == "1" ]
do
func_echo-header
echo -e ""
echo -e "Description:"
echo -e "With this option you can change the eFa cron email address."
echo -e "This address is used for various system alerts and notifications."
echo -e ""
echo -e "Current settings are:"
echo -e "1) Cron Source email: $CRONSOURCEEMAIL"
echo -e ""
echo -e "e) Return to main menu"
local choice
read -p "Enter setting you want to change: " choice
case $choice in
1) csemenu=0
echo -e ""
echo -e "Enter your new admin email address"
echo -e ""
read -p "> " CRONSOURCEEMAIL
sed -i "/CRONSOURCEEMAIL\:/ c\CRONSOURCEEMAIL\:$CRONSOURCEEMAIL" /etc/EFA-Config
csemenu=1
;;
e) mailmenu=1 && return ;;
*) echo -e "Error \"$choice\" is not an option..." && pause
esac
done
}
# +---------------------------------------------------+

# +---------------------------------------------------+
# Configure DMARC Rep email
# +---------------------------------------------------+
func_dmarcrepemail(){
dremenu=1
DMARCREPEMAIL="`cat /etc/EFA-Config | grep DMARCREPEMAIL | sed 's/.*://'`"
while [ $dremenu == "1" ]
do
func_echo-header
echo -e ""
echo -e "Description:"
echo -e "With this option you can change DMARC Reporter email address."
echo -e "This address is used for sending DMARC reports and notifications."
echo -e ""
echo -e "Current settings are:"
echo -e "1) DMARC Reporter Email: $DMARCREPEMAIL"
echo -e ""
echo -e "e) Return to main menu"
local choice
read -p "Enter setting you want to change: " choice
case $choice in
1) dremenu=0
echo -e ""
echo -e "Enter your new admin email address"
echo -e ""
read -p "> " DMARCREPEMAIL
sed -i "/DMARCREPEMAIL\:/ c\DMARCREPEMAIL\:$DMARCREPEMAIL" /etc/EFA-Config

dremenu=1
;;
e) mailmenu=1 && return ;;
*) echo -e "Error \"$choice\" is not an option..." && pause
esac
done
}
# +---------------------------------------------------+

# +---------------------------------------------------+
# Configure outbound relay
# +---------------------------------------------------+
Expand All @@ -341,7 +458,7 @@ func_outbound-relay(){
func_echo-header
echo " "
echo "Description:"
echo "With this option you can configure E.F.A."
echo "With this option you can configure eFa"
echo "to relay outgoing message for your local"
echo "mail-server or clients."
echo ""
Expand Down
7 changes: 7 additions & 0 deletions build/build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -1448,6 +1448,13 @@ func_cron () {
chmod 700 /etc/cron.daily/EFA-Backup-cron
/usr/bin/wget --no-check-certificate -O /usr/local/sbin/EFA-Renew-Certs $gitdlurl/EFA/EFA-Renew-Certs
chmod 700 /usr/local/sbin/EFA-Renew-Certs

/usr/bin/wget --no-check-certificate -O /usr/local/sbin/EFA-Daily-DMARC $gitdlurl/EFA/EFA-Daily-DMARC
chmod 700 /usr/local/sbin/EFA-Daily-DMARC
/usr/bin/wget --no-check-certificate -O /usr/local/sbin/EFA-Weekly-DMARC $gitdlurl/EFA/EFA-Weekly-DMARC
chmod 700 /usr/local/sbin/EFA-Weekly-DMARC
/usr/bin/wget --no-check-certificate -O /usr/local/sbin/DMARC-Schema.sql $gitdlurl/EFA/DMARC-Schema.sql


# Remove the raid-check util (Issue #102)
rm -f /etc/cron.d/raid-check
Expand Down
18 changes: 13 additions & 5 deletions update/versions/EFA-Version-Upgrade-3.0.2.6
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function run_update() {
# Harden apache v3.0.2.5 (disabled v3.0.2.6)
#harden_apache

# Update Quarantine v3.0.2.5 (disabled v3.0.2.6)
# Update Quarantine introduced in v3.0.2.5, disabled v3.0.2.6
#update_quarantine

# Install certbot v3.0.2.5 (disabled v3.0.2.6)
Expand All @@ -144,7 +144,15 @@ function run_update() {
#update URLs in SSH/Console v3.0.2.6 (TODO disable 3.0.2.7)
sed -i "/Welcome to E.F.A. (http:\/\/www.efa-project.org)/ c\ Welcome to eFa (https:\/\/www.efa-project.org)" /etc/banner
sed -i "/http:\/\/www.efa-project.org/ c\ https:\/\/www.efa-project.org" /etc/issue


#POSTMASTEREMAIL is not used and not defined in very old instances
#defining it as ADMINEMAIL, deleting exisitng value, and writing new vlaue
#users can then change it
POSTMASTEREMAIL="`grep ADMINEMAIL /etc/EFA-Config | sed 's/^.*://'`"
sed -i "/^POSTMASTEREMAIL/d" /etc/EFA-Config
echo "POSTMASTEREMAIL:$POSTMASTEREMAIL" >> /etc/EFA-Config


# Issue #378 Disable mod_security for 3.0.2.4 (disabled v3.0.2.6)
#sed -i "/^LoadModule security2_module modules\/mod_security2.so/ c\#LoadModule security2_module modules/mod_security2.so" /etc/httpd/conf.d/mod_security.conf
#service httpd restart
Expand Down Expand Up @@ -863,9 +871,9 @@ function randompw()
# Update quarantine email options
# +---------------------------------------------------+
function update_quarantine() {
local POSTMASTEREMAIL
POSTMASTEREMAIL="`grep POSTMASTEREMAIL /etc/EFA-Config | sed 's/^.*://'`"
sed -i "/^define('MAILWATCH_FROM_ADDR'/ c\define('MAILWATCH_FROM_ADDR', '$POSTMASTEREMAIL');" /var/www/html/mailscanner/conf.php
local MAILWATCHEMAIL
MAILWATCHEMAIL="`grep MAILWATCHEMAIL /etc/EFA-Config | sed 's/^.*://'`"
sed -i "/^define('MAILWATCH_FROM_ADDR'/ c\define('MAILWATCH_FROM_ADDR', '$MAILWATCHEMAIL');" /var/www/html/mailscanner/conf.php
sed -i "/^define('MAILWATCH_HOSTURL'/ c\define('MAILWATCH_HOSTURL', 'https:\/\/' . rtrim(gethostname()) . '\/mailscanner');" /var/www/html/mailscanner/conf.php
}
# +---------------------------------------------------+
Expand Down

0 comments on commit 410e7ea

Please sign in to comment.