The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

User-level email filters not updated when account name changed

Discussion in 'Workarounds and Optimization' started by flopunctro, Jan 29, 2012.

  1. flopunctro

    flopunctro Registered

    Jan 29, 2012
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    DataCenter Provider
    Hello all,

    I've started migrating domains from multiple servers into one and I've ran into account name collisions. So I had no choice but to rename some CPanel/WHM accounts.

    I know this is not a "nice" thing to do :) but the alternatives are awful (several days of manually creating domains, email accounts, databases, filters...).

    Everything went unexpectedly well, with the sole exception of User-Level filters of the Email section.

    More specifically:
    1. "olduser" has the domain "olddomain.tld", which has the address "address1@olddomain.tld", which has some filters directing emails to various folders; for example, "subject contains ALERT -> deliver to folder ALERTS".

    2. "olduser" is renamed to "newuser".

    3. emails to "address1@olddomain.tld" keep arriving in Inbox, but the emails containing ALERT don't arrive anymore. exim_mainlog shows these:
    R=virtual_user_filter T=address_directory defer (13): Permission denied: cannot create /home/olduser/mail/domain.tld/address1/.ALERTS/
    And (luckily) the emails are still waiting in exim's queue.

    Notice that exim tries to deliver them to /home/olduser/.......

    The first thing I did was to create a symlink /home/olduser to /home/newuser. It worked as an emergency fix, but it's a "quick'n'dirty" solution, so I kept digging.

    The second thing to do is to manually edit all these User-Level filter rules from CPanel. In the "deliver to folder" box I could see the old (and wrong) path. I can modify the path and save the rule, and it works.
    While this is a better solution, it's not really that nice, and it wouldn't scale if I had dozens of rules :) so I kept researching some more.

    I found out that User-Level filters are kept in some files named "filter.yaml" , "filter" and "filter.cache" in the location "/home/newuser/etc/domain.tld/address1/". While manual editing is not recommended, apparently one can edit "filter" and "filter.yaml" and the changes will appear in CPanel's "User-Level filtering" page.

    However I could not find a way to automatically regenerate the file "filter.cache" (this is a "perl storable" file so I didn't want to edit it directly). But after the 2 text files are edited, the cache can be regenerated with CPanel's "User-Level filtering" page.

    Time permitting, I will also submit a real bug report to CPanel, though I believe this issue is too insignifiant. But i'm paying it forward :)


Share This Page