install_amavis.sh: add support for debian 10 (buster).

This commit is contained in:
Christoph 2019-06-15 23:09:40 +02:00
parent d154c716b0
commit eec8699d23

View File

@ -29,6 +29,16 @@ fatal(){
echo ""
echo -e "\t\033[31m\033[1mInstalllation will be interrupted\033[m\033[m"
echo ""
if [[ -f "$crontab_backup_file" ]]; then
echononl " Reenable previously saved crontab from '$crontab_backup_file'.."
crontab $crontab_backup_file > $tmp_err_msg 2>&1
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
error "$(cat $log_file)"
fi
fi
exit 1
}
@ -165,6 +175,55 @@ fi
[[ -z "$_SECURITE_INFO_IN_USE" ]] && _SECURITE_INFO_IN_USE=$DEFAULT_SECURITE_INFO_IN_USE
_needed_packages_clamav="clamav \
clamav-base \
clamav-daemon \
clamav-docs \
clamav-freshclam \
libgmp-dev \
libgmp10"
if [[ "${os_dist,,}" = "debian" ]] && [[ "$os_version" -lt 10 ]] ; then
_needed_packages_clamav="$_needed_packages_clamav \
libclamunrar7"
else
_needed_packages_clamav="$_needed_packages_clamav \
libclamunrar9"
fi
_needed_decoders_amavis="
alien \
arc \
arj \
binutils \
bzip2 \
cabextract \
cpio\
lhasa \
lzop \
liblz4-tool \
lrzip \
melt \
nomarch \
pax \
p7zip \
p7zip-full \
p7zip-rar \
rpm \
tar \
tnef \
rar \
unrar \
unrar-free \
unzip \
zip "
if [[ "${os_dist,,}" = "debian" ]] && [[ "$os_version" -lt 10 ]] ; then
_needed_decoders_amavis="$_needed_decoders_amavis \
ripole \
zoo"
fi
clear
echo -e "\033[21G\033[32mInstallation script for AMaViS, Spamassassin and ClamAV\033[m"
echo
@ -1300,7 +1359,8 @@ if ps -ax | grep /var/dcc/libexec/dccifd | grep -v grep > /dev/null 2>&1 ; then
fi
_dcc_src_dir="$script_dir"
_archiv=dcc-dccproc.tar.Z
#_archiv=dcc-dccproc.tar.Z
_archiv=dcc.tar.Z
echononl " Create archive directory \"$_dcc_src_dir\""
mkdir -p "$_dcc_src_dir" > $tmp_err_msg 2>&1
if [[ $? -eq 0 ]] ; then
@ -1310,13 +1370,23 @@ else
error "$(cat $tmp_err_msg)"
fi
echononl " Download archide \"$_archiv\""
wget -O ${_dcc_src_dir}/$_archiv http://www.dcc-servers.net/dcc/source/$_archiv > $tmp_err_msg 2>&1
echononl " Download archive \"$_archiv\""
wget --no-check-certificate -O ${_dcc_src_dir}/$_archiv https://www.dcc-servers.net/dcc/source/$_archiv > $tmp_err_msg 2>&1
if [[ $? -eq 0 ]] ; then
echo_ok
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
echononl " Determin archiv directory.."
@ -2556,14 +2626,6 @@ echo
echo -e "\033[37m\033[1mGoing to install ClamAV..\033[m"
echo
echononl " Install packages needed for ClamAV"
_needed_packages_clamav="clamav \
clamav-base \
clamav-daemon \
clamav-docs \
clamav-freshclam \
libclamunrar7 \
libgmp-dev \
libgmp10"
for _pkg in $_needed_packages_clamav ; do
if aptitude search $_pkg | grep " $_pkg " | grep -e "^i" > /dev/null 2>&1 ; then
continue
@ -2578,7 +2640,18 @@ if [[ -n "$needed_packages_clamav" ]]; then
else
echo_failed
error "$(cat $tmp_err_msg)"
fi
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
else
echo_skipped
fi
@ -2594,6 +2667,15 @@ if [[ $? -eq 0 ]] ; then
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
@ -2605,6 +2687,15 @@ if $systemd_exists ; then
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
else
/etc/init.d/clamav-daemon stop /dev/null 2> $tmp_err_msg
@ -2613,6 +2704,15 @@ else
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
fi
@ -2624,6 +2724,15 @@ if $systemd_exists ; then
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
else
/etc/init.d/clamav-freshclam stop /dev/null 2> $tmp_err_msg
@ -2632,6 +2741,15 @@ else
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
fi
@ -2642,6 +2760,15 @@ if [[ $? -eq 0 ]] ; then
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
echononl " Start ClamAv daemon.."
@ -2652,6 +2779,15 @@ if $systemd_exists ; then
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
else
/etc/init.d/clamav-daemon start /dev/null 2> $tmp_err_msg
@ -2660,6 +2796,15 @@ else
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
fi
@ -2671,6 +2816,15 @@ if $systemd_exists ; then
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
else
/etc/init.d/clamav-freshclam start /dev/null 2> $tmp_err_msg
@ -2679,6 +2833,15 @@ else
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
fi
@ -2771,7 +2934,16 @@ if $INSTALL_CLAMAV_UNOFFICIAL_SIGS ; then
else
echo_failed
error "$(cat $tmp_err_msg)"
fi
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
fi
echononl " Install CPAN Module IO::Socket::UNIX"
@ -2782,6 +2954,15 @@ if $INSTALL_CLAMAV_UNOFFICIAL_SIGS ; then
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
@ -2810,6 +2991,15 @@ if $INSTALL_CLAMAV_UNOFFICIAL_SIGS ; then
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
echononl " Make /usr/local/sbin/clamav-unofficial-sigs.sh executable"
@ -2819,6 +3009,15 @@ if $INSTALL_CLAMAV_UNOFFICIAL_SIGS ; then
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
_create_dirs="/var/log/clamav-unofficial-sigs /etc/clamav-unofficial-sigs"
@ -2833,6 +3032,15 @@ if $INSTALL_CLAMAV_UNOFFICIAL_SIGS ; then
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
fi
done
@ -2844,6 +3052,15 @@ if $INSTALL_CLAMAV_UNOFFICIAL_SIGS ; then
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
echononl " Copy readme file 'INSTALL' into '/etc/clamav-unofficial-sigs/'.."
@ -2853,20 +3070,58 @@ if $INSTALL_CLAMAV_UNOFFICIAL_SIGS ; then
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
if [[ "${os_dist,,}" = "debian" ]] ; then
if [[ "$os_version" = "8" ]] || [[ "$os_version" = "9" ]] || [[ "$os_version" = "10" ]] ; then
## - For Debian Jessie (Debian 8) // Stretch (Debian 9) // Buster (Debian 10)
## -
_failed=false
echononl " At directory /etc/clamav-unofficial-sigs copy os.debian${os_version}.conf to os.conf"
cp /etc/clamav-unofficial-sigs/os.debian${os_version}.conf /etc/clamav-unofficial-sigs/os.conf > $tmp_err_msg 2>&1
if [[ $? -eq 0 ]] ; then
if [[ ! -f /etc/clamav-unofficial-sigs/os.debian${os_version}.conf ]] ; then
_tmp_version=$(expr $os_version - 1)
if [[ -f "/etc/clamav-unofficial-sigs/os.debian${_tmp_version}.conf" ]] ; then
cp "/etc/clamav-unofficial-sigs/os.debian${_tmp_version}.conf" \
"/etc/clamav-unofficial-sigs/os.conf" > $tmp_err_msg 2>&1
if [[ $? -ne 0 ]]; then
echo "File not found: /etc/clamav-unofficial-sigs/os.debian${os_version}.conf" > $tmp_err_msg
_failed=true
fi
else
failed=true
fi
else
cp "/etc/clamav-unofficial-sigs/os.debian${os_version}.conf" \
"/etc/clamav-unofficial-sigs/os.conf" > $tmp_err_msg 2>&1
if [[ $? -ne 0 ]]; then
_failed=true
fi
fi
if ! $_failed ; then
echo_ok
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
## - Edit /etc/clamav-unofficial-sigs/os.conf and make changes if needed
@ -2926,6 +3181,15 @@ if $INSTALL_CLAMAV_UNOFFICIAL_SIGS ; then
if [[ "$?" -ne 0 ]] ; then
installation_failed=true
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
if ! $installation_failed ; then
echo_ok
@ -2933,7 +3197,16 @@ if $INSTALL_CLAMAV_UNOFFICIAL_SIGS ; then
else
error "Cannot create file 'os.conf' (No Debian Version detected).
See file /etc/clamav-unofficial-sigs/INSTALL to create it manually"
fi
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
else
@ -3023,6 +3296,17 @@ EOF
fi
if ! $installation_failed ; then
echo_ok
else
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
@ -3033,6 +3317,15 @@ EOF
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
echononl " Adjust /etc/systemd/clamav-unofficial-sigs.service"
@ -3043,6 +3336,15 @@ EOF
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
@ -3053,6 +3355,15 @@ EOF
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
echononl " Install logrotate configuration"
/usr/local/sbin/clamav-unofficial-sigs.sh --install-logrotate > $tmp_err_msg 2>&1
@ -3061,6 +3372,15 @@ EOF
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
echononl " Install man (help) file"
/usr/local/sbin/clamav-unofficial-sigs.sh --install-man > $tmp_err_msg 2>&1
@ -3069,8 +3389,36 @@ EOF
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
echononl " Whitelist signature 'MBL_27966083'.."
echo "MBL_27966083" >> /var/lib/clamav/my_whitelist.ign2 2> $tmp_err_msg
if [[ $? -eq 0 ]] ; then
echo_ok
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
echo " First Usage to initialise ClamAV unofficial sigs"
echo -n " see /var/log/clamav-unofficial-sigs/clamav-unofficial-sigs.log"
/usr/local/sbin/clamav-unofficial-sigs.sh > $tmp_err_msg 2>&1
@ -3079,6 +3427,15 @@ EOF
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
@ -3089,6 +3446,15 @@ EOF
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
fi # if $INSTALL_CLAMAV_UNOFFICIAL_SIGS
@ -3124,34 +3490,6 @@ else
fi
echononl " Install some decoders needed for AMaVis"
_needed_decoders_amavis="
alien \
arc \
arj \
binutils \
bzip2 \
cabextract \
cpio\
lhasa \
lzop \
liblz4-tool \
lrzip \
melt \
nomarch \
pax \
p7zip \
p7zip-full \
p7zip-rar \
rpm \
tar \
tnef \
ripole \
rar \
unrar \
unrar-free \
unzip \
zip \
zoo"
#libzeromq-perl \
#freeze \
@ -3169,6 +3507,16 @@ if [[ -n "$needed_decoders_amavis" ]]; then
else
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
else
echo_skipped