Quarantine management interface compatible with ISPConfig 3

Discussion in 'Plugins/Modules/Addons' started by LouTux, Mar 9, 2022.

  1. LouTux

    LouTux Member

    I was initially looking for a program I could use to manage emails that had been quarantined by ISPConfig 3. After a while I decided to give it a try myself. So here it is : GitHub. The application I wrote uses IMAP to connect to the quarantine mailbox. Once a user is connected with his email credentials, the application searches the quarantine mailbox inbox for email related to the user's email in the past 2 weeks. Then you have the option to select any number of messages and restore or delete them. Restore will trigger the application to send you a copy of the selected emails as an attachment. Thus if the email was previously filtered, this will prevent it from being filtered again. The application being purely PHP can easily be integrated in your ISPConfig server. Simply by creating a site for it.

    Note that only the DEV and Pre-Release branches have been updated. If you want to try the application, I suggest you try the pre-release branch. This is the one I am currently running on my production environment.

    Here are some screenshots:


    Maybe this can be useful to other people.

    Please share your comments and feedbacks.
    Last edited: Mar 14, 2022
  2. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    Interesting project. I'm curious how you have messages being put in the quarantine folder, just a sieve filter matching the spam score in the header or similar? For "Restore" operation, you could probably just move the message to the INBOX rather than resend?
    LouTux likes this.
  3. LouTux

    LouTux Member

    Actually I have setup AMAVIS in my spam policies to forward all detected emails to a [email protected] mailbox. Then AMAVIS processes emails as usual so a SPAM will be moved to the user's junk folder while an email containing a Virus is deleted. I also put a policy to restrict some file types such as zip archives. As I am seeing a lot of bad email with those types of attachments. Doing that cause some users to miss some important email. Thus I created this project to provide an easy way of recovering a quarantined email.
    That is an interesting suggestion. I'll check what php imap can do. Like can it move an email from one mailbox to another.
  4. LouTux

    LouTux Member

    Ok after some digging, using imap_mail_copy or imap_mail_move would work, but this is restricted to only one server and one account. Meaning that you can copy/move email within the connected imap account only. So in my case, this will not work.
    After that I looked at server side copy, this could work. But it is still restricted to one server.

    I have found a possible solution to moving the email. Maybe using imap_append. Using imap_append, I can simply output the .eml file as a new email on any imap connection. Thus I should be able to copy an email from say [email protected] to [email protected]. Even if both accounts are on seperate servers.

    I will give this a try.
  5. LouTux

    LouTux Member

    Ok made some updates. I added 2 features. Firstly the support for 2 restoring method. Secondly, support for aliases.
    ## ChangeLog

    * [2022-03-10]: MAIL class rename MAILER.
    * [2022-03-10]: PHPIMAP class rename IMAP.
    * [2022-03-10]: Added support for aliases.
    * [2022-03-10]: Added a new restoring method. You can now choose between resend or copy. Default is copy.
    * [2022-03-10][IMAP class]: Added support of multiple IMAP connections.
    * [2022-03-10][IMAP class]: Added a changeFolder method.
    * [2022-03-10][IMAP class]: Revisited the saveEml method and renamed it getEml.
    * [2022-03-10][IMAP class]: Added a saveEml method to save an eml into a mailbox.
    * [2022-03-10][IMAP class]: Added a __destruct method to close the main IMAP connection.
    * [2022-03-10][IMAP class]: Added a buildConnectionString method to build a mailbox string.
    * [2022-03-10][IMAP class]: Added a connect method to connect a mailbox.
    * [2022-03-10]: A new logging system has been added.
    * [2022-03-10]: Multiple fixes to the PHPIMAP class.
    * [2022-03-10][PHPIMAP class]: created a new method formatMsgs to format the messages array.
    * [2022-03-10][PHPIMAP class]: Added UNSEEN email count to the search method.
    * [2022-03-10][PHPIMAP class]: Added default criteria to the search method.
    * [2022-03-10][PHPIMAP class]: Live IMAP Connections are now saved in the IMAP Property.
    * [2022-03-10][PHPIMAP class]: Closing the IMAP connection on successful login.
    * [2022-03-10]: 1 fix to the MAIL class.
    * [2022-03-10][MAIL class]: Clearing attachments before adding the new one.
    * [2022-03-10]: 1 fix to the API class.
    * [2022-03-10][API class]: Fixing the creation of the tmp directory.

    ## Known Issues

    * Bad Overflow-y when listing gets too long
    * Need a page to change settings
  6. LouTux

    LouTux Member

    Here is an example of a spamfilter policy:
    • Policy
      • Virus Lover : No
      • SPAM Lover : No
    • Amavis
      • Settings
        • Banned files lover : No
        • Bad header lover : No
        • Bypass virus checks : No
        • Bypass banned checks : No
        • Bypass header checks : No
      • Tag-Level
        • SPAM tag level : 3.0
        • SPAM tag2 level : 5.0
        • SPAM kill level : 5.0
        • SPAM dsn cutoff level : 8.0
        • SPAM quarantine cutoff level : 10.0
        • SPAM modifies subject : Yes
        • SPAM subject tag : [SPAM]
        • SPAM subject tag2 : [WARNING][SPAM]
      • Quarantine (Where you specify you're quarantine mailbox)
      • Other
    • Rspamd
      • Greylisting level : 2.5
      • SPAM tag level : 4.0
      • SPAM tag method : Header (adds "X-spam: Yes")
      • SPAM reject level : 10
  7. LouTux

    LouTux Member

    Here are the latest updates:

    ## Version 22.03-14

    * Added additional screenshots
    * Added some documentations for spam policy on ISPConfig
    * Fix issue: administrator without password prevents saving settings.
    * Default restoration method is now set during application initialization. So if you didn't have set the setting, the application still sets it in $this->Settings['method'].
    * Fix issue: SMTP Authentication seems to always accept all logins.
    * Added the restoration method settings in the settings panel.
    * Added the aliases settings in the settings panel.
    * Added counts on dashboard.
    * Made the Settings's header fix position.
    * Made the Settings's footer fix position.
    * Made the Dashboard's header fix position.
    * Made the Dashboard's footer fix position.
    * Fix issue: signing out requires browser refresh

    ## Version 22.03-12

    * Added a confirmation before deletion.

    ## Version 22.03-11

    * PHP IMAP class: Found 3 typos. (encyption => encryption)
    * Added the save event for the settings. Only need to test now.
    * PHP API class: Added a save method to save the settings
    * Added the following settings in the settings area: (IMAP,SMTP,Timezone,Language and Administrator).
    * Added a tooltip on the date of the email to display the full date.
    * PHP API class: Added a list method to retrieve application settings.
    * PHP API class: Added a isAdmin method to test if the loggedin user is the administrator.
    * You can now enable debug by adding ```"debug": true,``` in the config/config.json file.
    * PHP MAILER class: Fix logo. The logo will now be displayed only if link to file is provided.
    * PHP MAILER class: Fix footer links. Only provided links will now be shown in the footer.
    * Added support for an administrator
    * Fixed the "Overflow-y when listing gets too long" issue
    * Fixed an issue where the Sign Out function would cause the user to re-login with the session data.
    * PHP URL class: Added a sanitize method.
    * JS Engine: Added proper support for Pace. Pace loading is now accurate with the AJAX Requests
    * Added a menu item settings only available to admin
    * PHP Auth class: Changed the try method to use the builtin login method.
    * PHP Auth class: Logged in user now accessible in $this->Auth->Username.
    * PHP Auth class: try method renamed to authenticate and now handles all authentication steps previously split with the __construct method.
    * Added a default timezone of 'America/Toronto' now accessible in $this->Timezone and Engine.Storage.get('timezone').
  8. LouTux

    LouTux Member

    Project has reach a complete state. Further improvement will be on request. I have covered all the features I was looking for. Branch Stable set to Version 22.03-14.
    muelli75 and till like this.

Share This Page