| | |
| | | $this->remove_dkim_key($mail_config['dkim_path']."/".$data['new']['domain'], $data['new']['domain']); |
| | | } |
| | | } else { |
| | | $app->log('Error saving the DKIM Private-key for '.$data['new']['domain'].' - DKIM is not enabled for the domain.', LOGLEVEL_ERROR); |
| | | $app->log('Error saving the DKIM Private-key for '.$data['new']['domain'].' - DKIM is not enabled for the domain.', LOGLEVEL_DEBUG); |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | function domain_dkim_update($event_name, $data) { |
| | | global $app; |
| | | if ($this->check_system($data)) { |
| | | /* maildomain disabled */ |
| | | if ($data['new']['active'] == 'n' && $data['old']['active'] == 'y' && $data['new']['dkim']=='y') { |
| | | $app->log('Maildomain '.$data['new']['domain'].' disabled - remove DKIM-settings', LOGLEVEL_DEBUG); |
| | | $this->remove_dkim($data['new']); |
| | | } |
| | | /* maildomain re-enabled */ |
| | | if ($data['new']['active'] == 'y' && $data['old']['active'] == 'n' && $data['new']['dkim']=='y') |
| | | $this->add_dkim($data); |
| | | |
| | | /* maildomain active - only dkim changes */ |
| | | if ($data['new']['active'] == 'y' && $data['old']['active'] == 'y') { |
| | | /* dkim disabled */ |
| | | if ($data['new']['dkim'] != $data['old']['dkim'] && $data['new']['dkim'] == 'n') { |
| | | if($data['new']['dkim'] == 'y' || $data['old']['dkim'] == 'y'){ |
| | | if ($this->check_system($data)) { |
| | | /* maildomain disabled */ |
| | | if ($data['new']['active'] == 'n' && $data['old']['active'] == 'y' && $data['new']['dkim']=='y') { |
| | | $app->log('Maildomain '.$data['new']['domain'].' disabled - remove DKIM-settings', LOGLEVEL_DEBUG); |
| | | $this->remove_dkim($data['new']); |
| | | } |
| | | /* dkim enabled */ |
| | | elseif ($data['new']['dkim'] != $data['old']['dkim'] && $data['new']['dkim'] == 'y') { |
| | | /* maildomain re-enabled */ |
| | | if ($data['new']['active'] == 'y' && $data['old']['active'] == 'n' && $data['new']['dkim']=='y') |
| | | $this->add_dkim($data); |
| | | } |
| | | /* new private-key */ |
| | | if ($data['new']['dkim_private'] != $data['old']['dkim_private'] && $data['new']['dkim'] == 'y') { |
| | | $this->add_dkim($data); |
| | | } |
| | | /* new selector */ |
| | | if ($data['new']['dkim_selector'] != $data['old']['dkim_selector'] && $data['new']['dkim'] == 'y') { |
| | | $this->add_dkim($data); |
| | | } |
| | | /* new domain-name */ |
| | | if ($data['new']['domain'] != $data['old']['domain']) { |
| | | $this->remove_dkim($data['old']); |
| | | $this->add_dkim($data); |
| | | } |
| | | } |
| | | |
| | | /* resync */ |
| | | if ($data['new']['active'] == 'y' && $data['new'] == $data['old'] && $data['new']['dkim']=='y') { |
| | | $this->add_dkim($data); |
| | | /* maildomain active - only dkim changes */ |
| | | if ($data['new']['active'] == 'y' && $data['old']['active'] == 'y') { |
| | | /* dkim disabled */ |
| | | if ($data['new']['dkim'] != $data['old']['dkim'] && $data['new']['dkim'] == 'n') { |
| | | $this->remove_dkim($data['new']); |
| | | } |
| | | /* dkim enabled */ |
| | | elseif ($data['new']['dkim'] != $data['old']['dkim'] && $data['new']['dkim'] == 'y') { |
| | | $this->add_dkim($data); |
| | | } |
| | | /* new private-key */ |
| | | if ($data['new']['dkim_private'] != $data['old']['dkim_private'] && $data['new']['dkim'] == 'y') { |
| | | $this->add_dkim($data); |
| | | } |
| | | /* new selector */ |
| | | if ($data['new']['dkim_selector'] != $data['old']['dkim_selector'] && $data['new']['dkim'] == 'y') { |
| | | $this->add_dkim($data); |
| | | } |
| | | /* new domain-name */ |
| | | if ($data['new']['domain'] != $data['old']['domain']) { |
| | | $this->remove_dkim($data['old']); |
| | | $this->add_dkim($data); |
| | | } |
| | | } |
| | | |
| | | /* resync */ |
| | | if ($data['new']['active'] == 'y' && $data['new'] == $data['old'] && $data['new']['dkim']=='y') { |
| | | $this->add_dkim($data); |
| | | } |
| | | } |
| | | } |
| | | } |