- Change location of configuration file.

- Change location of dcc source directory.
- Fix error in adjusting /etc/postfix/master file.
This commit is contained in:
Christoph 2017-10-09 03:05:48 +02:00
parent c4d7515783
commit 28aec04e5a
2 changed files with 137 additions and 14 deletions

6
.gitignore vendored
View File

@ -1,2 +1,4 @@
/hosts/BAK/*
install-amavis.conf
/conf/*.conf
/dcc*
*.log
*.tar.Z

View File

@ -71,8 +71,9 @@ fi
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
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
_dcc_src_dir=/usr/local/src/dcc
_dcc_src_dir="$script_dir"
_archiv=dcc-dccproc.tar.Z
echononl " Create archive directory \"$_dcc_src_dir\""
mkdir -p "$_dcc_src_dir" > $tmp_err_msg 2>&1
@ -1160,7 +1161,7 @@ else
fi
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
echo_ok
else
@ -2836,10 +2837,10 @@ _needed_decoders_amavis="
bzip2 \
cabextract \
cpio\
freeze \
lhasa \
libzeromq-perl \
lzop \
liblz4-tool \
lrzip \
melt \
nomarch \
pax \
@ -2856,6 +2857,9 @@ _needed_decoders_amavis="
unzip \
zip \
zoo"
#libzeromq-perl \
#freeze \
for _pkg in $_needed_decoders_amavis ; do
if aptitude search $_pkg | grep " $_pkg " | grep -e "^i" > /dev/null 2>&1 ; then
continue
@ -3485,24 +3489,44 @@ fi
echononl " Create new file \"${postfix_master_cf}\""
_found=false
if grep -iq -E "^localhost:10025" "$postfix_master_cf" > /dev/null 2>&1 ; then
localhost_10025_present=true
else
localhost_10025_present=false
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
while IFS='' read -r _line || [[ -n $_line ]] ; do
if echo "$_line" | grep -i -E "^\s*smtp\s+inet\s+" > /dev/null 2>&1 ; then
_found=true
cat >> $postfix_master_cf << EOF
smtp inet n - - - - smtpd
smtp inet n - y - - smtpd
-o smtpd_proxy_filter=127.0.0.1:10024
-o content_filter=
EOF
if ! $localhost_10025_present ; then
if ! $submission_present && ! $smtps_present && ! $localhost_10025_present ; then
cat >> $postfix_master_cf << EOF
localhost:10025 inet n - - - - smtpd
localhost:10025 inet n - y - - smtpd
-o content_filter=
-o smtpd_proxy_filter=
-o smtpd_authorized_xforward_hosts=127.0.0.0/8
@ -3516,13 +3540,99 @@ localhost:10025 inet n - - - - smtpd
#-o mynetworks=127.0.0.0/8,${IPV4}/32
EOF
fi
continue
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
_found=true
cat >> $postfix_master_cf << EOF
localhost:10025 inet n - - - - smtpd
localhost:10025 inet n - y - - smtpd
-o content_filter=
-o smtpd_proxy_filter=
-o smtpd_authorized_xforward_hosts=127.0.0.0/8
@ -3538,6 +3648,17 @@ EOF
continue
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]
# - [[:space;]] in addition to space and tab, includes newline, linefeed, formfeed,
# - and vertical tab. This makes it similar to: [ \t\n\r\f\v]