| 
				
			 | 
			
			
				@@ -120,29 +120,41 @@ function email_create_template { 
			 | 
		
	
		
			
			| 
				120
			 | 
			
				120
			 | 
			
			
				 } 
			 | 
		
	
		
			
			| 
				121
			 | 
			
				121
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				122
			 | 
			
				122
			 | 
			
			
				 function email_install_tls { 
			 | 
		
	
		
			
			| 
				123
			 | 
			
				
			 | 
			
			
				-    # make a tls certificate for email 
			 | 
		
	
		
			
			| 
				
			 | 
			
				123
			 | 
			
			
				+    tls_config_file=/etc/exim4/conf.d/main/03_exim4-config_tlsoptions 
			 | 
		
	
		
			
			| 
				
			 | 
			
				124
			 | 
			
			
				+    tls_auth_config_file=/etc/exim4/conf.d/auth/30_exim4-config_examples 
			 | 
		
	
		
			
			| 
				
			 | 
			
				125
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				126
			 | 
			
			
				+    if [ ! -f $tls_config_file ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				127
			 | 
			
			
				+        tls_config_file=/etc/exim4/exim4.conf.template 
			 | 
		
	
		
			
			| 
				
			 | 
			
				128
			 | 
			
			
				+        tls_auth_config_file=$tls_config_file 
			 | 
		
	
		
			
			| 
				
			 | 
			
				129
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				124
			 | 
			
				130
			 | 
			
			
				     if [ ! -f /etc/ssl/certs/exim.dhparam ]; then 
			 | 
		
	
		
			
			| 
				125
			 | 
			
				131
			 | 
			
			
				         ${PROJECT_NAME}-addcert -h exim --dhkey $DH_KEYLENGTH 
			 | 
		
	
		
			
			| 
				126
			 | 
			
				132
			 | 
			
			
				         check_certificates exim 
			 | 
		
	
		
			
			| 
				
			 | 
			
				133
			 | 
			
			
				+        cp /etc/ssl/certs/exim.dhparam /etc/exim4 
			 | 
		
	
		
			
			| 
				
			 | 
			
				134
			 | 
			
			
				+        chown root:Debian-exim /etc/exim4/exim.dhparam 
			 | 
		
	
		
			
			| 
				
			 | 
			
				135
			 | 
			
			
				+        chmod 640 /etc/exim4/exim.key /etc/exim4/exim.crt /etc/exim4/exim.dhparam 
			 | 
		
	
		
			
			| 
				127
			 | 
			
				136
			 | 
			
			
				     fi 
			 | 
		
	
		
			
			| 
				128
			 | 
			
				
			 | 
			
			
				-    cp /etc/ssl/private/exim.key /etc/exim4 
			 | 
		
	
		
			
			| 
				129
			 | 
			
				
			 | 
			
			
				-    cp /etc/ssl/certs/exim.crt /etc/exim4 
			 | 
		
	
		
			
			| 
				130
			 | 
			
				
			 | 
			
			
				-    cp /etc/ssl/certs/exim.dhparam /etc/exim4 
			 | 
		
	
		
			
			| 
				131
			 | 
			
				
			 | 
			
			
				-    chown root:Debian-exim /etc/exim4/exim.key /etc/exim4/exim.crt /etc/exim4/exim.dhparam 
			 | 
		
	
		
			
			| 
				132
			 | 
			
				
			 | 
			
			
				-    chmod 640 /etc/exim4/exim.key /etc/exim4/exim.crt /etc/exim4/exim.dhparam 
			 | 
		
	
		
			
			| 
				133
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				134
			 | 
			
				
			 | 
			
			
				-    sed -i '/login_saslauthd_server/,/.endif/ s/# *//' /etc/exim4/exim4.conf.template 
			 | 
		
	
		
			
			| 
				135
			 | 
			
				
			 | 
			
			
				-    if ! grep -q "MAIN_TLS_ENABLE = true" /etc/exim4/exim4.conf.template; then 
			 | 
		
	
		
			
			| 
				136
			 | 
			
				
			 | 
			
			
				-        sed -i "/.ifdef MAIN_HARDCODE_PRIMARY_HOSTNAME/i\MAIN_HARDCODE_PRIMARY_HOSTNAME =\nMAIN_TLS_ENABLE = true" /etc/exim4/exim4.conf.template 
			 | 
		
	
		
			
			| 
				137
			 | 
			
				
			 | 
			
			
				-    else 
			 | 
		
	
		
			
			| 
				138
			 | 
			
				
			 | 
			
			
				-        sed -i "s|MAIN_HARDCODE_PRIMARY_HOSTNAME =.*|MAIN_HARDCODE_PRIMARY_HOSTNAME =|g" /etc/exim4/exim4.conf.template 
			 | 
		
	
		
			
			| 
				
			 | 
			
				137
			 | 
			
			
				+    if ! grep -q 'MAIN_TLS_ENABLE = true' $tls_config_file; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				138
			 | 
			
			
				+        sed -i "/.ifdef MAIN_HARDCODE_PRIMARY_HOSTNAME/i\MAIN_HARDCODE_PRIMARY_HOSTNAME =\nMAIN_TLS_ENABLE = true" $tls_config_file 
			 | 
		
	
		
			
			| 
				
			 | 
			
				139
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				140
			 | 
			
			
				+    if ! grep -q "tls_on_connect_ports=465" $tls_config_file; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				141
			 | 
			
			
				+        sed -i '/SSL configuration for exim/i\tls_on_connect_ports=465' $tls_config_file 
			 | 
		
	
		
			
			| 
				139
			 | 
			
				142
			 | 
			
			
				     fi 
			 | 
		
	
		
			
			| 
				140
			 | 
			
				
			 | 
			
			
				-    sed -i "s|SMTPLISTENEROPTIONS=''|SMTPLISTENEROPTIONS='-oX 465:25:587 -oP /var/run/exim4/exim.pid'|g" /etc/default/exim4 
			 | 
		
	
		
			
			| 
				141
			 | 
			
				
			 | 
			
			
				-    if ! grep -q "tls_on_connect_ports=465" /etc/exim4/exim4.conf.template; then 
			 | 
		
	
		
			
			| 
				142
			 | 
			
				
			 | 
			
			
				-        sed -i '/SSL configuration for exim/i\tls_on_connect_ports=465' /etc/exim4/exim4.conf.template 
			 | 
		
	
		
			
			| 
				
			 | 
			
				143
			 | 
			
			
				+    if grep -q '# login_saslauthd_server' $tls_auth_config_file; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				144
			 | 
			
			
				+        sed -i '/login_saslauthd_server/,/.endif/ s/# *//' $tls_auth_config_file 
			 | 
		
	
		
			
			| 
				
			 | 
			
				145
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				146
			 | 
			
			
				+    if [ -f /etc/ssl/certs/${DEFAULT_DOMAIN_NAME}.pem ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				147
			 | 
			
			
				+        if ! grep -q "MAIN_TLS_CERTKEY = /etc/ssl/certs/${DEFAULT_DOMAIN_NAME}.pem" $tls_config_file; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				148
			 | 
			
			
				+            sed -i "/.ifdef MAIN_TLS_CERTKEY/i\MAIN_TLS_CERTKEY = /etc/ssl/certs/${DEFAULT_DOMAIN_NAME}.pem" $tls_config_file 
			 | 
		
	
		
			
			| 
				
			 | 
			
				149
			 | 
			
			
				+        fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				150
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				151
			 | 
			
			
				+    if [ -f /etc/ssl/private/${DEFAULT_DOMAIN_NAME}.key ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				152
			 | 
			
			
				+        if ! grep -q "MAIN_TLS_PRIVATEKEY = /etc/ssl/private/${DEFAULT_DOMAIN_NAME}.key" $tls_config_file; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				153
			 | 
			
			
				+            sed -i "/.ifdef MAIN_TLS_PRIVATEKEY/i\MAIN_TLS_PRIVATEKEY = /etc/ssl/private/${DEFAULT_DOMAIN_NAME}.key" $tls_config_file 
			 | 
		
	
		
			
			| 
				
			 | 
			
				154
			 | 
			
			
				+        fi 
			 | 
		
	
		
			
			| 
				143
			 | 
			
				155
			 | 
			
			
				     fi 
			 | 
		
	
		
			
			| 
				144
			 | 
			
				
			 | 
			
			
				-    if ! grep -q "# don't send system passwords" /etc/exim4/exim4.conf.template; then 
			 | 
		
	
		
			
			| 
				145
			 | 
			
				
			 | 
			
			
				-        sed -i "s|don't send system passwords.*|# don't send system passwords unencrypted|g" /etc/exim4/exim4.conf.template 
			 | 
		
	
		
			
			| 
				
			 | 
			
				156
			 | 
			
			
				+    if ! grep -q "SMTPLISTENEROPTIONS='-oX 465:25:587" /etc/default/exim4; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				157
			 | 
			
			
				+        sed -i "s|SMTPLISTENEROPTIONS=.*|SMTPLISTENEROPTIONS='-oX 465:25:587 -oP /var/run/exim4/exim.pid'|g" /etc/default/exim4 
			 | 
		
	
		
			
			| 
				146
			 | 
			
				158
			 | 
			
			
				     fi 
			 | 
		
	
		
			
			| 
				147
			 | 
			
				159
			 | 
			
			
				 } 
			 | 
		
	
		
			
			| 
				148
			 | 
			
				160
			 | 
			
			
				  
			 |