Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

MailScanner Quarantine

Discussion in 'E-mail Discussion' started by icanectc, May 14, 2004.

  1. icanectc

    icanectc Well-Known Member

    Joined:
    Mar 10, 2003
    Messages:
    344
    Likes Received:
    0
    Trophy Points:
    166
    Whats the FASTEST way to clear the quarantine items?? I noticed this is piling up pretty darn fast... when I rm it will ask me for each and every one of them.. Is there a just do it command??? So that i dont have to keep marking y y y y y each time??
     
  2. Damian

    Damian Well-Known Member

    Joined:
    Oct 1, 2001
    Messages:
    99
    Likes Received:
    6
    Trophy Points:
    308
    Include

    -f

    with the command and it will force the removal without prompting for each file.

    So, if you are in the right directory you can issue

    rm -f *.*

    and it will delete every file within that directory.

    Always excercise caution when using -f as you can't undo what it does.
     
  3. icanectc

    icanectc Well-Known Member

    Joined:
    Mar 10, 2003
    Messages:
    344
    Likes Received:
    0
    Trophy Points:
    166
    Great thanks!
     
  4. Rubas

    Rubas Well-Known Member

    Joined:
    Sep 15, 2003
    Messages:
    125
    Likes Received:
    0
    Trophy Points:
    166
    MailScanner.conf

    # Do you want to store copies of the infected attachments and messages?
    # This can also be the filename of a ruleset.
    Quarantine Infections = no
     
  5. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,470
    Likes Received:
    21
    Trophy Points:
    463
    Location:
    Go on, have a guess
    Or, you can run the CRON job that comes with MailScanner. If you have the layer1 installation:

    cp /usr/mailscanner/bin/cron/clean.quarantine.cron /etc/cron.daily/.

    Then edit the file in /etc/cron.daily/ and set:
    $disabled = 0;
    $days_to_keep = 30; # set to the number of days you want to keep
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. icanectc

    icanectc Well-Known Member

    Joined:
    Mar 10, 2003
    Messages:
    344
    Likes Received:
    0
    Trophy Points:
    166
    Nice Chirpy I like that one!!

    Although I do not have a BIN directory in MailScanner.
     
  7. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,470
    Likes Received:
    21
    Trophy Points:
    463
    Location:
    Go on, have a guess
    I can only guess that you're not using the layer1 distribution. Anyway, here's the contents of the file, put it into a file in /etc/cron.daily and then chmod +x the file
    Code:
    #!/usr/bin/perl
    #
    # IMPORTANT NOTE:
    #
    # Change the next line to 0 instead of 1 to enable this script.
    # By default it will be disabled and will not do anything.
    #
    
    $disabled = 1;
    $quarantine_dir = '/var/spool/MailScanner/quarantine';
    $days_to_keep   = 30;
    
    exit if $disabled;
    
    # Standardise the format of the directory name
    die 'Path for quarantine_dir must be absolute' unless $quarantine_dir =~ /^\//;
    $quarantine_dir =~ s/\/$//; # Delete trailing slash
    
    # Now get the content list for the directory.
    opendir(QDIR, $quarantine_dir) or die "Couldn't read directory $quarantine_dir";
    
    # Loop through this list looking for any *directory* which hasn't been
    # modified in the last $days_to_keep days.
    # Unfortunately this will do nothing if the filesystem is backed up using tar.
    while($entry = readdir(QDIR)) {	
    	next if $entry =~ /^\./;
    	$entry = $quarantine_dir . '/' . $entry;
    	system("rm -rf $entry") if -d $entry &&
    	                           -M $entry > $days_to_keep;
    }
    closedir(QDIR);
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. icanectc

    icanectc Well-Known Member

    Joined:
    Mar 10, 2003
    Messages:
    344
    Likes Received:
    0
    Trophy Points:
    166
    That worked thanks a bunch chirpy. You rock!
     
  9. icanectc

    icanectc Well-Known Member

    Joined:
    Mar 10, 2003
    Messages:
    344
    Likes Received:
    0
    Trophy Points:
    166
    Actually if you dont install the one from layer1 as I did. The file clean.quarantine is already located for us in /etc/cron.daily. Although you must enable it it comes disabled by default.

    Just an FYI out their.
     
  10. spaceman

    spaceman Well-Known Member

    Joined:
    Mar 25, 2002
    Messages:
    492
    Likes Received:
    2
    Trophy Points:
    318
    If you're in /var/spool/MailScanner/quarantine/ you'll need to use rm -Rf *, and not rm -f *.*, because inside /quarantine are lots of non-empty directories which won't be touched by rm -f *.*. AND YES - MAKE F'ING SURE YOU'RE IN /var/spool/MailScanner/quarantine/ before running rm -Rf * OR ELSE EVERYTHING (directories, sub directories, files, etc.) IS GOING TO BE DELETED (NO 'ARE YOU SURE', NO 'RECYCLE BIN')!!!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice