Koozali.org: home of the SME Server

Clearing email queue

Offline jameswilson

  • *
  • 795
  • +0/-0
    • Security Warehouse, professional security equipment
Clearing email queue
« on: May 18, 2017, 04:32:36 PM »
My server has had one of its user accounts compromised. I have found it and reset the password and also installed fail2ban (was installed but wasnt running) to prevent this again.
But i now have a huge queue of messages unable to be sent. I want to remove them all but the threads on the forum seem to be for older versions or look risky.
Is there a simple command I dont mind loosing all of them as they are all spam.

James

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Clearing email queue
« Reply #1 on: May 18, 2017, 05:01:54 PM »
Code: [Select]
yum --enablerepo=smecontribs install smeserver-qmHandle

you can then use the web page to manage qmail queue or che CLI

HTH

Offline Daniel B.

  • *
  • 1,700
  • +0/-0
    • Firewall Services, la sécurité des réseaux
Re: Clearing email queue
« Reply #2 on: May 18, 2017, 05:05:29 PM »
Or, there's the quick'n'dirty way:

Code: [Select]
sv d /service/qmail
mv /var/qmail/queue /var/qmail/queue.spam
yum -y reinstall qmail
signal-event email-update
C'est la fin du monde !!! :lol:

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Clearing email queue
« Reply #3 on: May 18, 2017, 05:12:04 PM »
interesting trick, thank you

Offline jameswilson

  • *
  • 795
  • +0/-0
    • Security Warehouse, professional security equipment
Re: Clearing email queue
« Reply #4 on: May 18, 2017, 05:13:44 PM »
Or, there's the quick'n'dirty way:

Code: [Select]
sv d /service/qmail
mv /var/qmail/queue /var/qmail/queue.spam
yum -y reinstall qmail
signal-event email-update

Superb solved my issue. Thanks

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Clearing email queue
« Reply #5 on: May 18, 2017, 08:01:07 PM »
Superb solved my issue. Thanks

Be aware there may have been some innocent victims of that. Some messages from non-compromised accounts may still be sitting in the old queue. i would purge the old queue of messages from the compromised account, and see what is left.

find and grep will be your friends here.

Offline jameswilson

  • *
  • 795
  • +0/-0
    • Security Warehouse, professional security equipment
Re: Clearing email queue
« Reply #6 on: May 18, 2017, 08:18:07 PM »
Be aware there may have been some innocent victims of that. Some messages from non-compromised accounts may still be sitting in the old queue. i would purge the old queue of messages from the compromised account, and see what is left.

find and grep will be your friends here.
agreed but in my case I'm happy if a few genuine outbounds were lost then so be it.
As a side note or question, can something like fail2ban be included by default but with looser settings than default. Even better a fail2ban menu in server manager with disabled, low, medium, high settings etc?

Offline Jean-Philippe Pialasse

  • *
  • 2,912
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: Clearing email queue
« Reply #7 on: May 19, 2017, 12:30:08 AM »
Qmhandle has a grep function, works great to purge multiples copies at once and leave only few mails for manual checking.