Email for KIDs - Important, please help

Discussion in 'Tips/Tricks/Mods' started by sghazagh, Sep 25, 2017.

  1. sghazagh

    sghazagh Member

    Hello everyone.
    I have a very important question and hope you can help.
    We have a ISPConfig 3 control panel on Ubuntu server for few of domain and sites we have.
    Recently , I have created new account for my kid to be able to receive email from her parents.
    We only want her to be able to received emails from certain domains/users for instance from "example.com" and/or [email protected].

    I see the mailbox has option for "Custom Rule".
    Is there anyway I restrict the incoming mails for a particular user by using the Custom Rule in Ispconfig 3? and how?

    There are couple of other domains on the server using the Postfix so I am not sure if I can do that for certain user/domain at Postfix level and don't know how.

    So please help as I need to setup it and be sure my daughter is safe for receiving emails only from her parents.

    any help is appreciated,
     
  2. sghazagh

    sghazagh Member

    Hi everyone,
    I read through Sieve and found the answer myself.
    So I add the answer here and hope helps others if they need simillar settings.

    If your mailserver uses Dovecot, then Sieve is the program which can be used for custom filter.
    each user has it's own sieve file located here: /var/vmail/example.com/user/sieve/ispconfig.sieve

    by default, ISPconfig has these extensions enabled: require ["fileinto", "regex", "date", "relational", "vacation"];
    but if you need to reject some messages, you also need extensions "reject" and "envelope" (might not required):
    so first in your user mailbox in ISPconfig go to Mailbox Email and choose your user. Then go to "Custom Rule" and add these rules in the text area:
    ------------------
    if not anyof(
    header :contains ["X-Spam-known-sender"] "yes",
    header :contains ["from"] ["yourdomain.com"]
    ) {
    # ...filtering code goes here...
    reject "Mailbox is restricted!";
    stop;
    }
    ----------------------

    Then you need to add the required extensions to your sieve file:
    the final file should look like these:
    ------------------------------
    require ["envelope", "fileinto", "regex", "date", "relational", "vacation", "reject"];
    if not anyof(
    header :contains ["X-Spam-known-sender"] "yes",
    header :contains ["from"] ["yourdomain.com"]
    ) {
    # ...filtering code goes here...
    reject "Mailbox is restricted!";
    stop;
    }
    keep;
    ------------------------------

    Note: if you change the rules in ISPConfig, the required filed is back to default and your rule might not work.
    So if anyone knows how to add default Sieve required extensions , please post it here.

    Thanks all,
     
  3. sghazagh

    sghazagh Member

    Also, there is usually no reason to send a reply to spam (since it isn't being read and the From address may be spoofed), so this would be better in most cases to use "discard" instead of "reject":

    ...
    # ...filtering code goes here...
    discard;
    stop;
    }
    ...
     
  4. sghazagh

    sghazagh Member

    And answer to last bit of my email...

    All ISPConfig config file templates are in the directory /usr/local/ispconfig/server/conf/.
    Sieve master files are here too.
    You can add extension or change template as per your need.
    Store your modified copy of the file in the "conf-custom" directory, so that it does not get overwritten on updates.
     

Share This Page