Howto iRedMail with SOGo Mysql authentication on Ubuntu 11.10 Oneiric Ocelot

 

1.) First install Ubuntu 11.10. You can download the Ubuntu Server on the officale website.

2.) Download and install the last version of iRedMail and choose Mysql backend store mail accounts.

3.) Add the Sogo repository /etc/apt/sources.list

deb http://inverse.ca/ubuntu oneiric oneiric

4.) Install SOGo

sudo apt-key adv --keyserver keys.gnupg.net --recv-key 0x810273C4
sudo apt-get update
sudo apt-get install sogo memcached zip

5.) Create the Mysql View for SOGo

mysql -u root -p
GRANT ALL PRIVILEGES ON vmail.* TO 'sogo'@'localhost' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION; exit

mysql -u sogo -p
use vmail;
create VIEW sogo_auth (c_uid, c_name, c_password, c_cn, mail, home) AS select  username, username, password, name, username, maildir from vmail.mailbox;
exit

6.) Configuration for SOGo:

sudo su sogo
defaults write sogod SOGoAuthenticationMethod SQL;
defaults write sogod SOGoUserSources '({canAuthenticate=YES;id=directory;isAddressBook=YES;type=sql;userPasswordAlgorithm=md5;viewURL="mysql://sogo:PASSWORD@localhost:3306/vmail/sogo_auth";})'
defaults write sogod OCSFolderInfoURL "mysql://sogo:PASSWORD@localhost:3306/vmail/sogo_folder_info"
defaults write sogod OCSSessionsFolderURL mysql://sogo:PASSWORD@localhost:3306/vmail/sogo_sessions_folder
defaults write sogod SOGoProfileURL "mysql://sogo:PASSWORD@localhost:3306/vmail/sogo_user_profile"
defaults write sogod OCSEMailAlarmsFolderURL mysql://sogo:PASSWORD@localhost:3306/vmail/sogo_alarms_folder
defaults write sogod SOGoTimeZone "Europe/Berlin"
defaults write sogod SOGoAppointmentSendEMailNotifications YES
defaults write sogod SOGoFoldersSendEMailNotifications YES
defaults write sogod SOGoACLsSendEMailNotifications YES
defaults write sogod SOGoMailingMechanism smtp
defaults write sogod SOGoSMTPServer 127.0.0.1
defaults write sogod SOGoMemcachedHost 127.0.0.1
defaults write sogod SOGoDraftsFolderName Drafts
defaults write sogod SOGoSentFolderName Sent
defaults write sogod SOGoTrashFolderName Trash
defaults write sogod SOGoIMAPServer localhost
defaults write sogod SOGoPasswordChangeEnabled YES
defaults write sogod SOGoSieveScriptsEnabled YES
defaults write sogod SOGoSieveServer sieve://127.0.0.1:4190
defaults write sogod WOPort 127.0.0.1:20000
defaults write sogod SOGoMemcachedHost 127.0.0.1
exit

Change userPasswordAlgorithm in /home/sogo/GNUstep/Defaults/.GNUstepDefaults

 <key>userPasswordAlgorithm</key>
 <string>md5-crypt</string>

7.) Activate the Apache modules

sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod rewrite
sudo a2enmod headers

 

8.) Modify the /etc/apache2/conf.d/SOGo.conf file.

RequestHeader set "x-webobjects-server-port" "443"
RequestHeader set "x-webobjects-server-name" "mail.example.com"
RequestHeader set "x-webobjects-server-url" "https://mail.example.com"

 

9.) Restart Apache2 and SOGo

sudo service apache2 restart
sudo service sogo restart

 

10.) Login on your server: https://yourserver/SOGo or https://yourserver/mail

Have fun