email global content filters insert into MySQL

Discussion in 'Installation/Configuration' started by electronico_nc, Aug 29, 2013.

  1. (3.0.5.3 stable installed from tar.gz)
    Hi all,

    I need to insert a lot of efficient rules to postfix header/body/mime checks.
    I just would like to know if I can SAFELY run a script to insert them into MySQL (so there won't be anything wrong with future ISPConfig updates).

    On my other (than ISPConfig) servers I have files like :
    header_checks.cf
    Code:
    ...
    /^Subject:(.*)beast/   REJECT   X-Rated Subject Line
    /^Subject:(.*)bitch/   REJECT   X-Rated Subject Line
    /^Subject:(.*)bodies/   REJECT   X-Rated Subject Line
    /^Subject:(.*)breast/   REJECT   X-Rated Subject Line
    /^Subject:(.*)fuck/   REJECT   X-Rated Subject Line
    /^Subject:(.*)galore/   REJECT   X-Rated Subject Line
    /^Subject:(.*)gay/   REJECT   X-Rated Subject Line
    /^Subject:(.*)porn/   REJECT   X-Rated Subject Line
    ...
    So I would like to parse file and proceed to :
    Code:
    #!/bin/bash
    `/usr/bin/mysql $SQL_ARGS INSERT INTO mail_content_filter
     (sys_userid,sys_groupid,sys_perm_user,sys_perm_group,server_id,type,pattern,data,action,active) 
    VALUES 
    ('1','1','riud','riud','1','header',\"$pattern\",\"$data\",\"$action\",'y')";"`
    I'm not asking anything about the above script but about the method to insert rules in ISPConfig (as I have hundreds to add).
    Thanks in advance for your time.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    The rules will show up in the interface but get ignored. ISPConfig wont write the rules to the config files if you dont create a valid ispconfig tranaction in sys_datalog for them.

    If you want to write data correctly to the ispconfig database, use the datalogInsert() function from the ispconfig mysql class to insert the data into the ispconfig database.
     

Share This Page