| | |
| | | protected $clamav_socket = '/tmp/clamd.socket'; |
| | | |
| | | public function configure_amavis() { |
| | | global $conf; |
| | | global $conf, $dist; |
| | | |
| | | // amavisd user config file |
| | | $configfile = 'fedora_amavisd_conf'; |
| | |
| | | $content = str_replace('/var/spool/amavisd/clamd.sock', $this->clamav_socket, $content); |
| | | wf($conf["amavis"]["config_dir"].'/amavisd.conf', $content); |
| | | chmod($conf['amavis']['config_dir'].'/amavisd.conf', 0640); |
| | | |
| | | // for CentOS 7.2 only |
| | | if($dist['confid'] == 'centos72') { |
| | | chmod($conf['amavis']['config_dir'].'/amavisd.conf', 0750); |
| | | chgrp($conf['amavis']['config_dir'].'/amavisd.conf', 'amavis'); |
| | | } |
| | | |
| | | |
| | | // Adding the amavisd commands to the postfix configuration |
| | |
| | | $config_dir = $conf['postfix']['config_dir']; |
| | | |
| | | // Adding amavis-services to the master.cf file if the service does not already exists |
| | | if ($this->postfix_master()) { |
| | | exec ("postconf -M amavis.unix", $out, $ret); |
| | | $add_amavis = @($out[0]=='')?true:false; |
| | | unset($out); |
| | | exec ("postconf -M 127.0.0.1:10025.inet", $out, $ret); |
| | | $add_amavis_10025 = @($out[0]=='')?true:false; |
| | | unset($out); |
| | | exec ("postconf -M 127.0.0.1:10027.inet", $out, $ret); |
| | | $add_amavis_10027 = @($out[0]=='')?true:false; |
| | | unset($out); |
| | | } else { //* fallback - postfix < 2.9 |
| | | $content = rf($conf['postfix']['config_dir'].'/master.cf'); |
| | | $add_amavis = @(!preg_match('/^amavis\s+unix\s+/m', $content))?true:false; |
| | | $add_amavis_10025 = @(!preg_match('/^127.0.0.1:10025\s+/m', $content))?true:false; |
| | | $add_amavis_10027 = @(!preg_match('/^127.0.0.1:10027\s+/m', $content))?true:false; |
| | | } |
| | | $add_amavis = !$this->get_postfix_service('amavis','unix'); |
| | | $add_amavis_10025 = !$this->get_postfix_service('127.0.0.1:10025','inet'); |
| | | $add_amavis_10027 = !$this->get_postfix_service('127.0.0.1:10027','inet'); |
| | | |
| | | if ($add_amavis || $add_amavis_10025 || $add_amavis_10027) { |
| | | //* backup master.cf |