From 041fd2914f792305498f3e311dfc34b88f7209fc Mon Sep 17 00:00:00 2001 From: cmstew Date: Fri, 28 Dec 2018 13:51:41 -0700 Subject: [PATCH 01/10] Create clamd.scan index page --- web/edit/server/clamd.scan/index.php | 46 ++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 web/edit/server/clamd.scan/index.php diff --git a/web/edit/server/clamd.scan/index.php b/web/edit/server/clamd.scan/index.php new file mode 100644 index 000000000..06be0bfa1 --- /dev/null +++ b/web/edit/server/clamd.scan/index.php @@ -0,0 +1,46 @@ + Date: Fri, 28 Dec 2018 13:53:19 -0700 Subject: [PATCH 02/10] Added clamd.scan --- bin/v-change-sys-service-config | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/v-change-sys-service-config b/bin/v-change-sys-service-config index 97c14a17c..981c22d5f 100755 --- a/bin/v-change-sys-service-config +++ b/bin/v-change-sys-service-config @@ -63,6 +63,7 @@ case $service in spamd) dst=$($BIN/v-list-sys-spamd-config plain);; spamassassin) dst=$($BIN/v-list-sys-spamd-config plain);; clamd) dst=$($BIN/v-list-sys-clamd-config plain);; + clamd.scan) dst=$($BIN/v-list-sys-clamd-config plain);; cron) dst='/etc/crontab';; crond) dst='/etc/crontab';; fail2ban) dst='/etc/fail2ban/jail.local';; From b1e0e6a2a5f62c48fd75887127d39996dd6c376a Mon Sep 17 00:00:00 2001 From: cmstew Date: Fri, 28 Dec 2018 14:57:38 -0700 Subject: [PATCH 03/10] Fix clamd for Amazon Linux --- install/vst-install-amazon.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/install/vst-install-amazon.sh b/install/vst-install-amazon.sh index 8dbdaa143..dd506480e 100644 --- a/install/vst-install-amazon.sh +++ b/install/vst-install-amazon.sh @@ -509,6 +509,7 @@ cp -r /etc/exim/* $vst_backups/exim >/dev/null 2>&1 # Backup ClamAV configuration service clamd stop > /dev/null 2>&1 +service clamd.scan stop > /dev/null 2>&1 cp /etc/clamd.conf $vst_backups/clamd >/dev/null 2>&1 cp -r /etc/clamd.d $vst_backups/clamd >/dev/null 2>&1 @@ -626,6 +627,11 @@ if [ "$exim" != 'no' ]; then check_result $? "yum install failed" fi +# Installing freshclam for Amazon Linux +if [ "$clamd" != 'no' ]; then + yum -y install clamav-update + check_result $? "yum install failed" +fi #----------------------------------------------------------# # Configure system # @@ -768,7 +774,7 @@ fi if [ "$exim" = 'yes' ]; then echo "MAIL_SYSTEM='exim'" >> $VESTA/conf/vesta.conf if [ "$clamd" = 'yes' ]; then - echo "ANTIVIRUS_SYSTEM='clamav'" >> $VESTA/conf/vesta.conf + echo "ANTIVIRUS_SYSTEM='clamd.scan'" >> $VESTA/conf/vesta.conf fi if [ "$spamd" = 'yes' ]; then echo "ANTISPAM_SYSTEM='spamassassin'" >> $VESTA/conf/vesta.conf @@ -1126,9 +1132,10 @@ if [ "$clamd" = 'yes' ]; then gpasswd -a clam exim gpasswd -a clam mail cp -f $vestacp/clamav/clamd.conf /etc/ + ln -s /etc/clamd.conf /etc/clamd.d/scan.conf cp -f $vestacp/clamav/freshclam.conf /etc/ mkdir -p /var/log/clamav /var/run/clamav - chown clam:clam /var/log/clamav /var/run/clamav + chown clam:clam /var/log/clamav /var/run/clamav /var/run/clamd.scan chown -R clam:clam /var/lib/clamav if [ "$release" -ge '7' ]; then cp -f $vestacp/clamav/clamd.service /usr/lib/systemd/system/ @@ -1139,8 +1146,8 @@ if [ "$clamd" = 'yes' ]; then sed -i "s/nofork/foreground/" /usr/lib/systemd/system/clamd.service systemctl daemon-reload fi - chkconfig clamd on - service clamd start + chkconfig clamd.scan on + service clamd.scan start #check_result $? "clamd start failed" fi From 57429a3203d38101d9f87d70bdc3dfcdec0b6645 Mon Sep 17 00:00:00 2001 From: cmstew Date: Fri, 28 Dec 2018 15:59:21 -0700 Subject: [PATCH 04/10] Update vst-install-amazon.sh Added backup of /etc/clamd.d/scan.conf after installing clamd because the file is not there before. --- install/vst-install-amazon.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install/vst-install-amazon.sh b/install/vst-install-amazon.sh index dd506480e..50e64ecbb 100644 --- a/install/vst-install-amazon.sh +++ b/install/vst-install-amazon.sh @@ -1132,7 +1132,8 @@ if [ "$clamd" = 'yes' ]; then gpasswd -a clam exim gpasswd -a clam mail cp -f $vestacp/clamav/clamd.conf /etc/ - ln -s /etc/clamd.conf /etc/clamd.d/scan.conf + cp -r /etc/clamd.d $vst_backups/clamd >/dev/null 2>&1 + ln -sf /etc/clamd.conf /etc/clamd.d/scan.conf cp -f $vestacp/clamav/freshclam.conf /etc/ mkdir -p /var/log/clamav /var/run/clamav chown clam:clam /var/log/clamav /var/run/clamav /var/run/clamd.scan From fb13db40ce5d383f22d01590a4618def8da41005 Mon Sep 17 00:00:00 2001 From: cmstew Date: Sat, 29 Dec 2018 12:47:58 -0700 Subject: [PATCH 05/10] Update vst-install-amazon.sh cleaned up changes for clamd on amazon linux --- install/vst-install-amazon.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/install/vst-install-amazon.sh b/install/vst-install-amazon.sh index 50e64ecbb..fb1c4a6fa 100644 --- a/install/vst-install-amazon.sh +++ b/install/vst-install-amazon.sh @@ -23,7 +23,7 @@ software="nginx httpd mod_ssl mod_ruid2 mod_fcgid mod_extract_forwarded php php-common php-cli php-bcmath php-gd php-imap php-mbstring php-mcrypt php-mysql php-pdo php-soap php-tidy php-xml php-xmlrpc php-fpm php-pgsql awstats webalizer vsftpd proftpd bind bind-utils bind-libs exim dovecot - clamd spamassassin mysql mysql-server phpMyAdmin postgresql + clamd clamav-update spamassassin mysql mysql-server phpMyAdmin postgresql postgresql-server postgresql-contrib phpPgAdmin e2fsprogs openssh-clients ImageMagick curl mc screen ftp zip unzip flex sqlite pcre sudo bc jwhois mailx lsof tar telnet rrdtool net-tools ntp GeoIP freetype fail2ban @@ -508,7 +508,6 @@ service exim stop > /dev/null 2>&1 cp -r /etc/exim/* $vst_backups/exim >/dev/null 2>&1 # Backup ClamAV configuration -service clamd stop > /dev/null 2>&1 service clamd.scan stop > /dev/null 2>&1 cp /etc/clamd.conf $vst_backups/clamd >/dev/null 2>&1 cp -r /etc/clamd.d $vst_backups/clamd >/dev/null 2>&1 @@ -627,12 +626,6 @@ if [ "$exim" != 'no' ]; then check_result $? "yum install failed" fi -# Installing freshclam for Amazon Linux -if [ "$clamd" != 'no' ]; then - yum -y install clamav-update - check_result $? "yum install failed" -fi - #----------------------------------------------------------# # Configure system # #----------------------------------------------------------# From 9f671ccf90b51cfdaa6e57ce11b5b2288be67a4e Mon Sep 17 00:00:00 2001 From: cmstew Date: Wed, 2 Jan 2019 08:18:06 -0700 Subject: [PATCH 06/10] Update vst-install-amazon.sh - Cleaned up changes - Removed unnecessary clamd code from Centos installer --- install/vst-install-amazon.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/install/vst-install-amazon.sh b/install/vst-install-amazon.sh index fb1c4a6fa..a61439c6b 100644 --- a/install/vst-install-amazon.sh +++ b/install/vst-install-amazon.sh @@ -1124,12 +1124,11 @@ if [ "$clamd" = 'yes' ]; then useradd clam -s /sbin/nologin -d /var/lib/clamav 2>/dev/null gpasswd -a clam exim gpasswd -a clam mail - cp -f $vestacp/clamav/clamd.conf /etc/ cp -r /etc/clamd.d $vst_backups/clamd >/dev/null 2>&1 - ln -sf /etc/clamd.conf /etc/clamd.d/scan.conf + cp -f $vestacp/clamav/clamd.conf /etc/clamd.d/scan.conf cp -f $vestacp/clamav/freshclam.conf /etc/ - mkdir -p /var/log/clamav /var/run/clamav - chown clam:clam /var/log/clamav /var/run/clamav /var/run/clamd.scan + mkdir -p /var/log/clamav /var/run/clamd.scan + chown clam:clam /var/log/clamav /var/run/clamd.scan chown -R clam:clam /var/lib/clamav if [ "$release" -ge '7' ]; then cp -f $vestacp/clamav/clamd.service /usr/lib/systemd/system/ From 3881e369679527379f1fb6f325554670db0425b3 Mon Sep 17 00:00:00 2001 From: cmstew Date: Sat, 5 Jan 2019 13:02:23 -0700 Subject: [PATCH 07/10] Update vst-install-amazon.sh Keep /etc/clamd.conf as main file and link to it instead of using /etc/clamd.d/scan.conf. --- install/vst-install-amazon.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install/vst-install-amazon.sh b/install/vst-install-amazon.sh index a61439c6b..c34470bc8 100644 --- a/install/vst-install-amazon.sh +++ b/install/vst-install-amazon.sh @@ -1125,7 +1125,8 @@ if [ "$clamd" = 'yes' ]; then gpasswd -a clam exim gpasswd -a clam mail cp -r /etc/clamd.d $vst_backups/clamd >/dev/null 2>&1 - cp -f $vestacp/clamav/clamd.conf /etc/clamd.d/scan.conf + cp -f $vestacp/clamav/clamd.conf /etc/clamd.conf + ln -sf /etc/clamd.conf /etc/clamd.d/scan.conf cp -f $vestacp/clamav/freshclam.conf /etc/ mkdir -p /var/log/clamav /var/run/clamd.scan chown clam:clam /var/log/clamav /var/run/clamd.scan From 7f833efcde060aa638f1da3584621e8f5a1ba75a Mon Sep 17 00:00:00 2001 From: cmstew Date: Sat, 5 Jan 2019 13:08:59 -0700 Subject: [PATCH 08/10] Update vst-install-amazon.sh apparently the /var/run/clamav folder is still required for the sock file --- install/vst-install-amazon.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/vst-install-amazon.sh b/install/vst-install-amazon.sh index c34470bc8..f1d6786d9 100644 --- a/install/vst-install-amazon.sh +++ b/install/vst-install-amazon.sh @@ -1128,8 +1128,8 @@ if [ "$clamd" = 'yes' ]; then cp -f $vestacp/clamav/clamd.conf /etc/clamd.conf ln -sf /etc/clamd.conf /etc/clamd.d/scan.conf cp -f $vestacp/clamav/freshclam.conf /etc/ - mkdir -p /var/log/clamav /var/run/clamd.scan - chown clam:clam /var/log/clamav /var/run/clamd.scan + mkdir -p /var/log/clamav /var/run/clamav /var/run/clamd.scan + chown clam:clam /var/log/clamav /var/run/clamav /var/run/clamd.scan chown -R clam:clam /var/lib/clamav if [ "$release" -ge '7' ]; then cp -f $vestacp/clamav/clamd.service /usr/lib/systemd/system/ From 993796fcf26936958dc14fa64c910df59892ed53 Mon Sep 17 00:00:00 2001 From: Daniyal Javani Date: Wed, 5 Feb 2020 10:53:17 +0330 Subject: [PATCH 09/10] fix ftp restore path --- bin/v-restore-user | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/v-restore-user b/bin/v-restore-user index bd3d86bbf..3249cb4a2 100755 --- a/bin/v-restore-user +++ b/bin/v-restore-user @@ -56,6 +56,7 @@ ftpc() { quote USER $USERNAME quote PASS $PASSWORD binary + lcd $BACKUP $1 $2 $3 From ce417f65a25aa6f8db87ee0bff040150ed2e4a96 Mon Sep 17 00:00:00 2001 From: Maksim Usmanov | Maks Date: Sun, 5 Apr 2020 13:26:45 +0200 Subject: [PATCH 10/10] Fix reset password from CLI / roundcube This will fix bug when change password from cli $quota is not defined I not know if there is any function to get quota with a single comand, so I get alredy defined quota With out this vesta will reset quota or not asign nothing in passwd file when quota password was reset --- bin/v-change-mail-account-password | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/v-change-mail-account-password b/bin/v-change-mail-account-password index 28c8809b1..5c01ffbd8 100755 --- a/bin/v-change-mail-account-password +++ b/bin/v-change-mail-account-password @@ -52,8 +52,11 @@ salt=$(generate_password "$PW_MATRIX" "8") md5="{MD5}$($BIN/v-generate-password-hash md5 $salt <<<$password)" if [[ "$MAIL_SYSTEM" =~ exim ]]; then + quota=$(grep $account $VESTA/data/users/${user}/mail/${domain}.conf) + quota=$(echo $quota | awk '{ print $7 }' | sed -e "s/'//g" ) + quota=$(echo $quota | cut -d "=" -f 2 | sed -e "s/unlimited/0/g") sed -i "/^$account:/d" $HOMEDIR/$user/conf/mail/$domain/passwd - str="$account:$md5:$user:mail::$HOMEDIR/$user:$quota" + str="$account:$md5:$user:mail::$HOMEDIR/$user:${quota}M" echo $str >> $HOMEDIR/$user/conf/mail/$domain/passwd fi