Gen DNS OK
This commit is contained in:
parent
9701eb229a
commit
b4dd6a15e8
@ -1,2 +1,6 @@
|
|||||||
# Exim
|
# Exim
|
||||||
|
|
||||||
|
## TODO
|
||||||
|
|
||||||
|
- Enable Spamd and ClamAV in exim4.conf
|
||||||
|
- Add and delete user
|
||||||
|
@ -12,14 +12,14 @@ CHECK_RCPT_REMOTE_LOCALPARTS = ^[./|] : ^.*[@%%!`#&?] : ^.*/\\.\\./
|
|||||||
|
|
||||||
DKIM_ENABLE = 1
|
DKIM_ENABLE = 1
|
||||||
DKIM_SELECTOR = x
|
DKIM_SELECTOR = x
|
||||||
DKIM_PRIVATE_KEY = /etc/exim4/dkim/private.key
|
DKIM_PRIVATE_KEY = /etc/exim4/dkim.key
|
||||||
DKIM_CANON = relaxed
|
DKIM_CANON = relaxed
|
||||||
DKIM_STRICT = 1
|
DKIM_STRICT = 1
|
||||||
|
|
||||||
TLS_ENABLE = 1
|
TLS_ENABLE = 1
|
||||||
TLS_ADVERTISE_HOSTS = *
|
TLS_ADVERTISE_HOSTS = *
|
||||||
TLS_CERTIFICATE = /etc/exim4/tls/mail.crt
|
TLS_CERTIFICATE = /etc/exim4/exim.crt
|
||||||
TLS_PRIVATEKEY = /etc/exim4/tls/mail.key
|
TLS_PRIVATEKEY = /etc/exim4/exim.key
|
||||||
TLS_VERIFY_CERTIFICATES = ${if exists{/etc/ssl/certs/ca-certificates.crt} {/etc/ssl/certs/ca-certificates.crt} {/dev/null}}
|
TLS_VERIFY_CERTIFICATES = ${if exists{/etc/ssl/certs/ca-certificates.crt} {/etc/ssl/certs/ca-certificates.crt} {/dev/null}}
|
||||||
|
|
||||||
COURIERSOCKET = /var/run/courier/authdaemon/socket
|
COURIERSOCKET = /var/run/courier/authdaemon/socket
|
||||||
|
@ -22,17 +22,10 @@ install_ask_domain() {
|
|||||||
[[ -z $choice ]] && install_ask_domain
|
[[ -z $choice ]] && install_ask_domain
|
||||||
}
|
}
|
||||||
|
|
||||||
install_tls_dkim() {
|
|
||||||
mkdir -pv /etc/exim4/tls
|
|
||||||
openssl req -x509 -newkey rsa -keyout /etc/exim4/tls/mail.key -out /etc/exim4/tls/mail.crt -days 4096 -nodes
|
|
||||||
mkdir -pv /etc/exim4/dkim
|
|
||||||
openssl genrsa -out /etc/exim4/dkim/private.key 2048
|
|
||||||
}
|
|
||||||
|
|
||||||
install_exim() {
|
install_exim() {
|
||||||
install_ask_domain
|
install_ask_domain
|
||||||
echo -e "${YEL}Two boxes will appear. Hit [Enter] each time to continue.${STD}"
|
echo -e "${YEL}Two boxes will appear. Hit [Enter] each time to continue.${STD}"
|
||||||
echo "Press [Enter] key to continue..."
|
read -p "Press [Enter] key to continue..."
|
||||||
aptitude -y install exim4 courier-imap courier-imap-ssl courier-pop courier-pop-ssl courier-authlib-userdb ssl-cert
|
aptitude -y install exim4 courier-imap courier-imap-ssl courier-pop courier-pop-ssl courier-authlib-userdb ssl-cert
|
||||||
chown -fvR daemon: courier/*
|
chown -fvR daemon: courier/*
|
||||||
cp -fv courier/* /etc/courier/
|
cp -fv courier/* /etc/courier/
|
||||||
@ -41,17 +34,22 @@ install_exim() {
|
|||||||
mkdir -pv /etc/exim.forward
|
mkdir -pv /etc/exim.forward
|
||||||
cp -fv exim4/* /etc/exim4/
|
cp -fv exim4/* /etc/exim4/
|
||||||
chmod -fv 777 /var/run/courier/authdaemon/socket
|
chmod -fv 777 /var/run/courier/authdaemon/socket
|
||||||
install_tls_dkim
|
/usr/share/doc/exim4-base/examples/exim-gencert
|
||||||
|
openssl genrsa -out /etc/exim4/dkim.key 2048
|
||||||
|
install_restart
|
||||||
|
gen_public_dns
|
||||||
}
|
}
|
||||||
|
|
||||||
install_spamassassin() {
|
install_spamassassin() {
|
||||||
aptitude -y install exim4-daemon-heavy sa-exim spamassassin
|
aptitude -y install exim4-daemon-heavy sa-exim spamassassin
|
||||||
cp -fv spamd/sa-learn /etc/cron.daily/sa-learn
|
cp -fv spamd/sa-learn /etc/cron.daily/sa-learn
|
||||||
cp -fv spamd/spamassassin /etc/default/spamassassin
|
cp -fv spamd/spamassassin /etc/default/spamassassin
|
||||||
|
install_restart
|
||||||
}
|
}
|
||||||
|
|
||||||
install_clamav() {
|
install_clamav() {
|
||||||
aptitude -y install exim4-daemon-heavy clamav clamav-daemon
|
aptitude -y install exim4-daemon-heavy clamav clamav-daemon
|
||||||
|
install_restart
|
||||||
}
|
}
|
||||||
|
|
||||||
install_restart() {
|
install_restart() {
|
||||||
@ -63,20 +61,34 @@ install_restart() {
|
|||||||
service exim4 restart
|
service exim4 restart
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gen_public_dns() {
|
||||||
|
DNS=$(sudo openssl rsa -in /etc/exim4/dkim.key -pubout)
|
||||||
|
DNS=$(echo ${DNS} | sed "s/ //g" | sed "s/.*Y-----\(.*\)-----E.*/\1/g")
|
||||||
|
echo -e "${YEL}Please put these pointers on your DNS provider :${STD}"
|
||||||
|
echo -e '\t\t10800 IN MX 10 <domain>'
|
||||||
|
echo -e '\t\t10800 IN TXT "v=spf1 a -all"'
|
||||||
|
echo -e '_domainkey\t10800 IN TXT "o=~; r=postmaster@<domain>"'
|
||||||
|
echo -e "x._domainkey\t10800 IN TXT \"v=DKIM1; k=rsa; p=${DNS}\""
|
||||||
|
echo -e '_dmarc\t\t10800 IN TXT "v=DMARC1; p=quarantine"'
|
||||||
|
read -p "Press [Enter] key to continue..."
|
||||||
|
}
|
||||||
|
|
||||||
install_mailserver() {
|
install_mailserver() {
|
||||||
echo "Do you want to install extra software ?"
|
echo "Do you want to install extra software ?"
|
||||||
echo "1. None"
|
echo "1. None"
|
||||||
echo "2. SpamAssassin (antispam)"
|
echo "2. SpamAssassin (antispam)"
|
||||||
echo "3. ClamAV (antivirus)"
|
echo "3. ClamAV (antivirus)"
|
||||||
echo "4. Both SpamAssassin and ClamAV"
|
echo "4. Both SpamAssassin and ClamAV"
|
||||||
echo "5. Exit"
|
echo "5. Show DNS config"
|
||||||
read -p "Enter choice [1 - 4] " choice
|
echo "6. Exit"
|
||||||
|
read -p "Enter choice [1 - 6] " choice
|
||||||
case $choice in
|
case $choice in
|
||||||
1) clear && install_exim && install_restart ;;
|
1) install_exim ;;
|
||||||
2) clear && install_exim && install_spamassassin && install_restart ;;
|
2) install_exim && install_spamassassin ;;
|
||||||
3) clear && install_exim && install_clamav && install_restart ;;
|
3) install_exim && install_clamav ;;
|
||||||
4) clear && install_exim && install_spamassassin && install_clamav && install_restart ;;
|
4) install_exim && install_spamassassin && install_clamav ;;
|
||||||
5) exit ;;
|
5) gen_public_dns ;;
|
||||||
|
6) exit ;;
|
||||||
*) clear && echo -e "${RED}Please enter a valid input${STD}" && install_mailserver ;;
|
*) clear && echo -e "${RED}Please enter a valid input${STD}" && install_mailserver ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user