hmm that's a good question, i have NEVER tried CentOS! SOGo needs to be build from source, unless RHEL 5 / 6 packages works for CentOS? well i have nothing better to do for the day so i will setup a VM and give it go.!
I have never installed SOGo on Centos, so I do not know if the RHEL 5/6 packages work. I have already installed Centos on a VM and will give the packages a try to see what happens! Update: the packages from RHEL 6 do install on Centos 6 (6.3 x64 to be precise). - Using the FAQ to setup an extra repo and excluding gnustep from the EPEL repo worked fine. A step in the right direction, but now for changing the script to support Centos... My testing server is a server which has ISPConfig installed, so I'm going futher in my testing.
nice let me know how it goes i'm new to CentOS so it will take some time before i have ispconfig running
try to install with Dovecot instead of courier, which I have installed.. I've got the script to work for the greater part (I guess): Code: yum install sogo sogo-tool #### remove the warning of tmpreaper echo "Removeing warning of tmpreaper" rpl 'SHOWWARNING=true' 'SHOWWARNING=false' /etc/tmpreaper.conf > /dev/null 2>&1 #### memcached not happy w. IPv6 echo "memcached not happy w. IPv6, settings to 127.0.0.1" rpl '127.0.0.1' localhost /etc/memcached.conf > /dev/null 2>&1 /etc/init.d/memcached restart > /dev/null 2>&1 echo -e "mysql admin user [root]: \c " read MYSQLADMUSER if [ -z "${MYSQLADMUSER}" ]; then MYSQLADMUSER="root" fi echo -e "mysql root password: \c " read MYSQLROOTPW echo -e "mysql host [127.0.0.1]: \c " read MYSQLHOST if [ -z "${MYSQLHOST}" ]; then MYSQLHOST="127.0.0.1" fi echo -e "mysql port [3306]: \c " read MYSQLPORT if [ -z "${MYSQLPORT}" ]; then MYSQLPORT="3306" fi echo -e "ISPCONFIG database name [dbispconfig]: \c " read ISPCONFIGDB if [ -z "${ISPCONFIGDB}" ]; then ISPCONFIGDB="dbispconfig" fi echo -e "SOGo database name [sogodb]: \c " read SOGODB if [ -z "${SOGODB}" ]; then SOGODB="sogodb" fi echo -e "ISPCONFIG install path [/usr/local/ispconfig]: \c " read ISPCONFIGINSTALLPATH if [ -z "${ISPCONFIGINSTALLPATH}" ]; then ISPCONFIGINSTALLPATH="/usr/local/ispconfig" fi echo -e "SOGO DB Username [sogosysuser]: \c " read SOGOUSERN if [ -z "${SOGOUSERN}" ]; then SOGOUSERN="sogosysuser" fi echo "SOGO DB Username Password" echo -e "leave empty for auto generation: \c " read SOGOUSERPW if [ -z "${SOGOUSERPW}" ]; then SOGOUSERPW=`< /dev/urandom tr -dc A-Za-z0-9_ | head -c25` fi mysql -u ${MYSQLADMUSER} -h ${MYSQLHOST} -p${MYSQLROOTPW} -e "CREATE DATABASE ${SOGODB};"; mysql -u ${MYSQLADMUSER} -h ${MYSQLHOST} -p${MYSQLROOTPW} -e "CREATE USER '${SOGOUSERN}'@'${MYSQLHOST}' IDENTIFIED BY '${SOGOUSERPW}';"; mysql -u ${MYSQLADMUSER} -h ${MYSQLHOST} -p${MYSQLROOTPW} -e "GRANT ALL PRIVILEGES ON \`${SOGODB}\`.* TO '${SOGOUSERN}'@'${MYSQLHOST}' WITH GRANT OPTION;"; mysql -u ${MYSQLADMUSER} -h ${MYSQLHOST} -p${MYSQLROOTPW} -e "GRANT SELECT ON \`${ISPCONFIGDB}\`.* TO '${SOGOUSERN}'@'${MYSQLHOST}';"; mysql -u ${MYSQLADMUSER} -h ${MYSQLHOST} -p${MYSQLROOTPW} -e "FLUSH PRIVILEGES;"; echo -e "Default IMAP Server Addr [localhost]: \c " read IMAPSERVER if [ -z "${IMAPSERVER}" ]; then IMAPSERVER="localhost" fi echo "Select IMAP user password algorithm" echo "plain|crypt|md5-crypt|md5|plain-md5" echo "Confirm with your imap server config || http://wiki.dovecot.org/Authentication/PasswordSchemes" echo -e "Use algorithm [crypt]: \c " read IMAPPWALGORITHM if [ -z "${IMAPPWALGORITHM}" ]; then IMAPPWALGORITHM="crypt" fi echo -e "Default SMTP Server Addr [localhost]: \c " read SMTPSERVER if [ -z "${SMTPSERVER}" ]; then SMTPSERVER="localhost" fi echo -e "Default SOGo Language [English]: \c " read SOGOLANGUAGE if [ -z "${SOGOLANGUAGE}" ]; then SOGOLANGUAGE="English" fi echo -e "Default SOGo TimeZone [Europe/Berlin]: \c " read SOGOTIMEZONE if [ -z "${SOGOTIMEZONE}" ]; then SOGOTIMEZONE="Europe/Berlin" fi SOGOBINARY=`which sogod` SOGOTOOLBINARY=`which sogo-tool` SOGOHOMEDIR=$(getent passwd sogo | cut -d: -f6) SOGOGNUSTEPCONFFILE=${SOGOHOMEDIR}/GNUstep/Defaults/.GNUstepDefaults SOGOZIPPATH=`which zip` #if [ "${OSTOCONF}" -eq "debian" ]; then ## hmm maby theres a diff on debian and ubuntu... #fi if [ -f /etc/init.d/sogo ]; then SOGOINITSCRIPT=/etc/init.d/sogo fi if [ -f /etc/init.d/sogod ]; then SOGOINITSCRIPT=/etc/init.d/sogod fi if ! id ispconfig 1> /dev/null 2>&1; then echo -e "can't find system user 'ispconfig' enter the name thank you: \c " read ISPCSYSTEMUSER else ISPCSYSTEMUSER="ispconfig" fi echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <!DOCTYPE plist PUBLIC \"-//GNUstep//DTD plist 0.9//EN\" \"http://www.gnustep.org/plist-0_9.xml\"> <plist version=\"0.9\"> <dict> <key>NSGlobalDomain</key> <dict></dict> <key>sogod</key> <dict> <key>SOGoPageTitle</key> <string>ISPConfig 3 w/SOGo</string> <key>SOGoLoginModule</key> <string>Mail</string> <key>SOGoZipPath</key> <string>${SOGOZIPPATH}</string> <key>SOGoSoftQuotaRatio</key> <string>0.9</string> <key>SOGoMailUseOutlookStyleReplies</key> <string>NO</string> <key>SOGoMailAuxiliaryUserAccountsEnabled</key> <string>NO</string> <key>SOGoMailCustomFromEnabled</key> <string>NO</string> <key>SOGoDefaultCalendar</key> <string>selected</string> <key>SOGoMailListViewColumnsOrder</key> <array> <string>Flagged</string> <string>Priority</string> <string>Date</string> <string>From</string> <string>Subject</string> <string>Attachment</string> <string>Unread</string> <string>Size</string> </array> <key>NGImap4ConnectionStringSeparator</key> <string>.</string> <key>SOGoEnableEMailAlarms</key> <string>YES</string> <key>OCSEMailAlarmsFolderURL</key> <string>mysql://${SOGOUSERN}:${SOGOUSERPW}@${MYSQLHOST}:${MYSQLPORT}/${SOGODB}/sogo_mailalarms_folder</string> <key>OCSFolderInfoURL</key> <string>mysql://${SOGOUSERN}:${SOGOUSERPW}@${MYSQLHOST}:${MYSQLPORT}/${SOGODB}/sogo_folder_info</string> <key>OCSSessionsFolderURL</key> <string>mysql://${SOGOUSERN}:${SOGOUSERPW}@${MYSQLHOST}:${MYSQLPORT}/${SOGODB}/sogo_sessions_folder</string> <key>SOGoProfileURL</key> <string>mysql://${SOGOUSERN}:${SOGOUSERPW}@${MYSQLHOST}:${MYSQLPORT}/${SOGODB}/sogo_user_profile</string> <key>SOGoACLsSendEMailNotifcations</key> <string>YES</string> <key>SOGoAppointmentSendEMailNotifcations</key> <string>YES</string> <key>SOGoAppointmentSendEMailReceipts</key> <string>YES</string> <key>SOGoAuthenticationMethod</key> <string>SQL</string> <key>SOGoCalendarDefaultRoles</key> <array> <string>PublicViewer</string> <string>ConfidentialDAndTViewer</string> </array> <key>SOGoContactsDefaultRoles</key> <array> <string>ObjectViewer</string> </array> <key>SOGoFirstDayOfWeek</key> <string>1</string> <key>SOGoFirstWeekOfYear</key> <string>FirstFullWeek</string> <key>SOGoFirtDayOfWeek</key> <string>1</string> <key>SOGoFoldersSendEMailNotifcations</key> <string>YES</string> <key>SOGoForceIMAPLoginWithEmail</key> <string>YES</string> <key>SOGoForwardEnabled</key> <string>NO</string> <key>SOGoIMAPAclConformsToIMAPExt</key> <string>Yes</string> <key>SOGoIMAPServer</key> <string>${IMAPSERVER}</string> <key>SOGoLanguage</key> <string>${SOGOLANGUAGE}</string> <key>SOGoMailMessageCheck</key> <string>every_minute</string> <key>SOGoMailReplyPlacement</key> <string>above</string> <key>SOGoMailingMechanism</key> <string>smtp</string> <key>SOGoPasswordChangeEnabled</key> <string>NO</string> <key>SOGoSMTPServer</key> <string>${SMTPSERVER}</string> <key>SOGoSieveScriptsEnabled</key> <string>NO</string> <key>SOGoSieveServer</key> <string>sieve://localhost:4190</string> <key>SOGoTimeZone</key> <string>${SOGOTIMEZONE}</string> <key>SOGoVacationEnabled</key> <string>NO</string> <key>SxVMemLimit</key> <string>512</string> <key>WOUseRelativeURLs</key> <string>YES</string> <key>WOWorkersCount</key> <string>1</string> <key>domains</key> <dict>{{SOGODOMAINSCONF}} </dict> </dict> </dict> </plist>" >${ISPCONFIGINSTALLPATH}/server/conf/sogo.conf-templ chown ${ISPCSYSTEMUSER}:${ISPCSYSTEMUSER} ${ISPCONFIGINSTALLPATH}/server/conf/sogo.conf-templ mkdir -p ${ISPCONFIGINSTALLPATH}/server/conf/sogo_domains cat > ${ISPCONFIGINSTALLPATH}/server/conf/sogo_domains/domains_default.conf << EOF <key>{{DOMAIN}}</key> <dict> <key>SOGoDraftsFolderName</key> <string>Drafts</string> <key>SOGoSentFolderName</key> <string>Sent</string> <key>SOGoTrashFolderName</key> <string>Trash</string> <key>SOGoMailShowSubscribedFoldersOnly</key> <string>NO</string> <key>SOGoLanguage</key> <string>English</string> <key>SOGoMailDomain</key> <string>{{DOMAIN}}</string> <key>SOGoSuperUsernames</key> <array> <string>{{DOMAINADMIN}}</string> </array> <key>SOGoUserSources</key> <array> <dict> <key>userPasswordAlgorithm</key> <string>${IMAPPWALGORITHM}</string> <key>prependPasswordScheme</key> <string>NO</string> <key>LoginFieldNames</key> <array> <string>c_uid</string> <string>mail</string> </array> <key>IMAPHostFieldName</key> <string>imap_host</string> <key>IMAPLoginFieldName</key> <string>c_uid</string> <key>type</key> <string>sql</string> <key>isAddressBook</key> <string>NO</string> <key>canAuthenticate</key> <string>YES</string> <key>displayName</key> <string>Users in {{DOMAIN}}</string> <key>hostname</key> <string>localhost</string> <key>id</key> <string>{{SOGOUNIQID}}</string> <key>viewURL</key> <string>{{CONNECTIONVIEWURL}}</string> </dict> </array> </dict> EOF cat > ${ISPCONFIGINSTALLPATH}/server/conf/sogo_domains/read_me << EOF for how to configure the config file and the format of the files see SOGo documentation the file names must be as follow (must end with .conf) they are not automaticly created you need to do this by hand. a template for domain example.com wil be named. example.com.conf domains_default.conf :: default for all domains.. EOF chown ${ISPCSYSTEMUSER}:${ISPCSYSTEMUSER} -R ${ISPCONFIGINSTALLPATH}/server/conf/sogo_domains cat > ${ISPCONFIGINSTALLPATH}/server/plugins-available/sogo_config_plugin.php << EOF <?php /* * Copyright (C) 2013 Christian M. Jensen * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * * NOTE* for more info, modifications etc.. contact me at http://www.howtoforge.com/ my user name: 'psykosen' */ class sogo_config_plugin { var \$plugin_name = 'sogo_config_plugin'; var \$class_name = 'sogo_config_plugin'; var \$sogo_su_cmd = "sudo -u sogo"; var \$sogopw = '${SOGOUSERPW}'; var \$sogouser = '${SOGOUSERN}'; var \$sogodb = '${SOGODB}'; var \$ispcdb = '${ISPCONFIGDB}'; var \$sogobinary = '${SOGOBINARY}'; var \$sogotoolbinary = '${SOGOTOOLBINARY}'; var \$sogohomedir = '${SOGOHOMEDIR}'; var \$sogoconffile = '${SOGOGNUSTEPCONFFILE}'; var \$sogoinitscript = '${SOGOINITSCRIPT}'; var \$templ_file = '${ISPCONFIGINSTALLPATH}/server/conf/sogo.conf-templ'; var \$templ_domains_dir = '${ISPCONFIGINSTALLPATH}/server/conf/sogo_domains'; var \$mysql_server_host = '${MYSQLHOST}:${MYSQLPORT}'; function onInstall() { global \$conf; if (\$conf['services']['mail'] == true) { return true; } else { return false; } } function onLoad() { global \$app; \$app->plugins->registerEvent('mail_domain_delete', \$this->plugin_name, 'reconfigure'); \$app->plugins->registerEvent('mail_domain_insert', \$this->plugin_name, 'reconfigure'); \$app->plugins->registerEvent('mail_domain_update', \$this->plugin_name, 'reconfigure'); \$app->plugins->registerEvent('mail_user_delete', \$this->plugin_name, 'remove_sogo_mail_user'); } function remove_sogo_mail_user(\$event_name, \$data) { global \$app, \$conf; if (\$event_name == 'mail_user_delete') { exec(\$this->sogo_su_cmd . ' ' . \$this->sogotoolbinary . ' remove ' . escapeshellarg(\$data['old']['login'])); sleep(1); } } function reconfigure(\$event_name, \$data) { global \$app, \$conf; \$flag = false; if (\$event_name == 'mail_domain_delete') { \$flag = \$this->remove_sogo_maildomain((isset(\$data['new']['domain']) ? \$data['new']['domain'] : \$data['old']['domain'])); } else if (\$event_name == 'mail_domain_insert') { \$flag = true; } else if (\$event_name == 'mail_domain_update') { \$flag = true; } else { //* i can\'t work with that give me a command... // /PATH/to/ISPConfig_DIR/server/SOGO-reconfigure.log // file_put_contents('SOGO-reconfigure.log', print_r(\$event_name,true)."\n\n".print_r(\$data,true)); } if (\$flag) { \$active_mail_domains = \$app->db->queryAllRecords('SELECT \`domain\` FROM \`mail_domain\` WHERE \`active\`=\'y\''); \$sogo_conf = file_get_contents(\$this->templ_file); \$tmp_conf = ""; foreach (\$active_mail_domains as \$vd) { \$tmp_conf .= \$this->build_conf_sogo_maildomain(\$vd['domain']); //* create if not exist \$this->create_sogo_view(\$vd['domain']); } \$sogo_conf = str_replace('{{SOGODOMAINSCONF}}', \$tmp_conf, \$sogo_conf); if (!file_put_contents(\$this->sogoconffile, \$sogo_conf)) { \$app->log('ERROR. unable to reconfigure SOGo..', LOGLEVEL_ERROR); return; } else { exec(\$this->sogoinitscript . ' restart'); //** make the system wait.. sleep(2); } } } function remove_sogo_maildomain(\$dom) { global \$app, \$conf; //* TODO: validate domain the correct way not by filter_var if (empty(\$dom) || filter_var('http://' . \$dom, FILTER_VALIDATE_URL) === false) { \$app->log('ERROR. removeing sogo mail domain.. domain invalid [' . \$dom . ']', LOGLEVEL_ERROR); return false; } \$dom_no_point = str_replace('-', '_', str_replace('.', '_', \$dom)); \$sqlres = \$this->_sqlConnect(); \$sqlres->query('DROP VIEW \`sogo_users_' . \$dom_no_point . '\`'); /* Broke my connection??? */ /* @\$sqlres->close(); */ return true; } function create_sogo_view(\$dom) { global \$app, \$conf; \$sqlres = \$this->_sqlConnect(); \$dom_no_point = str_replace('-', '_', str_replace('.', '_', \$dom)); \$sql1 = "SELECT \`TABLE_NAME\` FROM \`information_schema\`.\`VIEWS\` WHERE \`TABLE_SCHEMA\`='{\$this->sogodb}' AND \`TABLE_NAME\`='sogo_users_" . \$dom_no_point . "'"; \$tmp = \$sqlres->query(\$sql1); while (\$obj = \$tmp->fetch_object()) { if (\$obj->TABLE_NAME == 'sogo_users_' . \$dom_no_point) { return true; } } \$sqlres->query('CREATE VIEW sogo_users_' . \$dom_no_point . ' AS SELECT \`login\` AS c_uid, \`login\` AS c_name, \`password\` AS c_password, \`name\` AS c_cn, \`email\` AS mail, (SELECT \`server_name\` FROM ' . \$this->ispcdb . '.\`server\`, ' . \$this->ispcdb . '.\`mail_user\` WHERE \`mail_user\`.\`server_id\`=\`server\`.\`server_id\` AND \`server\`.\`mail_server\`=1 AND ispcmu.\`login\`=\`mail_user\`.\`login\` LIMIT 1) AS imap_host FROM ' . \$this->ispcdb . '.\`mail_user\` AS ispcmu WHERE \`email\` LIKE \'%@' . \$dom_no_point . '\' AND disableimap=\'n\''); if (!empty(\$sqlres->error)) \$app->log('ERROR. unable to create SOGo view[sogo_users_' . \$dom_no_point . '].. ' . \$sqlres->error, LOGLEVEL_ERROR); /* Broke my connection??? */ /* @\$sqlres->close(); */ return true; } function build_conf_sogo_maildomain(\$dom) { global \$app, \$conf; \$dom_no_point = str_replace('-', '_', str_replace('.', '_', \$dom)); /* For mail aliases.. <key>MailFieldNames</key> <array> <string>Col1</string> <string>Col2</string> <string>Col3</string> </array> */ \$sogo_conf = ""; \$sogo_conf_vars = array( '{{DOMAIN}}' => \$dom, '{{DOMAINADMIN}}' => 'postmaster@' . \$dom, '{{SOGOUNIQID}}' => \$dom_no_point, '{{CONNECTIONVIEWURL}}'=>"mysql://{\$this->sogouser}:{\$this->sogopw}@{\$this->mysql_server_host}/{\$this->sogodb}/sogo_users_{\$dom_no_point}" ); if (file_exists("{\$this->templ_domains_dir}/{\$dom_no_point}.conf")) { \$sogo_conf = file_get_contents("{\$this->templ_domains_dir}/{\$dom}.conf"); } else { if (!file_exists("{\$this->templ_domains_dir}/{\$dom_no_point}.conf")) \$app->log('ERROR. loading domains config.. file: '."{\$this->templ_domains_dir}/{\$dom_no_point}.conf", LOGLEVEL_DEBUG); if (file_exists("{\$this->templ_domains_dir}/domains_default.conf")) { \$sogo_conf = file_get_contents("{\$this->templ_domains_dir}/domains_default.conf"); } else { \$app->log('ERROR. loading domain config.. file: ' . "{\$this->templ_domains_dir}/domains_default.conf", LOGLEVEL_ERROR); return; } } if (!empty(\$sogo_conf)) { foreach (\$sogo_conf_vars as \$key => \$value) { \$sogo_conf = preg_replace("/{\$key}/i", \$value, \$sogo_conf); } } return \$sogo_conf; } function _sqlConnect() { \$_sqlserver = explode(':', \$this->mysql_server_host); \$sqlres = new mysqli(\$_sqlserver[0], \$this->sogouser, \$this->sogopw, \$this->sogodb, \$_sqlserver[1]); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } return \$sqlres; } } ?> EOF chown ${ISPCSYSTEMUSER}:${ISPCSYSTEMUSER} ${ISPCONFIGINSTALLPATH}/server/plugins-available/sogo_config_plugin.php ### /usr/local/ispconfig/server/plugins-available/sogo_config_plugin.php ## configure sogo before restarting sogo service.. # enable the plugin.. ln -s ${ISPCONFIGINSTALLPATH}/server/plugins-available/sogo_config_plugin.php ${ISPCONFIGINSTALLPATH}/server/plugins-enabled/sogo_config_plugin.inc.php echo "Allmost there wee just need to configure the vhost" echo "." echo -e "SOGo Domain vhost to configure [`hostname --fqdn`]: \c " read SOGOVHOSTNAME if [ -z "${SOGOVHOSTNAME}" ]; then SOGOVHOSTNAME=`hostname --fqdn` fi echo -e "HTTP Protocol [http]: \c " read SOGOPROTOCAL if [ -z "${SOGOPROTOCAL}" ]; then SOGOPROTOCAL="http" fi echo -e "HTTP Port: [80]: \c " read SOGOHTTPPORT if [ -z "${SOGOHTTPPORT}" ]; then SOGOHTTPPORT="80" fi echo " <VirtualHost *:${SOGOHTTPPORT}> Servername ${SOGOVHOSTNAME}:${SOGOHTTPPORT} DocumentRoot /usr/lib64/GNUstep/SOGo/WebServerResources/ ## ErrorLog /var/log/httpd/sogo-error.log ## Customlog /var/log/httpd/sogo-access.log combined ServerSignature Off Alias /SOGo.woa/WebServerResources/ \ /usr/lib64/GNUstep/SOGo/WebServerResources/ Alias /SOGo/WebServerResources/ \ /usr/lib64/GNUstep/SOGo/WebServerResources/ AliasMatch /SOGo/so/ControlPanel/Products/(.*)/Resources/(.*) \ /usr/lib64/GNUstep/SOGo/\$1.SOGo/Resources/\$2 <Directory /usr/lib64/GNUstep/SOGo/> AllowOverride None Order deny,allow Allow from all # Explicitly allow caching of static content to avoid browser specific behavior. # A resource's URL MUST change in order to have the client load the new version. <IfModule expires_module> ExpiresActive On ExpiresDefault \"access plus 1 year\" </IfModule> </Directory> <LocationMatch \"^/SOGo/so/ControlPanel/Products/.*UI/Resources/.*\.(jpg|png|gif|css|js)\"> SetHandler default-handler </LocationMatch> ## Uncomment the following to enable proxy-side authentication, you will then ## need to set the \"SOGoTrustProxyAuthentication\" SOGo user default to YES and ## adjust the \"x-webobjects-remote-user\" proxy header in the \"Proxy\" section ## below. #<Location /SOGo> # AuthType XXX # Require valid-user # SetEnv proxy-nokeepalive 1 # Allow from all #</Location> ProxyRequests Off SetEnv proxy-nokeepalive 1 ProxyPreserveHost On # When using CAS, you should uncomment this and install cas-proxy-validate.py # in /usr/lib/cgi-bin to reduce server overloading # # ProxyPass /SOGo/casProxy http://localhost/cgi-bin/cas-proxy-validate.py # <Proxy http://localhost/app/cas-proxy-validate.py> # Order deny,allow # Allow from your-cas-host-addr # </Proxy> ProxyPass /SOGo http://127.0.0.1:20000/SOGo retry=0 <Proxy http://127.0.0.1:20000/SOGo> ## adjust the following to your configuration RequestHeader set \"x-webobjects-server-port\" \"${SOGOHTTPPORT}\" RequestHeader set \"x-webobjects-server-name\" \"${SOGOVHOSTNAME}\" RequestHeader set \"x-webobjects-server-url\" \"${SOGOPROTOCAL}://${SOGOVHOSTNAME}:${SOGOHTTPPORT}\" ## When using proxy-side autentication, you need to uncomment and ## adjust the following line: # RequestHeader set \"x-webobjects-remote-user\" \"%{REMOTE_USER}e\" RequestHeader set \"x-webobjects-server-protocol\" \"HTTP/1.0\" RequestHeader set \"x-webobjects-remote-host\" %{REMOTE_HOST}e env=REMOTE_HOST AddDefaultCharset UTF-8 Order allow,deny Allow from all </Proxy> ## We use mod_rewrite to pass remote address to the SOGo proxy. # The remote address will appear in SOGo's log files and in the X-Forward # header of emails. RewriteEngine On RewriteRule ^/SOGo/(.*)\$ /SOGo/\$1 [env=REMOTE_HOST:%{REMOTE_ADDR},PT] Redirect permanent /index.html ${SOGOPROTOCAL}://${SOGOVHOSTNAME}:${SOGOHTTPPORT}/SOGo </virtualhost> "> /etc/httpd/conf.d/SOGo.conf ## final restart services /etc/init.d/sogod restart a2enmod proxy proxy_http headers rewrite /etc/init.d/httpd restart clear echo -e "------------ SOGo Installed ------------" echo -e "${SOGOPROTOCAL}://${SOGOVHOSTNAME}:${SOGOHTTPPORT}/SOGo" echo -e "VHOST Conf:\t\t/etc/httpd/conf.d/SOGo.conf" echo -e "" echo -e "ISPC Plugin:\t\t${ISPCONFIGINSTALLPATH}/server/plugins-available/sogo_config_plugin.php" echo -e "ISPC Template:\t\t${ISPCONFIGINSTALLPATH}/server/conf/sogo.conf-templ" echo -e "SOGo Domain Templates:\t\t${ISPCONFIGINSTALLPATH}/server/conf/sogo_domains/" echo -e "SOGo Bin:\t\t${SOGOBINARY}" echo -e "SOGo-Tool Bin:\t\t${SOGOTOOLBINARY}" echo -e "SOGo Home:\t\t${SOGOHOMEDIR}" echo -e "SOGo Config:\t\t${SOGOGNUSTEPCONFFILE}" echo -e "SOGo Init:\t\t${SOGOINITSCRIPT}" echo -e "DB Name:\t\t${SOGODB}" echo -e "DB User:\t\t${SOGOUSERN}" echo -e "DB Psswd:\t\t${SOGOUSERPW}" echo -e "" echo -e "Adminitrator is [email protected]" echo -e "if postmaster mail addr is not added go add it and login to SOGo to start administrat the domain" echo -e "Enable SOGo logins by update/delete or add a mail domain" echo -e "----------------------------------------" exit 0; And the only errors I got: Code: which: no sogo-tool in (/usr/lib64/qt-3.3/bin:/usr/lib/courier-imap/sbin:/usr/lib/courier-imap/bin:/root/GNUstep/Tools:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin) Allmost there wee just need to configure the vhost . SOGo Domain vhost to configure [webserver02.hma.local]: HTTP Protocol [http]: HTTP Port: [80]: sogo_config.sh: line 604: /etc/init.d/sogo: No such file or directory sogo_config.sh: line 605: a2enmod: command not found Stopping httpd: [ OK ] Starting httpd: Warning: DocumentRoot [/usr/lib/GNUstep/SOGo/WebServerResources/] does not exist [ OK ] ------------ SOGo Installed ------------ http://webserver02.hma.local:80/SOGo VHOST Conf: /etc/httpd/conf.d/SOGo.conf ISPC Plugin: /usr/local/ispconfig/server/plugins-available/sogo_config_plugin.php ISPC Template: /usr/local/ispconfig/server/conf/sogo.conf-templ SOGo Domain Templates: /usr/local/ispconfig/server/conf/sogo_domains/ SOGo Bin: /usr/sbin/sogod SOGo-Tool Bin: SOGo Home: /var/lib/sogo SOGo Config: /var/lib/sogo/GNUstep/Defaults/.GNUstepDefaults SOGo Init: /etc/init.d/sogod DB Name: sogodb DB User: sogosysuser DB Psswd: changethispassword Adminitrator is [email protected] if postmaster mail addr is not added go add it and login to SOGo to start administrat the domain Enable SOGo logins by update/delete or add a mail domain Update I only installed sogo, which is not enough. You will also have to install sogo-tool. after adding the sogo repo (see the FAQ on their site and do change the EPEL repo exlude=gnustep-*) yum install sogo sogo-tool yum install openchange give me an error. It depends on Samba4 and Samba4 conflicts with samba3. And the http://server:80/SOGo website is telling me: Code: Service Temporarily Unavailable The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later. Update 2 Edited the script. The script now installs sogo and sogo-tool. But you would still have to setup the repos first and do that manually. But I think the script is sort of working! I've got a 64-bit server so I had to change /usr/lib/GNUSTEP to /usr/lib64/GNUstep. and the last restart was /etc/init.d/sogo but that has to be /etc/init.d/sogod And now for the BEST part.. It's showing me a login screen!! So far so good.. Now for getting the courier to work instead of dovecot...
thats the vhosts config set up for debian based distros, and the sogo home dir is not in the same place as fare as i can see the DocumentRoot in the vhosts is wrong.. nice your quick
All logins fail on username and password. Is there any logging made? (And I still have to change the courier part.... )
at the top of the plugin [/usr/local/ispconfig/server/plugins-available/sogo_config_plugin.php] do you have any empty vars var \$sogo_su_cmd = "sudo -u sogo"; << -- does this WORK!! the logs are (on debian) /var/log/sogo/sogo.log and the plugin reposts to: /var/log/ispconfig/cron.log
You're right.. sudo -u sogo doesn't work. And there are no empty vars in that file. I did change the rights of the file chmod 750 /usr/local/ispconfig/server/plugins-available/sogo_config_plugin.php because I am logged in as root (easy for testing purposes) I didn't check the sudo thing. sudo is installed but sudo -u sogo doesn't work .. Guess we will have to change the adduser part of the script? Update: The sogo logfile (last part, just after I restarted sogo) Code: Mar 20 11:30:28 sogod [22794]: version 2.0.4b (build root@shiva 201302041539) -- starting Mar 20 11:30:28 sogod [22794]: vmem size check enabled: shutting down app when vmem > 384 MB Mar 20 11:30:28 sogod [22794]: <0x0x7fc71d7e6b28[SOGoProductLoader]> SOGo products loaded from '/usr/lib64/GNUstep/SOGo': Mar 20 11:30:28 sogod [22794]: <0x0x7fc71d7e6b28[SOGoProductLoader]> ContactsUI.SOGo, PreferencesUI.SOGo, Contacts.SOGo, SchedulerUI.SOGo, Appointments.SOGo, CommonUI.SOGo, Mailer.SOGo, MailPartViewers.SOGo, MainUI.SOGo, AdministrationUI.SOGo, MailerUI.SOGo Mar 20 11:30:36 sogod [22794]: <0x0x7fc71d6e1ff8[WOWatchDog]> listening on *:20000 Mar 20 11:30:36 sogod [22794]: <0x0x7fc71d6e1ff8[WOWatchDog]> watchdog process pid: 22794 Mar 20 11:30:36 sogod [22794]: <0x0x7fc71a42a3a0[WOWatchDogChild]> watchdog request timeout set to 10 minutes Mar 20 11:30:36 sogod [22794]: <0x0x7fc71d6e1ff8[WOWatchDog]> preparing 1 children Mar 20 11:30:36 sogod [22794]: <0x0x7fc71d6e1ff8[WOWatchDog]> child spawned with pid 22804 2013-03-20 11:30:36.945 sogod[22804] No value specified for 'SOGoProfileURL'
And from the sogo log file comes a very clear warning/error: Code: Mar 20 11:30:36 sogod [22794]: <0x0x7fc71a42a3a0[WOWatchDogChild]> watchdog request timeout set to 10 minutes Mar 20 11:30:36 sogod [22794]: <0x0x7fc71d6e1ff8[WOWatchDog]> preparing 1 children Mar 20 11:30:36 sogod [22794]: <0x0x7fc71d6e1ff8[WOWatchDog]> child spawned with pid 22804 2013-03-20 11:30:36.945 sogod[22804] No value specified for 'SOGoProfileURL' Mar 20 11:33:06 sogod [22804]: <0x0x7fc71d8f1ca8[SOGoCache]> Cache cleanup interval set every 300.000000 seconds Mar 20 11:33:06 sogod [22804]: <0x0x7fc71d8f1ca8[SOGoCache]> Using host(s) 'localhost' as server(s) 2013-03-20 11:33:06.863 sogod[22804] Note(SoObject): SoDebugKeyLookup is enabled! 2013-03-20 11:33:06.863 sogod[22804] Note(SoObject): SoDebugBaseURL is enabled! 2013-03-20 11:33:06.864 sogod[22804] Note(SoObject): relative base URLs are enabled. 2013-03-20 11:33:14.970 sogod[22804] WOCompoundElement: pool embedding is on. 2013-03-20 11:33:14.971 sogod[22804] WOCompoundElement: id logging is on. [B]Mar 20 11:33:14 sogod [22804]: [ERROR] <0x0x7fc71db92b88[SOGoUserManager]> No authentication sources defined - nobody will be able to login. Check your defaults.[/B] Mar 20 11:33:14 sogod [22804]: [ERROR] <0x0x7fc71db2d3f8[SOGoSQLUserProfile]> failed to acquire channel for URL: (null) Mar 20 11:33:14 sogod [22804]: [ERROR] <0x0x7fc71db2d3f8[SOGoSQLUserProfile]> failed to acquire channel for URL: (null) Mar 20 11:33:14 sogod [22804]: [ERROR] <0x0x7fc71db2d3f8[SOGoSQLUserProfile]> failed to acquire channel for URL: (null) Mar 20 11:33:14 sogod [22804]: [ERROR] <0x0x7fc71db2d3f8[SOGoSQLUserProfile]> failed to acquire channel for URL: (null) I'm stuck on this error. I don't know to much about sogo... And I have to correct, sudo -u sogo DOES work. I nevertheless created the sogo group and ran the script again. It reconfigured SOGo and well.. nothing changed. The above error still displays and I can't login. Could you assist me again ? That would be the courier part and password hasing? I left all default... But what hashing should I use?
first thing is to check if the SOGo Database contains !ANY! views for the configuration to work. next is to ensure that the SOGo configuration file [SOGO-HOME-DIR/GNUstep/Defaults/.GNUstepDefaults] contains a configuration (if not) have you added a dummy mail domain to ISPConfig, since the plug in only creates the configuration if a mail domain is added/deleted or updated..! it's not automatically done Update my script it work but the vhost need to be updated for 64 bit like "lucaspr" pointed out. also it don't install memchached thats just a quick failure other than that it seems to work Code: OSTOCONF='centos' echo -e "CentOS Base release (5/6) [6]: \c " read OSBASERELEASE if [ -z "${OSBASERELEASE}" ]; then OSBASERELEASE="6" fi OSREPOADDED="" if [ "${OSBASERELEASE}" == "6" ]; then echo "Adding SOGo Mirrors to repos [/etc/yum.repos.d/SOGo.repo]" cat >> /etc/yum.repos.d/SOGo.repo << EOF [sogo-Centos6] name=Inverse SOGo Repository baseurl=http://inverse.ca/downloads/SOGo/RHEL6/\$basearch enabled=1 gpgcheck=0 EOF OSREPOADDED="1" elif [ "${OSBASERELEASE}" == "5" ]; then echo "Adding SOGo Mirrors to repos [/etc/yum.repos.d/SOGo.repo]" cat >> /etc/yum.repos.d/SOGo.repo << EOF [sogo-Centos5] name=Inverse SOGo Repository baseurl=http://inverse.ca/downloads/SOGo/CentOS5/\$basearch enabled=1 gpgcheck=0 EOF OSREPOADDED="1" else echo "Sorry unable to add repo for CentOS ${OSBASERELEASE}, valid versions are 5 or 6" exit 1 fi echo -e "epel.repo file [/etc/yum.repos.d/epel.repo]: \c " read EPELREPOFILE if [ -z "${EPELREPOFILE}" ]; then EPELREPOFILE="/etc/yum.repos.d/epel.repo" fi cp ${EPELREPOFILE} ${EPELREPOFILE}.bak echo "Adding exclude=gnustep-* to '[epel]'" sed -i '/\[epel\]/ a\ exclude=gnustep-*' ${EPELREPOFILE} echo "Updateing REPOs" yum -y update echo "Installing SOGo & SOGo-Tool" yum -y install sogo sogo-tool sope49-gdl1-mysql sope49-xml echo -e "mysql admin user [root]: \c " read MYSQLADMUSER if [ -z "${MYSQLADMUSER}" ]; then MYSQLADMUSER="root" fi echo -e "mysql root password: \c " read MYSQLROOTPW echo -e "mysql host [127.0.0.1]: \c " read MYSQLHOST if [ -z "${MYSQLHOST}" ]; then MYSQLHOST="127.0.0.1" fi echo -e "mysql port [3306]: \c " read MYSQLPORT if [ -z "${MYSQLPORT}" ]; then MYSQLPORT="3306" fi echo -e "ISPCONFIG database name [dbispconfig]: \c " read ISPCONFIGDB if [ -z "${ISPCONFIGDB}" ]; then ISPCONFIGDB="dbispconfig" fi echo -e "SOGo database name [sogodb]: \c " read SOGODB if [ -z "${SOGODB}" ]; then SOGODB="sogodb" fi echo -e "ISPCONFIG install path [/usr/local/ispconfig]: \c " read ISPCONFIGINSTALLPATH if [ -z "${ISPCONFIGINSTALLPATH}" ]; then ISPCONFIGINSTALLPATH="/usr/local/ispconfig" fi echo -e "SOGO DB Username [sogosysuser]: \c " read SOGOUSERN if [ -z "${SOGOUSERN}" ]; then SOGOUSERN="sogosysuser" fi echo "SOGO DB Username Password" echo -e "leave empty for auto generation: \c " read SOGOUSERPW if [ -z "${SOGOUSERPW}" ]; then SOGOUSERPW=`< /dev/urandom tr -dc A-Za-z0-9_ | head -c25` fi mysql -u ${MYSQLADMUSER} -h ${MYSQLHOST} -p${MYSQLROOTPW} -e "CREATE DATABASE ${SOGODB};"; mysql -u ${MYSQLADMUSER} -h ${MYSQLHOST} -p${MYSQLROOTPW} -e "CREATE USER '${SOGOUSERN}'@'${MYSQLHOST}' IDENTIFIED BY '${SOGOUSERPW}';"; mysql -u ${MYSQLADMUSER} -h ${MYSQLHOST} -p${MYSQLROOTPW} -e "GRANT ALL PRIVILEGES ON \`${SOGODB}\`.* TO '${SOGOUSERN}'@'${MYSQLHOST}' WITH GRANT OPTION;"; mysql -u ${MYSQLADMUSER} -h ${MYSQLHOST} -p${MYSQLROOTPW} -e "GRANT SELECT ON \`${ISPCONFIGDB}\`.* TO '${SOGOUSERN}'@'${MYSQLHOST}';"; mysql -u ${MYSQLADMUSER} -h ${MYSQLHOST} -p${MYSQLROOTPW} -e "FLUSH PRIVILEGES;"; echo -e "Default IMAP Server Addr [localhost]: \c " read IMAPSERVER if [ -z "${IMAPSERVER}" ]; then IMAPSERVER="localhost" fi echo "Select IMAP user password algorithm" echo "plain|crypt|md5-crypt|md5|plain-md5" echo "Confirm with your imap server config || http://wiki.dovecot.org/Authentication/PasswordSchemes" echo -e "Use algorithm [crypt]: \c " read IMAPPWALGORITHM if [ -z "${IMAPPWALGORITHM}" ]; then IMAPPWALGORITHM="crypt" fi echo -e "Default SMTP Server Addr [localhost]: \c " read SMTPSERVER if [ -z "${SMTPSERVER}" ]; then SMTPSERVER="localhost" fi echo -e "Default SOGo Language [English]: \c " read SOGOLANGUAGE if [ -z "${SOGOLANGUAGE}" ]; then SOGOLANGUAGE="English" fi echo -e "Default SOGo TimeZone [Europe/Berlin]: \c " read SOGOTIMEZONE if [ -z "${SOGOTIMEZONE}" ]; then SOGOTIMEZONE="Europe/Berlin" fi SOGOBINARY=`which sogod` SOGOTOOLBINARY=`which sogo-tool` SOGOHOMEDIR=$(getent passwd sogo | cut -d: -f6) SOGOGNUSTEPCONFFILE=${SOGOHOMEDIR}/GNUstep/Defaults/.GNUstepDefaults SOGOZIPPATH=`which zip` #if [ "${OSTOCONF}" -eq "debian" ]; then ## hmm maby theres a diff on debian and ubuntu... #fi if [ -f /etc/init.d/sogo ]; then SOGOINITSCRIPT=/etc/init.d/sogo elif [ -f /etc/init.d/sogod ]; then SOGOINITSCRIPT=/etc/init.d/sogod fi if [ -z "${SOGOINITSCRIPT}" ]; then echo -e "SOGo INIT script where not found where id it: \c" read SOGOTIMEZONE fi if ! id ispconfig 1> /dev/null 2>&1; then echo -e "can't find system user 'ispconfig' enter the name thank you: \c " read ISPCSYSTEMUSER else ISPCSYSTEMUSER="ispconfig" fi echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <!DOCTYPE plist PUBLIC \"-//GNUstep//DTD plist 0.9//EN\" \"http://www.gnustep.org/plist-0_9.xml\"> <plist version=\"0.9\"> <dict> <key>NSGlobalDomain</key> <dict></dict> <key>sogod</key> <dict> <key>SOGoPageTitle</key> <string>ISPConfig 3 w/SOGo</string> <key>SOGoLoginModule</key> <string>Mail</string> <key>SOGoZipPath</key> <string>${SOGOZIPPATH}</string> <key>SOGoSoftQuotaRatio</key> <string>0.9</string> <key>SOGoMailUseOutlookStyleReplies</key> <string>NO</string> <key>SOGoMailAuxiliaryUserAccountsEnabled</key> <string>NO</string> <key>SOGoMailCustomFromEnabled</key> <string>NO</string> <key>SOGoDefaultCalendar</key> <string>selected</string> <key>SOGoMailListViewColumnsOrder</key> <array> <string>Flagged</string> <string>Priority</string> <string>Date</string> <string>From</string> <string>Subject</string> <string>Attachment</string> <string>Unread</string> <string>Size</string> </array> <key>NGImap4ConnectionStringSeparator</key> <string>.</string> <key>SOGoEnableEMailAlarms</key> <string>YES</string> <key>OCSEMailAlarmsFolderURL</key> <string>mysql://${SOGOUSERN}:${SOGOUSERPW}@${MYSQLHOST}:${MYSQLPORT}/${SOGODB}/sogo_mailalarms_folder</string> <key>OCSFolderInfoURL</key> <string>mysql://${SOGOUSERN}:${SOGOUSERPW}@${MYSQLHOST}:${MYSQLPORT}/${SOGODB}/sogo_folder_info</string> <key>OCSSessionsFolderURL</key> <string>mysql://${SOGOUSERN}:${SOGOUSERPW}@${MYSQLHOST}:${MYSQLPORT}/${SOGODB}/sogo_sessions_folder</string> <key>SOGoProfileURL</key> <string>mysql://${SOGOUSERN}:${SOGOUSERPW}@${MYSQLHOST}:${MYSQLPORT}/${SOGODB}/sogo_user_profile</string> <key>SOGoACLsSendEMailNotifcations</key> <string>YES</string> <key>SOGoAppointmentSendEMailNotifcations</key> <string>YES</string> <key>SOGoAppointmentSendEMailReceipts</key> <string>YES</string> <key>SOGoAuthenticationMethod</key> <string>SQL</string> <key>SOGoCalendarDefaultRoles</key> <array> <string>PublicViewer</string> <string>ConfidentialDAndTViewer</string> </array> <key>SOGoContactsDefaultRoles</key> <array> <string>ObjectViewer</string> </array> <key>SOGoFirstDayOfWeek</key> <string>1</string> <key>SOGoFirstWeekOfYear</key> <string>FirstFullWeek</string> <key>SOGoFirtDayOfWeek</key> <string>1</string> <key>SOGoFoldersSendEMailNotifcations</key> <string>YES</string> <key>SOGoForceIMAPLoginWithEmail</key> <string>YES</string> <key>SOGoForwardEnabled</key> <string>NO</string> <key>SOGoIMAPAclConformsToIMAPExt</key> <string>Yes</string> <key>SOGoIMAPServer</key> <string>${IMAPSERVER}</string> <key>SOGoLanguage</key> <string>${SOGOLANGUAGE}</string> <key>SOGoMailMessageCheck</key> <string>every_minute</string> <key>SOGoMailReplyPlacement</key> <string>above</string> <key>SOGoMailingMechanism</key> <string>smtp</string> <key>SOGoPasswordChangeEnabled</key> <string>NO</string> <key>SOGoSMTPServer</key> <string>${SMTPSERVER}</string> <key>SOGoSieveScriptsEnabled</key> <string>NO</string> <key>SOGoSieveServer</key> <string>sieve://localhost:4190</string> <key>SOGoTimeZone</key> <string>${SOGOTIMEZONE}</string> <key>SOGoVacationEnabled</key> <string>NO</string> <key>SxVMemLimit</key> <string>512</string> <key>WOUseRelativeURLs</key> <string>YES</string> <key>WOWorkersCount</key> <string>1</string> <key>domains</key> <dict>{{SOGODOMAINSCONF}} </dict> </dict> </dict> </plist>" >${ISPCONFIGINSTALLPATH}/server/conf/sogo.conf-templ chown ${ISPCSYSTEMUSER}:${ISPCSYSTEMUSER} ${ISPCONFIGINSTALLPATH}/server/conf/sogo.conf-templ mkdir -p ${ISPCONFIGINSTALLPATH}/server/conf/sogo_domains cat > ${ISPCONFIGINSTALLPATH}/server/conf/sogo_domains/domains_default.conf << EOF <key>{{DOMAIN}}</key> <dict> <key>SOGoDraftsFolderName</key> <string>Drafts</string> <key>SOGoSentFolderName</key> <string>Sent</string> <key>SOGoTrashFolderName</key> <string>Trash</string> <key>SOGoMailShowSubscribedFoldersOnly</key> <string>NO</string> <key>SOGoLanguage</key> <string>English</string> <key>SOGoMailDomain</key> <string>{{DOMAIN}}</string> <key>SOGoSuperUsernames</key> <array> <string>{{DOMAINADMIN}}</string> </array> <key>SOGoUserSources</key> <array> <dict> <key>userPasswordAlgorithm</key> <string>${IMAPPWALGORITHM}</string> <key>prependPasswordScheme</key> <string>NO</string> <key>LoginFieldNames</key> <array> <string>c_uid</string> <string>mail</string> </array> <key>IMAPHostFieldName</key> <string>imap_host</string> <key>IMAPLoginFieldName</key> <string>c_uid</string> <key>type</key> <string>sql</string> <key>isAddressBook</key> <string>NO</string> <key>canAuthenticate</key> <string>YES</string> <key>displayName</key> <string>Users in {{DOMAIN}}</string> <key>hostname</key> <string>localhost</string> <key>id</key> <string>{{SOGOUNIQID}}</string> <key>viewURL</key> <string>{{CONNECTIONVIEWURL}}</string> </dict> </array> </dict> EOF cat > ${ISPCONFIGINSTALLPATH}/server/conf/sogo_domains/read_me << EOF for how to configure the config file and the format of the files see SOGo documentation the file names must be as follow (must end with .conf) they are not automaticly created you need to do this by hand. a template for domain example.com wil be named. example.com.conf domains_default.conf :: default for all domains.. EOF chown ${ISPCSYSTEMUSER}:${ISPCSYSTEMUSER} -R ${ISPCONFIGINSTALLPATH}/server/conf/sogo_domains cat > ${ISPCONFIGINSTALLPATH}/server/plugins-available/sogo_config_plugin.php << EOF <?php /* * Copyright (C) 2013 Christian M. Jensen * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * * NOTE* for more info, modifications etc.. contact me at [url]http://www.howtoforge.com/[/url] my user name: 'psykosen' */ class sogo_config_plugin { var \$plugin_name = 'sogo_config_plugin'; var \$class_name = 'sogo_config_plugin'; var \$sogo_su_cmd = "sudo -u sogo"; var \$sogopw = '${SOGOUSERPW}'; var \$sogouser = '${SOGOUSERN}'; var \$sogodb = '${SOGODB}'; var \$ispcdb = '${ISPCONFIGDB}'; var \$sogobinary = '${SOGOBINARY}'; var \$sogotoolbinary = '${SOGOTOOLBINARY}'; var \$sogohomedir = '${SOGOHOMEDIR}'; var \$sogoconffile = '${SOGOGNUSTEPCONFFILE}'; var \$sogoinitscript = '${SOGOINITSCRIPT}'; var \$templ_file = '${ISPCONFIGINSTALLPATH}/server/conf/sogo.conf-templ'; var \$templ_domains_dir = '${ISPCONFIGINSTALLPATH}/server/conf/sogo_domains'; var \$mysql_server_host = '${MYSQLHOST}:${MYSQLPORT}'; function onInstall() { global \$conf; if (\$conf['services']['mail'] == true) { return true; } else { return false; } } function onLoad() { global \$app; \$app->plugins->registerEvent('mail_domain_delete', \$this->plugin_name, 'reconfigure'); \$app->plugins->registerEvent('mail_domain_insert', \$this->plugin_name, 'reconfigure'); \$app->plugins->registerEvent('mail_domain_update', \$this->plugin_name, 'reconfigure'); \$app->plugins->registerEvent('mail_user_delete', \$this->plugin_name, 'remove_sogo_mail_user'); } function remove_sogo_mail_user(\$event_name, \$data) { global \$app, \$conf; if (\$event_name == 'mail_user_delete') { exec(\$this->sogo_su_cmd . ' ' . \$this->sogotoolbinary . ' remove ' . escapeshellarg(\$data['old']['login'])); sleep(1); } } function reconfigure(\$event_name, \$data) { global \$app, \$conf; \$flag = false; if (\$event_name == 'mail_domain_delete') { \$flag = \$this->remove_sogo_maildomain((isset(\$data['new']['domain']) ? \$data['new']['domain'] : \$data['old']['domain'])); } else if (\$event_name == 'mail_domain_insert') { \$flag = true; } else if (\$event_name == 'mail_domain_update') { \$flag = true; } else { //* i can\'t work with that give me a command... // /PATH/to/ISPConfig_DIR/server/SOGO-reconfigure.log // file_put_contents('SOGO-reconfigure.log', print_r(\$event_name,true)."\n\n".print_r(\$data,true)); } if (\$flag) { \$active_mail_domains = \$app->db->queryAllRecords('SELECT \`domain\` FROM \`mail_domain\` WHERE \`active\`=\'y\''); \$sogo_conf = file_get_contents(\$this->templ_file); \$tmp_conf = ""; foreach (\$active_mail_domains as \$vd) { \$tmp_conf .= \$this->build_conf_sogo_maildomain(\$vd['domain']); //* create if not exist \$this->create_sogo_view(\$vd['domain']); } \$sogo_conf = str_replace('{{SOGODOMAINSCONF}}', \$tmp_conf, \$sogo_conf); if (!file_put_contents(\$this->sogoconffile, \$sogo_conf)) { \$app->log('ERROR. unable to reconfigure SOGo..', LOGLEVEL_ERROR); return; } else { exec(\$this->sogoinitscript . ' restart'); //** make the system wait.. sleep(2); } } } function remove_sogo_maildomain(\$dom) { global \$app, \$conf; //* TODO: validate domain the correct way not by filter_var if (empty(\$dom) || filter_var('http://' . \$dom, FILTER_VALIDATE_URL) === false) { \$app->log('ERROR. removeing sogo mail domain.. domain invalid [' . \$dom . ']', LOGLEVEL_ERROR); return false; } \$dom_no_point = str_replace('-', '_', str_replace('.', '_', \$dom)); \$sqlres = \$this->_sqlConnect(); \$sqlres->query('DROP VIEW \`sogo_users_' . \$dom_no_point . '\`'); /* Broke my connection??? */ /* @\$sqlres->close(); */ return true; } function create_sogo_view(\$dom) { global \$app, \$conf; \$sqlres = \$this->_sqlConnect(); \$dom_no_point = str_replace('-', '_', str_replace('.', '_', \$dom)); \$sql1 = "SELECT \`TABLE_NAME\` FROM \`information_schema\`.\`VIEWS\` WHERE \`TABLE_SCHEMA\`='{\$this->sogodb}' AND \`TABLE_NAME\`='sogo_users_" . \$dom_no_point . "'"; \$tmp = \$sqlres->query(\$sql1); while (\$obj = \$tmp->fetch_object()) { if (\$obj->TABLE_NAME == 'sogo_users_' . \$dom_no_point) { return true; } } \$sqlres->query('CREATE VIEW sogo_users_' . \$dom_no_point . ' AS SELECT \`login\` AS c_uid, \`login\` AS c_name, \`password\` AS c_password, \`name\` AS c_cn, \`email\` AS mail, (SELECT \`server_name\` FROM ' . \$this->ispcdb . '.\`server\`, ' . \$this->ispcdb . '.\`mail_user\` WHERE \`mail_user\`.\`server_id\`=\`server\`.\`server_id\` AND \`server\`.\`mail_server\`=1 AND ispcmu.\`login\`=\`mail_user\`.\`login\` LIMIT 1) AS imap_host FROM ' . \$this->ispcdb . '.\`mail_user\` AS ispcmu WHERE \`email\` LIKE \'%@' . \$dom_no_point . '\' AND disableimap=\'n\''); if (!empty(\$sqlres->error)) \$app->log('ERROR. unable to create SOGo view[sogo_users_' . \$dom_no_point . '].. ' . \$sqlres->error, LOGLEVEL_ERROR); /* Broke my connection??? */ /* @\$sqlres->close(); */ return true; } function build_conf_sogo_maildomain(\$dom) { global \$app, \$conf; \$dom_no_point = str_replace('-', '_', str_replace('.', '_', \$dom)); /* For mail aliases.. <key>MailFieldNames</key> <array> <string>Col1</string> <string>Col2</string> <string>Col3</string> </array> */ \$sogo_conf = ""; \$sogo_conf_vars = array( '{{DOMAIN}}' => \$dom, '{{DOMAINADMIN}}' => 'postmaster@' . \$dom, '{{SOGOUNIQID}}' => \$dom_no_point, '{{CONNECTIONVIEWURL}}'=>"mysql://{\$this->sogouser}:{\$this->sogopw}@{\$this->mysql_server_host}/{\$this->sogodb}/sogo_users_{\$dom_no_point}" ); if (file_exists("{\$this->templ_domains_dir}/{\$dom_no_point}.conf")) { \$sogo_conf = file_get_contents("{\$this->templ_domains_dir}/{\$dom}.conf"); } else { if (!file_exists("{\$this->templ_domains_dir}/{\$dom_no_point}.conf")) \$app->log('ERROR. loading domains config.. file: '."{\$this->templ_domains_dir}/{\$dom_no_point}.conf", LOGLEVEL_DEBUG); if (file_exists("{\$this->templ_domains_dir}/domains_default.conf")) { \$sogo_conf = file_get_contents("{\$this->templ_domains_dir}/domains_default.conf"); } else { \$app->log('ERROR. loading domain config.. file: ' . "{\$this->templ_domains_dir}/domains_default.conf", LOGLEVEL_ERROR); return; } } if (!empty(\$sogo_conf)) { foreach (\$sogo_conf_vars as \$key => \$value) { \$sogo_conf = preg_replace("/{\$key}/i", \$value, \$sogo_conf); } } return \$sogo_conf; } function _sqlConnect() { \$_sqlserver = explode(':', \$this->mysql_server_host); \$sqlres = new mysqli(\$_sqlserver[0], \$this->sogouser, \$this->sogopw, \$this->sogodb, \$_sqlserver[1]); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } return \$sqlres; } } ?> EOF chown ${ISPCSYSTEMUSER}:${ISPCSYSTEMUSER} ${ISPCONFIGINSTALLPATH}/server/plugins-available/sogo_config_plugin.php ### /usr/local/ispconfig/server/plugins-available/sogo_config_plugin.php ## configure sogo before restarting sogo service.. # enable the plugin.. ln -s ${ISPCONFIGINSTALLPATH}/server/plugins-available/sogo_config_plugin.php ${ISPCONFIGINSTALLPATH}/server/plugins-enabled/sogo_config_plugin.inc.php echo "Allmost there wee just need to configure the vhost" echo "." echo -e "SOGo Domain vhost to configure [`hostname --fqdn`]: \c " read SOGOVHOSTNAME if [ -z "${SOGOVHOSTNAME}" ]; then SOGOVHOSTNAME=`hostname --fqdn` fi echo -e "HTTP Protocol [http]: \c " read SOGOPROTOCAL if [ -z "${SOGOPROTOCAL}" ]; then SOGOPROTOCAL="http" fi echo -e "HTTP Port: [80]: \c " read SOGOHTTPPORT if [ -z "${SOGOHTTPPORT}" ]; then SOGOHTTPPORT="80" fi echo " <VirtualHost *:${SOGOHTTPPORT}> Servername ${SOGOVHOSTNAME}:${SOGOHTTPPORT} DocumentRoot /usr/lib64/GNUstep/SOGo/WebServerResources/ ## ErrorLog /var/log/apache2/sogo-error.log ## Customlog /var/log/apache2/sogo-access.log combined ServerSignature Off Alias /SOGo.woa/WebServerResources/ \ /usr/lib64/GNUstep/SOGo/WebServerResources/ Alias /SOGo/WebServerResources/ \ /usr/lib64/GNUstep/SOGo/WebServerResources/ AliasMatch /SOGo/so/ControlPanel/Products/(.*)/Resources/(.*) \ /usr/lib64/GNUstep/SOGo/\$1.SOGo/Resources/\$2 <Directory /usr/lib64/GNUstep/SOGo/> AllowOverride None Order deny,allow Allow from all # Explicitly allow caching of static content to avoid browser specific behavior. # A resource's URL MUST change in order to have the client load the new version. <IfModule expires_module> ExpiresActive On ExpiresDefault \"access plus 1 year\" </IfModule> </Directory> <LocationMatch \"^/SOGo/so/ControlPanel/Products/.*UI/Resources/.*\.(jpg|png|gif|css|js)\"> SetHandler default-handler </LocationMatch> ## Uncomment the following to enable proxy-side authentication, you will then ## need to set the \"SOGoTrustProxyAuthentication\" SOGo user default to YES and ## adjust the \"x-webobjects-remote-user\" proxy header in the \"Proxy\" section ## below. #<Location /SOGo> # AuthType XXX # Require valid-user # SetEnv proxy-nokeepalive 1 # Allow from all #</Location> ProxyRequests Off SetEnv proxy-nokeepalive 1 ProxyPreserveHost On # When using CAS, you should uncomment this and install cas-proxy-validate.py # in /usr/lib64/cgi-bin to reduce server overloading # # ProxyPass /SOGo/casProxy [url]http://localhost/cgi-bin/cas-proxy-validate.py[/url] # <Proxy http://localhost/app/cas-proxy-validate.py> # Order deny,allow # Allow from your-cas-host-addr # </Proxy> ProxyPass /SOGo [url]http://127.0.0.1:20000/SOGo[/url] retry=0 <Proxy http://127.0.0.1:20000/SOGo> ## adjust the following to your configuration RequestHeader set \"x-webobjects-server-port\" \"${SOGOHTTPPORT}\" RequestHeader set \"x-webobjects-server-name\" \"${SOGOVHOSTNAME}\" RequestHeader set \"x-webobjects-server-url\" \"${SOGOPROTOCAL}://${SOGOVHOSTNAME}:${SOGOHTTPPORT}\" ## When using proxy-side autentication, you need to uncomment and ## adjust the following line: # RequestHeader set \"x-webobjects-remote-user\" \"%{REMOTE_USER}e\" RequestHeader set \"x-webobjects-server-protocol\" \"HTTP/1.0\" RequestHeader set \"x-webobjects-remote-host\" %{REMOTE_HOST}e env=REMOTE_HOST AddDefaultCharset UTF-8 Order allow,deny Allow from all </Proxy> ## We use mod_rewrite to pass remote address to the SOGo proxy. # The remote address will appear in SOGo's log files and in the X-Forward # header of emails. RewriteEngine On RewriteRule ^/SOGo/(.*)\$ /SOGo/\$1 [env=REMOTE_HOST:%{REMOTE_ADDR},PT] Redirect permanent /index.html ${SOGOPROTOCAL}://${SOGOVHOSTNAME}:${SOGOHTTPPORT}/SOGo </virtualhost> "> /etc/httpd/conf.d/SOGo.conf ## final restart services ${SOGOINITSCRIPT} restart a2enmod proxy proxy_http headers rewrite /etc/init.d/httpd restart clear echo -e "------------ SOGo Installed ------------" echo -e "${SOGOPROTOCAL}://${SOGOVHOSTNAME}:${SOGOHTTPPORT}/SOGo" echo -e "VHOST Conf:\t\t/etc/httpd/conf.d/SOGo.conf" echo -e "" echo -e "ISPC Plugin:\t\t${ISPCONFIGINSTALLPATH}/server/plugins-available/sogo_config_plugin.php" echo -e "ISPC Template:\t\t${ISPCONFIGINSTALLPATH}/server/conf/sogo.conf-templ" echo -e "SOGo Domain Templates:\t\t${ISPCONFIGINSTALLPATH}/server/conf/sogo_domains/" echo -e "SOGo Bin:\t\t${SOGOBINARY}" echo -e "SOGo-Tool Bin:\t\t${SOGOTOOLBINARY}" echo -e "SOGo Home:\t\t${SOGOHOMEDIR}" echo -e "SOGo Config:\t\t${SOGOGNUSTEPCONFFILE}" echo -e "SOGo Init:\t\t${SOGOINITSCRIPT}" echo -e "DB Name:\t\t${SOGODB}" echo -e "DB User:\t\t${SOGOUSERN}" echo -e "DB Psswd:\t\t${SOGOUSERPW}" echo -e "" echo -e "Adminitrator is [email][email protected][/email]" echo -e "if postmaster mail addr is not added go add it and login to SOGo to start administrat the domain" echo -e "Enable SOGo logins by update/delete or add a mail domain" echo -e "----------------------------------------" exit 0;
Code: Proxy Error The proxy server received an invalid response from an upstream server. The proxy server could not handle the request GET /SOGo. Reason: Error reading from remote server The database does contain data. I updated the test server as the packages were rather old. After a reboot I get this.. Which is a step further. I'll give your script a run, it seems a lot better then mine !
Probably the database had to be filled. I edited all domains and it starts working. But now I get a 404 error, I guess that's the IMAP failure bug. Would it be hard to edit the script to add support for courier IMAP and Dovecot? In the original script the lines which have to be edited are given. But I'm not nearly as good in scripting as you are, but I do want to help!
I definitly got to learn to read... My DNS isn't configured for the testserver (yet) and so webserver02.hma.local doesn't work.. Created a DNS record for the testserver and changed the IMAP settings and thing work! psykosen you are a hero (for the day ) Sogo is so much richer and nicer as Squirrelmail for webmail! When it is more mature and more finished (as in things working (eg. openchange) I will definitly install it on our production server!
I'm happy you got it working, also thanks for giving it go CentOS, i see what i can do to get it all in one script, but don't expect to much apparently i have to help around the house
I was at work today. But that's easy compared tp what you did . But when I get some more testing time I'll see if I can help some more! I do like SOGo a lot as an addon for ISPConfig!
Hello, sorry but i'm not english. the website http://cmjscripter.net is broken ? I found the script ISPC-SOGO-debian-u4.sh in google cache but isn't apply. When I execute, the databa are creat, but none table, and i can't identify to SOGO. None error message, can you help me ? ISPConfig 3.0.5.2, debian squeeze. Tanks
Not broken just home hosted an have bean turn off for maintains and is running again.! if you have the plugin in the plugins-enabled folder.! and sogo installed and working you properly need to add a dummy mail domain from the control panel and then delete it afterwords, wait for the ISPConfig server cronjob to run and you should be able to use SOGo
Thank you for your respond, I have a plug in in /usr/local/ispconfig/server/plugins-available/sogo_config_plugin.php but I don't see SOGO in web interface of ISPConfig ? It's normaly ? I create a domain test.com, add a email, but i don't connect to sogo (bad user or pass) I have remove sogo, and reinstall with http://cmjscripter.net/files/scripts/ispc/ISPC-SOGO.sh no error, but the mysql base sogodb is empty, no table. Tank's for your help Edouard
okay lets take it from the top you have run the script. you have sogo plugin in /usr/local/ispconfig/server/plugins-available/sogo_config_plugin.php with a symlink to /usr/local/ispconfig/server/plugins-enabled/sogo_config_plugin.inc.php. the database settings in the plugin works !you can connect to the database with them.! binary's and other path's in the plugin (at the top starting with var $...) are correct.! then and fist then you should add a dummy mail domain, wait a minute for the cronjob to run. (check: Monitor->Show Jobqueue is empty) then u should see the database is populated with tables.! if not check the configuration file is created.! in ${SOGOHOMEDIR}/GNUstep/Defaults/.GNUstepDefaults and that the log file for ispconfig cron don't have any errors /var/log/ispconfig/cron.log and no errors in Monitor->Show System-Log if no errors and no tables in db something id wrong with the GNUStep config file
very tanks !! i've run php /usr/local/ispconfig/server/plugins-enabled/sogo_config_plugin.inc.php and the table are create, i have add a domaine test, mail, and it's ok very very tanks, very good !!!