From f339ebf3a37fc23aac843ce1c7008d4a77d87fa8 Mon Sep 17 00:00:00 2001
From: Dominik <info@profi-webdesign.com>
Date: Sat, 25 Apr 2015 08:23:33 -0400
Subject: [PATCH] mdbox format as alternative for Maildir

---
 install/lib/installer_base.lib.php |   66 +++++++++++++++++++++++++++++++--
 1 files changed, 62 insertions(+), 4 deletions(-)

diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index acaaf3b..cf9b519 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -694,6 +694,9 @@
 		//* mysql-virtual_sender.cf
 		$this->process_postfix_config('mysql-virtual_sender.cf');
 
+		//* mysql-virtual_sender_login_maps.cf
+		$this->process_postfix_config('mysql-virtual_sender_login_maps.cf');
+
 		//* mysql-virtual_client.cf
 		$this->process_postfix_config('mysql-virtual_client.cf');
 
@@ -745,13 +748,18 @@
 			}
 		}
 		unset($rbl_hosts);
-		unset($server_ini_array);
 
 		//* If Postgrey is installed, configure it
 		$greylisting = '';
 		if($conf['postgrey']['installed'] == true) {
-			$greylisting = 'check_recipient_access mysql:/etc/postfix/mysql-virtual_policy_greylist.cf';
+			$greylisting = ', check_recipient_access mysql:/etc/postfix/mysql-virtual_policy_greylist.cf';
 		}
+		
+		$reject_sender_login_mismatch = '';
+		if(isset($server_ini_array['mail']['reject_sender_login_mismatch']) && ($server_ini_array['mail']['reject_sender_login_mismatch'] == 'y')) {
+			$reject_sender_login_mismatch = ', reject_authenticated_sender_login_mismatch';
+		}
+		unset($server_ini_array);
 		
 		$postconf_placeholders = array('{config_dir}' => $config_dir,
 			'{vmail_mailbox_base}' => $cf['vmail_mailbox_base'],
@@ -759,6 +767,7 @@
 			'{vmail_groupid}' => $cf['vmail_groupid'],
 			'{rbl_list}' => $rbl_list,
 			'{greylisting}' => $greylisting,
+			'{reject_slm}' => $reject_sender_login_mismatch,
 		);
 
 		$postconf_tpl = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_postfix.conf.master', 'tpl/debian_postfix.conf.master');
@@ -1309,7 +1318,7 @@
 	}
 
 
-    public function configure_xmpp() {
+    public function configure_xmpp($options = '') {
         global $conf;
 
         if($conf['xmpp']['installed'] == false) return;
@@ -1349,14 +1358,63 @@
         $content = str_replace('{server_id}', $conf['server_id'], $content);
         wf($full_file_name, $content);
 
+        if(!stristr($options, 'dont-create-certs')){
+            // Create SSL Certificate for localhost
+            echo "writing new private key to 'localhost.key'\n-----\n";
+            $ssl_country = $this->free_query('Country Name (2 letter code)', 'AU');
+            $ssl_locality = $this->free_query('Locality Name (eg, city)', '');
+            $ssl_organisation = $this->free_query('Organization Name (eg, company)', 'Internet Widgits Pty Ltd');
+            $ssl_organisation_unit = $this->free_query('Organizational Unit Name (eg, section)', '');
+            $ssl_domain = $this->free_query('Common Name (e.g. server FQDN or YOUR name)', $conf['hostname']);
+            $ssl_email = $this->free_query('Email Address', '');
+
+            $tpl = new tpl('metronome_conf_ssl.master');
+            $tpl->setVar('ssl_country',$ssl_country);
+            $tpl->setVar('ssl_locality',$ssl_locality);
+            $tpl->setVar('ssl_organisation',$ssl_organisation);
+            $tpl->setVar('ssl_organisation_unit',$ssl_organisation_unit);
+            $tpl->setVar('domain',$ssl_domain);
+            $tpl->setVar('ssl_email',$ssl_email);
+            wf('/etc/metronome/certs/localhost.cnf', $tpl->grab());
+            unset($tpl);
+            // Generate new key, csr and cert
+            exec("(cd /etc/metronome/certs && make localhost.key)");
+            exec("(cd /etc/metronome/certs && make localhost.csr)");
+            exec("(cd /etc/metronome/certs && make localhost.cert)");
+            exec('chmod 0400 /etc/metronome/certs/localhost.key');
+            exec('chown metronome /etc/metronome/certs/localhost.key');
+        }else{
+            echo "-----\n";
+            echo "Metronome XMPP SSL server certificate is not renewed. Run the following command manual as root to recreate it:\n";
+            echo "# (cd /etc/metronome/certs && make localhost.key && make localhost.csr && make localhost.cert && chmod 0400 localhost.key && chown metronome localhost.key)\n";
+            echo "-----\n";
+        }
 
         // Copy init script
         caselog('cp -f apps/metronome-init /etc/init.d/metronome', __FILE__, __LINE__);
         caselog('chmod u+x /etc/init.d/metronome', __FILE__, __LINE__);
+        caselog('update-rc.d metronome defaults', __FILE__, __LINE__);
 
         exec($this->getinitcommand('xmpp', 'restart'));
 
-
+/*
+writing new private key to 'smtpd.key'
+-----
+You are about to be asked to enter information that will be incorporated
+into your certificate request.
+What you are about to enter is what is called a Distinguished Name or a DN.
+There are quite a few fields but you can leave some blank
+For some fields there will be a default value,
+If you enter '.', the field will be left blank.
+-----
+Country Name (2 letter code) [AU]:
+State or Province Name (full name) [Some-State]:
+Locality Name (eg, city) []:
+Organization Name (eg, company) [Internet Widgits Pty Ltd]:
+Organizational Unit Name (eg, section) []:
+Common Name (e.g. server FQDN or YOUR name) []:
+Email Address []:
+ * */
 
         /*// Dont just copy over the virtualhost template but add some custom settings
         $tpl = new tpl('apache_apps.vhost.master');

--
Gitblit v1.9.1