From b475a7f3651342f305f4ada7eb5cb40bd7154a6a Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Wed, 14 Oct 2020 15:04:50 +0200 Subject: [PATCH] Seperated Postfix into submodule --- CoreModules/generic/conf.sh | 15 --------------- CoreModules/generic/generic.pkg.list | 2 +- CoreModules/generic/preconf.sh | 2 -- ModulesMenu.list | 9 ++++++--- SubModules/postfix/apt.pkg.list | 1 + SubModules/postfix/conf.sh | 14 ++++++++++++++ SubModules/postfix/generic.pkg.list | 1 + SubModules/postfix/preconf.sh | 2 ++ 8 files changed, 25 insertions(+), 21 deletions(-) create mode 100644 SubModules/postfix/apt.pkg.list create mode 100644 SubModules/postfix/conf.sh create mode 100644 SubModules/postfix/generic.pkg.list create mode 100644 SubModules/postfix/preconf.sh diff --git a/CoreModules/generic/conf.sh b/CoreModules/generic/conf.sh index d20a0d1..c0dd3f9 100644 --- a/CoreModules/generic/conf.sh +++ b/CoreModules/generic/conf.sh @@ -1,18 +1,3 @@ -##-------------## -# Postfix # -##-------------## - -sed -i 's/#inet_interfaces = all/inet_interfaces = loopback-only/g' /etc/postfix/main.cf -sed -i 's/mydestination/#mydestination/g' /etc/postfix/main.cf -sed -i 's/relayhost =/mydestination = '$hostname', localhost.'$hostname', '$hostname'/g' /etc/postfix/main.cf -echo "bounce_notice_recipient = info@$domain" >> /etc/postfix/main.cf -cat < /etc/aliases -# See man 5 aliases for format -postmaster: root -root: $email -EOF -newaliases - ##-------## # UFW # ##-------## diff --git a/CoreModules/generic/generic.pkg.list b/CoreModules/generic/generic.pkg.list index d084b57..8df8b81 100644 --- a/CoreModules/generic/generic.pkg.list +++ b/CoreModules/generic/generic.pkg.list @@ -1 +1 @@ -mailutils htop ufw nload fail2ban \ No newline at end of file +htop ufw nload fail2ban \ No newline at end of file diff --git a/CoreModules/generic/preconf.sh b/CoreModules/generic/preconf.sh index f1e28b5..ee1a777 100644 --- a/CoreModules/generic/preconf.sh +++ b/CoreModules/generic/preconf.sh @@ -54,5 +54,3 @@ echo "vm.vfs_cache_pressure=50" >> /etc/sysctl.conf #Checking if postfix exists on this system and if so it wil be removed to prevent config conflicts if dpkg-query -Wf'${db:Status-abbrev}' postfix 2>/dev/null | grep -q '^i'; then apt purge -y postfix > $OUTPUT 2>&1; fi -debconf-set-selections <<< "postfix postfix/mailname string $domain" -debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'" \ No newline at end of file diff --git a/ModulesMenu.list b/ModulesMenu.list index 3b933b6..e2bbb9d 100644 --- a/ModulesMenu.list +++ b/ModulesMenu.list @@ -15,12 +15,14 @@ nginxCMSL+=("Wordpress:" "WordPress is a content management system based on PHP. nginxCMSL+=("Nextcloud:" "Nextcloud is a suite of client-server software for creating and using file hosting services." OFF) #Options nginxOptions=("Redis:" "Redis caching" OFF) +nginxOptions+=("Postfix:" "Mail MTA" OFF) ##Nginx #CMSList nginx_nonphpCMSL=("None:" "A plain webserver will be setup." OFF) #Options nginx_nonphpOptions=("Redis:" "Redis caching" OFF) +nginx_nonphpOptions+=("Postfix:" "Mail MTA" OFF) ##Apache #CMSList @@ -29,6 +31,7 @@ apacheCMSL+=("Wordpress:" "WordPress is a content management system based on PHP apacheCMSL+=("Nextcloud:" "Nextcloud is a suite of client-server software for creating and using file hosting services." OFF) #Options apacheOptions=("Redis:" "Redis caching" OFF) +apacheOptions+=("Postfix:" "Mail MTA" OFF) fi if [ $IMODE = l ]; then @@ -39,18 +42,18 @@ webservers=("Nginx" "Nginx_nonphp" "Apache" "Quit") #CMSList nginxCMSL=("None" "Wordpress" "Nextcloud") #Options -nginxOptions=("Redis:") +nginxOptions=("Redis:" "Postfix:") ##Nginx-nonphp #CMSList nginx_nonphpCMSL=("None") #Options -nginx_nonphpOptions=("Redis:") +nginx_nonphpOptions=("Redis:" "Postfix:") ##Apache #CMSList apacheCMSL=("None" "Wordpress" "Nextcloud") #Options -apacheOptions=("Redis:") +apacheOptions=("Redis:" "Postfix:") fi \ No newline at end of file diff --git a/SubModules/postfix/apt.pkg.list b/SubModules/postfix/apt.pkg.list new file mode 100644 index 0000000..b318606 --- /dev/null +++ b/SubModules/postfix/apt.pkg.list @@ -0,0 +1 @@ +mailutils \ No newline at end of file diff --git a/SubModules/postfix/conf.sh b/SubModules/postfix/conf.sh new file mode 100644 index 0000000..83d8ea1 --- /dev/null +++ b/SubModules/postfix/conf.sh @@ -0,0 +1,14 @@ +##-------------## +# Postfix # +##-------------## + +sed -i 's/#inet_interfaces = all/inet_interfaces = loopback-only/g' /etc/postfix/main.cf +sed -i 's/mydestination/#mydestination/g' /etc/postfix/main.cf +sed -i 's/relayhost =/mydestination = '$hostname', localhost.'$hostname', '$hostname'/g' /etc/postfix/main.cf +echo "bounce_notice_recipient = info@$domain" >> /etc/postfix/main.cf +cat < /etc/aliases +# See man 5 aliases for format +postmaster: root +root: $email +EOF +newaliases \ No newline at end of file diff --git a/SubModules/postfix/generic.pkg.list b/SubModules/postfix/generic.pkg.list new file mode 100644 index 0000000..638b1b7 --- /dev/null +++ b/SubModules/postfix/generic.pkg.list @@ -0,0 +1 @@ +postfix \ No newline at end of file diff --git a/SubModules/postfix/preconf.sh b/SubModules/postfix/preconf.sh new file mode 100644 index 0000000..facd203 --- /dev/null +++ b/SubModules/postfix/preconf.sh @@ -0,0 +1,2 @@ +debconf-set-selections <<< "postfix postfix/mailname string $domain" +debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'" \ No newline at end of file