@@ -1814,6 +1814,7 @@ public function configure_rspamd() {
18141814 $ mail_config ['dkim_path ' ] = substr ($ mail_config ['dkim_path ' ], 0 , strlen ($ mail_config ['dkim_path ' ])-1 );
18151815 }
18161816 $ dkim_domains = $ this ->db ->queryAllRecords ('SELECT `dkim_selector`, `domain` FROM ?? WHERE `dkim` = ? ORDER BY `domain` ASC ' , $ conf ['mysql ' ]['database ' ] . '.mail_domain ' , 'y ' );
1817+ # should move maps to local.d/maps.d/ ?
18171818 $ fpp = fopen ('/etc/rspamd/local.d/dkim_domains.map ' , 'w ' );
18181819 $ fps = fopen ('/etc/rspamd/local.d/dkim_selectors.map ' , 'w ' );
18191820 foreach ($ dkim_domains as $ dkim_domain ) {
@@ -1824,19 +1825,28 @@ public function configure_rspamd() {
18241825 fclose ($ fps );
18251826 unset($ dkim_domains );
18261827
1828+ # local.d templates with template tags
18271829 $ tpl = new tpl ();
1828- $ tpl ->newTemplate ('rspamd_users.conf.master ' );
1830+ $ tpl ->newTemplate ('rspamd_dkim_signing.conf.master ' );
1831+ $ tpl ->setVar ('dkim_path ' , $ mail_config ['dkim_path ' ]);
1832+ wf ('/etc/rspamd/local.d/dkim_signing.conf ' , $ tpl ->grab ());
1833+
1834+ $ tpl = new tpl ();
1835+ $ tpl ->newTemplate ('rspamd_options.inc.master ' );
18291836
1830- $ whitelist_ips = array ();
1831- $ ips = $ this ->db ->queryAllRecords ("SELECT * FROM server_ip WHERE server_id = ? " , $ conf ['server_id ' ]);
1837+ echo "\nDEBUGGING local_addrs LOOP \n\n" ;
1838+ sleep (1 );
1839+ $ local_addrs = array ();
1840+ $ ips = $ this ->db ->queryAllRecords ('SELECT `ip_address`, `ip_type` FROM ?? WHERE `server_id` = ? ' , $ conf ['mysql ' ]['database ' ].'.server_ip ' , $ conf ['server_id ' ]);
18321841 if (is_array ($ ips ) && !empty ($ ips )){
18331842 foreach ($ ips as $ ip ){
1834- $ whitelist_ips [] = array ('ip ' => $ ip ['ip_address ' ]);
1843+ $ local_addrs [] = array ('quoted_ip ' => "\"" . $ ip ['ip_address ' ]. "\" , \n" );
18351844 }
18361845 }
1837- $ tpl ->setLoop ('whitelist_ips ' , $ whitelist_ips );
1838- wf ('/etc/rspamd/local.d/users.conf ' , $ tpl ->grab ());
1846+ $ tpl ->setLoop ('local_addrs ' , $ local_addrs );
1847+ wf ('/etc/rspamd/local.d/options.inc ' , $ tpl ->grab ());
18391848
1849+ # local.d templates without template tags
18401850 $ local_d = array (
18411851 'groups.conf ' ,
18421852 'antivirus.conf ' ,
@@ -1845,10 +1855,10 @@ public function configure_rspamd() {
18451855 'mx_check.conf ' ,
18461856 'redis.conf ' ,
18471857 'milter_headers.conf ' ,
1848- 'options.inc ' ,
18491858 'neural.conf ' ,
18501859 'neural_group.conf ' ,
1851- 'group.conf ' ,
1860+ 'users.conf ' ,
1861+ 'groups.conf ' ,
18521862 );
18531863 foreach ($ local_d as $ f ) {
18541864 if (file_exists ($ conf ['ispconfig_install_dir ' ]."/server/conf-custom/install/rspamd_ $ {f}.master " )) {
@@ -1858,6 +1868,7 @@ public function configure_rspamd() {
18581868 }
18591869 }
18601870
1871+ # override.d templates without template tags
18611872 $ override_d = array (
18621873 'rbl_group.conf ' ,
18631874 'surbl_group.conf ' ,
@@ -1866,10 +1877,11 @@ public function configure_rspamd() {
18661877 if (file_exists ($ conf ['ispconfig_install_dir ' ]."/server/conf-custom/install/rspamd_ $ {f}.master " )) {
18671878 exec ('cp ' .$ conf ['ispconfig_install_dir ' ]."/server/conf-custom/install/rspamd_ $ {f}.master /etc/rspamd/override.d/ $ {f}" );
18681879 } else {
1869- exec ("cp tpl/rspamd_{f}.master /etc/rspamd/override.d/ $ {f}" );
1880+ exec ("cp tpl/rspamd_ $ {f}.master /etc/rspamd/override.d/ $ {f}" );
18701881 }
18711882 }
18721883
1884+ # local.d/maps.d templates without template tags
18731885 $ maps_d = array (
18741886 'dkim_whitelist.inc ' ,
18751887 'dmarc_whitelist.inc ' ,
@@ -1884,10 +1896,6 @@ public function configure_rspamd() {
18841896 }
18851897 }
18861898
1887- $ tpl = new tpl ();
1888- $ tpl ->newTemplate ('rspamd_dkim_signing.conf.master ' );
1889- $ tpl ->setVar ('dkim_path ' , $ mail_config ['dkim_path ' ]);
1890- wf ('/etc/rspamd/local.d/dkim_signing.conf ' , $ tpl ->grab ());
18911899
18921900 exec ('chmod a+r /etc/rspamd/local.d/* /etc/rspamd/local.d/maps.d/* /etc/rspamd/override.d/* ' );
18931901
0 commit comments