for i in `vzlist -o ctid -H`; do echo "---------------------------------------------------------------------------------------------------------------------------------------" echo "--------------------------------------------------------- CTID $i ---------------------------------------------------------------------" echo "_______________________________________________________________________________________________________________________________________" #make sure this box is cpanel if [ -f /vz/root/$i/usr/local/cpanel/version ]; then eximversion=$(vzctl exec $i "rpm -qa | grep exim") if [ "$eximversion" = "exim-4.92-1.cp1178.x86_64" ] || [ "$eximversion" = "exim-4.92-1.cp1180.x86_64" ] || [ "$eximversion" = "exim-4.91-4.cp1170.x86_64" ]; then echo "Exim is patched: $eximversion"; if [ -f /vz/root/$i/etc/eximdisable ]; then rm -f /vz/root/$i/etc/eximdisable; vzctl exec $i "service exim start; chkconfig exim on" fi else #Lets try to update cPanel and check exim again vzctl exec $i "curl http://mirror.beyondhosting.net/provisioning/bhscripts/fixcpupgrade.sh | bash" #Check exim version after upgrade eximversion=$(vzctl exec $i "rpm -qa | grep exim") if [ "$eximversion" = "exim-4.92-1.cp1178.x86_64" ] || [ "$eximversion" = "exim-4.92-1.cp1180.x86_64" ] || [ "$eximversion" = "exim-4.91-4.cp1170.x86_64" ]; then echo "Patching succeeded, exim is up to date and can be enabled." if [ -f /vz/root/$i/etc/eximdisable ]; then rm -f /vz/root/$i/etc/eximdisable; vzctl exec $i "service exim start; chkconfig exim on" fi # Didn't successfully update cPanel.. still vulernable.. keep it disabled else echo "Disabling EXIM" touch /vz/root/$i/etc/eximdisable vzctl exec $i "service exim stop" fi; fi fi done;