- Change location of configuration file.
- Change location of dcc source directory. - Fix error in adjusting /etc/postfix/master file.
This commit is contained in:
		
							
								
								
									
										6
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,2 +1,4 @@
 | 
				
			|||||||
/hosts/BAK/*
 | 
					/conf/*.conf
 | 
				
			||||||
install-amavis.conf
 | 
					/dcc*
 | 
				
			||||||
 | 
					*.log
 | 
				
			||||||
 | 
					*.tar.Z
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -71,8 +71,9 @@ fi
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
echo ""
 | 
					echo ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
conf_dir="$(dirname $0)"
 | 
					
 | 
				
			||||||
conf_file="${conf_dir}/install-amavis.conf"
 | 
					script_dir="$(realpath $(dirname $0))"
 | 
				
			||||||
 | 
					conf_file="${script_dir}/conf/install_amavis.conf"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [[ -f "$conf_file" ]]; then
 | 
					if [[ -f "$conf_file" ]]; then
 | 
				
			||||||
   source $conf_file
 | 
					   source $conf_file
 | 
				
			||||||
@@ -1139,7 +1140,7 @@ if ps -ax | grep /var/dcc/libexec/dccifd | grep -v grep > /dev/null 2>&1 ; then
 | 
				
			|||||||
   fi
 | 
					   fi
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
_dcc_src_dir=/usr/local/src/dcc
 | 
					_dcc_src_dir="$script_dir"
 | 
				
			||||||
_archiv=dcc-dccproc.tar.Z
 | 
					_archiv=dcc-dccproc.tar.Z
 | 
				
			||||||
echononl "   Create archive directory \"$_dcc_src_dir\""
 | 
					echononl "   Create archive directory \"$_dcc_src_dir\""
 | 
				
			||||||
mkdir -p "$_dcc_src_dir" > $tmp_err_msg 2>&1
 | 
					mkdir -p "$_dcc_src_dir" > $tmp_err_msg 2>&1
 | 
				
			||||||
@@ -1160,7 +1161,7 @@ else
 | 
				
			|||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echononl "   Determin archiv directory.."
 | 
					echononl "   Determin archiv directory.."
 | 
				
			||||||
archiv_dir="${_dcc_src_dir}/$(dirname $(tar -tzf /usr/local/src/dcc/$_archiv | head -n 1) 2> $tmp_err_msg)"
 | 
					archiv_dir="${_dcc_src_dir}/$(dirname $(tar -tzf ${_dcc_src_dir}/$_archiv | head -n 1) 2> $tmp_err_msg)"
 | 
				
			||||||
if [[ $? -eq 0 ]] ; then
 | 
					if [[ $? -eq 0 ]] ; then
 | 
				
			||||||
   echo_ok
 | 
					   echo_ok
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
@@ -2836,10 +2837,10 @@ _needed_decoders_amavis="
 | 
				
			|||||||
   bzip2 \
 | 
					   bzip2 \
 | 
				
			||||||
   cabextract \
 | 
					   cabextract \
 | 
				
			||||||
   cpio\
 | 
					   cpio\
 | 
				
			||||||
   freeze \
 | 
					 | 
				
			||||||
   lhasa \
 | 
					   lhasa \
 | 
				
			||||||
   libzeromq-perl \
 | 
					 | 
				
			||||||
   lzop \
 | 
					   lzop \
 | 
				
			||||||
 | 
					   liblz4-tool \
 | 
				
			||||||
 | 
					   lrzip \
 | 
				
			||||||
   melt \
 | 
					   melt \
 | 
				
			||||||
   nomarch \
 | 
					   nomarch \
 | 
				
			||||||
   pax \
 | 
					   pax \
 | 
				
			||||||
@@ -2856,6 +2857,9 @@ _needed_decoders_amavis="
 | 
				
			|||||||
   unzip \
 | 
					   unzip \
 | 
				
			||||||
   zip \
 | 
					   zip \
 | 
				
			||||||
   zoo"
 | 
					   zoo"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   #libzeromq-perl \
 | 
				
			||||||
 | 
					   #freeze \
 | 
				
			||||||
for _pkg in $_needed_decoders_amavis ; do
 | 
					for _pkg in $_needed_decoders_amavis ; do
 | 
				
			||||||
   if aptitude search $_pkg | grep " $_pkg " | grep -e "^i" > /dev/null 2>&1 ; then
 | 
					   if aptitude search $_pkg | grep " $_pkg " | grep -e "^i" > /dev/null 2>&1 ; then
 | 
				
			||||||
      continue
 | 
					      continue
 | 
				
			||||||
@@ -3485,24 +3489,44 @@ fi
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
echononl "   Create new file \"${postfix_master_cf}\""
 | 
					echononl "   Create new file \"${postfix_master_cf}\""
 | 
				
			||||||
_found=false
 | 
					_found=false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if grep -iq -E "^localhost:10025" "$postfix_master_cf" > /dev/null 2>&1 ; then
 | 
					if grep -iq -E "^localhost:10025" "$postfix_master_cf" > /dev/null 2>&1 ; then
 | 
				
			||||||
   localhost_10025_present=true
 | 
					   localhost_10025_present=true
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
   localhost_10025_present=false
 | 
					   localhost_10025_present=false
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if grep -iq -E "^submission\s+" $postfix_master_cf > /dev/null 2>&1 ; then
 | 
				
			||||||
 | 
					   submission_present=true
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					   submission_present=false
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if grep -iq -E "^smtps\s+" $postfix_master_cf > /dev/null 2>&1 ; then
 | 
				
			||||||
 | 
					   smtps_present=true
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					   smtps_present=false
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if grep -iq -E "^amavisfeed\s+" $postfix_master_cf > /dev/null 2>&1 ; then
 | 
				
			||||||
 | 
					   amavisfeed_present=true
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					   amavisfeed_present=false
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
> $postfix_master_cf
 | 
					> $postfix_master_cf
 | 
				
			||||||
while IFS='' read -r _line || [[ -n $_line ]] ; do
 | 
					while IFS='' read -r _line || [[ -n $_line ]] ; do
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   if echo "$_line" | grep -i -E "^\s*smtp\s+inet\s+" > /dev/null 2>&1 ; then
 | 
					   if echo "$_line" | grep -i -E "^\s*smtp\s+inet\s+" > /dev/null 2>&1 ; then
 | 
				
			||||||
      _found=true
 | 
					      _found=true
 | 
				
			||||||
      cat >> $postfix_master_cf << EOF
 | 
					      cat >> $postfix_master_cf << EOF
 | 
				
			||||||
smtp      inet  n       -       -       -       -       smtpd
 | 
					smtp      inet  n       -       y       -       -       smtpd
 | 
				
			||||||
   -o smtpd_proxy_filter=127.0.0.1:10024
 | 
					   -o smtpd_proxy_filter=127.0.0.1:10024
 | 
				
			||||||
   -o content_filter=
 | 
					   -o content_filter=
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
      if ! $localhost_10025_present ; then
 | 
							if ! $submission_present && ! $smtps_present && ! $localhost_10025_present ; then
 | 
				
			||||||
         cat >> $postfix_master_cf << EOF
 | 
										cat >> $postfix_master_cf << EOF
 | 
				
			||||||
localhost:10025  inet  n       -       -       -       -       smtpd
 | 
					localhost:10025  inet  n       -       y       -       -       smtpd
 | 
				
			||||||
   -o content_filter=
 | 
					   -o content_filter=
 | 
				
			||||||
   -o smtpd_proxy_filter=
 | 
					   -o smtpd_proxy_filter=
 | 
				
			||||||
   -o smtpd_authorized_xforward_hosts=127.0.0.0/8
 | 
					   -o smtpd_authorized_xforward_hosts=127.0.0.0/8
 | 
				
			||||||
@@ -3515,14 +3539,100 @@ localhost:10025  inet  n       -       -       -       -       smtpd
 | 
				
			|||||||
   -o receive_override_options=no_unknown_recipient_checks
 | 
					   -o receive_override_options=no_unknown_recipient_checks
 | 
				
			||||||
   #-o mynetworks=127.0.0.0/8,${IPV4}/32
 | 
					   #-o mynetworks=127.0.0.0/8,${IPV4}/32
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
      fi
 | 
							fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      continue
 | 
					      continue
 | 
				
			||||||
   fi
 | 
					   fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if $submission_present && echo "$_line" | grep -i -E "^^submission\s+" > /dev/null 2>&1 ; then
 | 
				
			||||||
 | 
							_found=true
 | 
				
			||||||
 | 
							cat >> $postfix_master_cf << EOF
 | 
				
			||||||
 | 
					submission inet n       -       y       -       20       smtpd
 | 
				
			||||||
 | 
					   -o content_filter=amavisfeed:[127.0.0.1]:10024
 | 
				
			||||||
 | 
					   -o smtpd_tls_security_level=encrypt
 | 
				
			||||||
 | 
					   -o smtpd_sasl_auth_enable=yes
 | 
				
			||||||
 | 
					   -o smtpd_client_restrictions=permit_sasl_authenticated,reject
 | 
				
			||||||
 | 
					   #-o milter_macro_daemon_name=ORIGINATING
 | 
				
			||||||
 | 
					EOF
 | 
				
			||||||
 | 
							if ! $smtps_present ; then
 | 
				
			||||||
 | 
								if ! $localhost_10025_present ; then 
 | 
				
			||||||
 | 
									cat >> $postfix_master_cf << EOF
 | 
				
			||||||
 | 
					localhost:10025  inet  n       -       y       -       -       smtpd
 | 
				
			||||||
 | 
					   -o content_filter=
 | 
				
			||||||
 | 
					   -o smtpd_proxy_filter=
 | 
				
			||||||
 | 
					   -o smtpd_authorized_xforward_hosts=127.0.0.0/8
 | 
				
			||||||
 | 
					   -o smtpd_client_restrictions=
 | 
				
			||||||
 | 
					   -o smtpd_helo_restrictions=
 | 
				
			||||||
 | 
					   -o smtpd_sender_restrictions=
 | 
				
			||||||
 | 
					   -o smtpd_recipient_restrictions=permit_mynetworks,reject
 | 
				
			||||||
 | 
					   -o smtpd_data_restrictions=
 | 
				
			||||||
 | 
					   -o mynetworks=127.0.0.0/8
 | 
				
			||||||
 | 
					   -o receive_override_options=no_unknown_recipient_checks
 | 
				
			||||||
 | 
					   #-o mynetworks=127.0.0.0/8,${IPV4}/32
 | 
				
			||||||
 | 
					EOF
 | 
				
			||||||
 | 
								fi
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
								if ! $amavisfeed_present ; then
 | 
				
			||||||
 | 
									cat >> $postfix_master_cf << EOF
 | 
				
			||||||
 | 
					amavisfeed unix -       -       n       -       20       lmtp
 | 
				
			||||||
 | 
					    -o smtp_data_done_timeout=1200
 | 
				
			||||||
 | 
					    -o smtp_send_xforward_command=yes
 | 
				
			||||||
 | 
					    -o disable_dns_lookups=yes
 | 
				
			||||||
 | 
					EOF
 | 
				
			||||||
 | 
								fi
 | 
				
			||||||
 | 
							fi # if ! $smtps_present
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      continue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						fi # if $submission_present && echo "$_line" | grep..
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if $smtps_present && echo "$_line" | grep -i -E "^smtps\s+" > /dev/null 2>&1 ; then
 | 
				
			||||||
 | 
							cat >> $postfix_master_cf << EOF
 | 
				
			||||||
 | 
					smtps     inet  n       -       y       -       -       smtpd
 | 
				
			||||||
 | 
					  -o content_filter=amavisfeed:[127.0.0.1]:10024
 | 
				
			||||||
 | 
					  -o smtpd_tls_wrappermode=yes
 | 
				
			||||||
 | 
					  -o smtpd_sasl_auth_enable=yes
 | 
				
			||||||
 | 
					  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
 | 
				
			||||||
 | 
					   #  -o milter_macro_daemon_name=ORIGINATING
 | 
				
			||||||
 | 
					EOF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if ! $localhost_10025_present ; then 
 | 
				
			||||||
 | 
								cat >> $postfix_master_cf << EOF
 | 
				
			||||||
 | 
					localhost:10025  inet  n       -       y       -       -       smtpd
 | 
				
			||||||
 | 
					   -o content_filter=
 | 
				
			||||||
 | 
					   -o smtpd_proxy_filter=
 | 
				
			||||||
 | 
					   -o smtpd_authorized_xforward_hosts=127.0.0.0/8
 | 
				
			||||||
 | 
					   -o smtpd_client_restrictions=
 | 
				
			||||||
 | 
					   -o smtpd_helo_restrictions=
 | 
				
			||||||
 | 
					   -o smtpd_sender_restrictions=
 | 
				
			||||||
 | 
					   -o smtpd_recipient_restrictions=permit_mynetworks,reject
 | 
				
			||||||
 | 
					   -o smtpd_data_restrictions=
 | 
				
			||||||
 | 
					   -o mynetworks=127.0.0.0/8
 | 
				
			||||||
 | 
					   -o receive_override_options=no_unknown_recipient_checks
 | 
				
			||||||
 | 
					   #-o mynetworks=127.0.0.0/8,${IPV4}/32
 | 
				
			||||||
 | 
					EOF
 | 
				
			||||||
 | 
							fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if ! $amavisfeed_present ; then
 | 
				
			||||||
 | 
								cat >> $postfix_master_cf << EOF
 | 
				
			||||||
 | 
					amavisfeed unix -       -       n       -       20       lmtp
 | 
				
			||||||
 | 
					    -o smtp_data_done_timeout=1200
 | 
				
			||||||
 | 
					    -o smtp_send_xforward_command=yes
 | 
				
			||||||
 | 
					    -o disable_dns_lookups=yes
 | 
				
			||||||
 | 
					EOF
 | 
				
			||||||
 | 
							fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      continue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						fi # if $smtps_present
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   if $localhost_10025_present && echo "$_line" | grep -i -E "^localhost:10025" > /dev/null 2>&1 ; then
 | 
					   if $localhost_10025_present && echo "$_line" | grep -i -E "^localhost:10025" > /dev/null 2>&1 ; then
 | 
				
			||||||
      _found=true
 | 
					      _found=true
 | 
				
			||||||
      cat >> $postfix_master_cf << EOF
 | 
					      cat >> $postfix_master_cf << EOF
 | 
				
			||||||
localhost:10025  inet  n       -       -       -       -       smtpd
 | 
					localhost:10025  inet  n       -       y       -       -       smtpd
 | 
				
			||||||
   -o content_filter=
 | 
					   -o content_filter=
 | 
				
			||||||
   -o smtpd_proxy_filter=
 | 
					   -o smtpd_proxy_filter=
 | 
				
			||||||
   -o smtpd_authorized_xforward_hosts=127.0.0.0/8
 | 
					   -o smtpd_authorized_xforward_hosts=127.0.0.0/8
 | 
				
			||||||
@@ -3538,6 +3648,17 @@ EOF
 | 
				
			|||||||
      continue
 | 
					      continue
 | 
				
			||||||
   fi
 | 
					   fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   if $amavisfeed_present && echo "$_line" | grep -i -E "^amavisfeed\s+" > /dev/null 2>&1 ; then
 | 
				
			||||||
 | 
					      _found=true
 | 
				
			||||||
 | 
					      cat >> $postfix_master_cf << EOF
 | 
				
			||||||
 | 
					amavisfeed unix -       -       n       -       20       lmtp
 | 
				
			||||||
 | 
					    -o smtp_data_done_timeout=1200
 | 
				
			||||||
 | 
					    -o smtp_send_xforward_command=yes
 | 
				
			||||||
 | 
					    -o disable_dns_lookups=yes
 | 
				
			||||||
 | 
					EOF
 | 
				
			||||||
 | 
					      continue
 | 
				
			||||||
 | 
					   fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   # - [[:blank:]] means space and tab. This makes it similar to: [ \t]
 | 
					   # - [[:blank:]] means space and tab. This makes it similar to: [ \t]
 | 
				
			||||||
   # - [[:space;]] in addition to space and tab, includes newline, linefeed, formfeed, 
 | 
					   # - [[:space;]] in addition to space and tab, includes newline, linefeed, formfeed, 
 | 
				
			||||||
   # -             and vertical tab. This makes it similar to: [ \t\n\r\f\v]
 | 
					   # -             and vertical tab. This makes it similar to: [ \t\n\r\f\v]
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user