| 
					
				 | 
			
			
				@@ -42,6 +42,8 @@ if [[ -z "$(ls -A /app/data)" ]]; then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     $WP plugin install --activate --force /app/code/wp-mail-smtp.zip 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     mv /app/data/wp-content/plugins/wp-mail-smtp /app/data/wp-content/mu-plugins/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $WP plugin install --activate --force /app/code/authLdap.zip 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     # Update wordpress 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     $WP core update-db 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -59,6 +61,33 @@ $WP option update smtp_host ${MAIL_SMTP_SERVER} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 $WP option update smtp_port ${MAIL_SMTP_PORT} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 $WP option update smtp_auth false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+# configure LDAP 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+# https://github.com/heiglandreas/authLdap/blob/master/authLdap.php#L644 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ldapConfig=$(cat <<EOF 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+[ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    'Enabled'       => true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    'CachePW'       => false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    'URI'           => 'ldap://${LDAP_SERVER}:${LDAP_PORT}/${LDAP_USERS_BASE_DN}', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    'Filter'        => '(uid=%s)', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    'NameAttr'      => 'displayname', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    'SecName'       => '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    'UidAttr'       => '', // 'uid' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    'MailAttr'      => '', // 'mail' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    'WebAttr'       => '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    'Groups'        => array([ 'administrator' => 'cn=admins,${LDAP_GROUPS_BASE_DN}' ]), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    'Debug'         => false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    'GroupAttr'     => 'memberof', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    'GroupFilter'   => '(&(objectClass=user)(uid=%s))', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    'DefaultRole'   => 'editor', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    'GroupEnable'   => true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    'GroupOverUser' => true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    'Version'       => 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+EOF 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+authLDAPOptions=$(echo "${ldapConfig}" | php5 -r 'echo serialize(eval("return " . file_get_contents("php://stdin") . ";"));') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+$WP option update authLDAPOptions "${authLDAPOptions}" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 chown -R www-data:www-data /app/data 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 echo "Starting apache" 
			 |