Current time: 12-26-2024, 10:29 PM Hello There, Guest! (LoginRegister)


Post Reply 
Can I use IMP(part of Horde) as my WebMail
Author Message
parmando Offline
Junior Member
*

Posts: 10
Joined: Sep 2009
Reputation: 0
Post: #1
Can I use IMP(part of Horde) as my WebMail
hello, i just want to know if i can use IMP as my webmail instead of the default one, and how i should configure it.

thanks in advance.
09-12-2009 11:36 AM
Find all posts by this user Quote this message in a reply
kilburn Offline
Development Team
*****
Dev Team

Posts: 2,182
Joined: Feb 2007
Reputation: 34
Post: #2
RE: Can I use IMP(part of Horde) as my WebMail
Quote:i just want to know if i can use IMP as my webmail instead of the default one
Yes, you can

Quote:..and how i should configure it.
Install it in /var/www/ispcp/gui/tools/webmail/ and tell it to use the local IMAP server. Refer to the creators for specific instructions on how to install it, as we obviously don't support it.
09-12-2009 05:31 PM
Visit this user's website Find all posts by this user Quote this message in a reply
parmando Offline
Junior Member
*

Posts: 10
Joined: Sep 2009
Reputation: 0
Post: #3
RE: Can I use IMP(part of Horde) as my WebMail
Thanks you very much.
09-13-2009 01:01 AM
Find all posts by this user Quote this message in a reply
joximu Offline
helper
*****
Moderators

Posts: 7,024
Joined: Jan 2007
Reputation: 92
Post: #4
RE: Can I use IMP(part of Horde) as my WebMail
If you need to use the vacation and passwd module of horde - I could give you some infos... I use them...

/J
09-14-2009 07:06 AM
Visit this user's website Find all posts by this user Quote this message in a reply
parmando Offline
Junior Member
*

Posts: 10
Joined: Sep 2009
Reputation: 0
Post: #5
RE: Can I use IMP(part of Horde) as my WebMail
yes please, it will be very usefull to me.

thanks in advance.
09-14-2009 10:22 PM
Find all posts by this user Quote this message in a reply
joximu Offline
helper
*****
Moderators

Posts: 7,024
Joined: Jan 2007
Reputation: 92
Post: #6
RE: Can I use IMP(part of Horde) as my WebMail
Ok

vacation:
I created a new driver, based on the customsql driver found in horde/vacation/lib/Driver.
Here the "patch -u":

Code:
/vacation/lib/Driver# diff -u customsql.php ispcp.php
--- customsql.php       2009-01-29 17:02:55.000000000 +0100
+++ ispcp.php   2009-06-19 01:04:57.000000000 +0200
@@ -13,7 +13,7 @@
  * @since   Vacation 3.1
  * @package Vacation
  */
-class Vacation_Driver_customsql extends Vacation_Driver {
+class Vacation_Driver_ispcp extends Vacation_Driver {

     /**
      * SQL connection object.
@@ -35,7 +35,7 @@
      * @param string $user   A user name.
      * @param array $params  Configuration parameters for the backend.
      */
-    function Vacation_Driver_customsql($user, $params = array())
+    function Vacation_Driver_ispcp($user, $params = array())
     {
         $params = Horde::getDriverConfig('server', 'sql');
         parent::Vacation_Driver($user, $params);
@@ -91,6 +91,8 @@
         if ($result !== DB_OK) {
             return PEAR::raiseError(_("An unknown error occured while enabling the vacation notice."));
         }
+        # ispCP Update...
+        $this->send_request();
     }

     /**
@@ -135,6 +137,9 @@
         if ($result !== DB_OK) {
             return PEAR::raiseError(_("An unknown error occured while enabling the vacation notice."));
         }
+
+        # ispCP Update...
+        $this->send_request();
     }

     /**
@@ -230,7 +235,12 @@
     {
         if ($this->_realm === 'default' ||
             $this->_realm === '') {
-            return $this->_user;
+            $userid = Auth::getAuth();
+            return $userid;
         } else {
             return $this->_user . '@' . $this->_realm;
         }
@@ -308,4 +318,83 @@
         $this->_connected = true;
     }

+# ispcp Funktionen
+function read_line(&$socket) {
+    $ch = '';
+    $line = '';
+    do {
+        $ch = socket_read($socket,1);
+        $line = $line . $ch;
+    } while($ch != "\r" && $ch != "\n");
+    return $line;
+}
+
+function send_request() {
+
+#        global $Version;
+        $Version = 'ispCP-Horde-Passwd';
+
+        $code = 999;
+
+    @$socket = socket_create (AF_INET, SOCK_STREAM, 0);
+    if ($socket < 0) {
+        $errno =  "socket_create() failed.\n";
+        return $errno;
+    }
+
+    @$result = socket_connect ($socket, '127.0.0.1', 9876);
+    if ($result == FALSE) {
+        $errno =  "socket_connect() failed.\n";
+        return $errno;
+    }
+
+    /* read one line with welcome string */
+    $out = $this->read_line($socket);
+
+    list($code) = explode(' ', $out);
+    if ($code == 999) {
+        return $out;
+    }
+
+    /* send hello query */
+    $query = "helo  $Version\r\n";
+    socket_write ($socket, $query, strlen ($query));
+
+    /* read one line with helo answer */
+    $out = $this->read_line($socket);
+
+    list($code) = explode(' ', $out);
+    if ($code == 999) {
+        return $out;
+    }
+
+    /* send reg check query */
+    $query = "execute query\r\n";
+    socket_write ($socket, $query, strlen ($query));
+    /* read one line key replay */
+    $execute_reply = $this->read_line($socket);
+
+    list($code) = explode(' ', $execute_reply);
+    if ($code == 999) {
+        return $out;
+    }
+
+    /* send quit query */
+    $quit_query = "bye\r\n";
+    socket_write ($socket, $quit_query, strlen ($quit_query));
+    /* read quit answer */
+    $quit_reply = $this->read_line($socket);
+
+    list($code) = explode(' ', $quit_reply);
+    if ($code == 999) {
+        return $out;
+    }
+
+    list($answer) = explode(' ', $execute_reply);
+
+    socket_close ($socket);
+
+    return $answer;
+}
+
}

the configuration (config/conf.php) is simple, but you need a sql users who have access to some fields in the ispcp db (table mail_users) - in my case I gave the needed permissions to the horde mysql user (select and update to the table - or only the needes fields - depends on you).

part of the config:
Code:
$conf['server']['params']['default']['query_set'] = 'UPDATE `ispcp`.`mail_users` SET `mail_auto_respond_text` = \M, `mail_auto_respond` = 1, `status` = \'change\' WHERE mail_addr = \U AND `mail_pass` = \P';

$conf['server']['params']['default']['query_unset'] = 'UPDATE `ispcp`.`mail_users` SET `mail_auto_respond` = 0, `status` = \'change\' WHERE mail_addr = \U AND `mail_pass` = \P';

$conf['server']['params']['default']['query_get'] = "SELECT IF(`mail_auto_respond`=1,'Y', 'N') AS `vacation`, `mail_auto_respond_text` AS `message`, '' AS `subject` FROM `ispcp`.`mail_users` WHERE mail_addr = \U AND `mail_pass` = \P";

$conf['server']['params']['default']['driverconfig'] = 'horde';

$conf['server']['params']['default']['hordeauth'] = false;

$conf['server']['params']['encryption'] = 'plain';

$conf['server']['params']['show_encryption'] = false;

$conf['server']['driver'] = 'ispcp';

***
Passwd:

very similar the password module.
a new Driver, based on the sql.php:
Code:
/passwd/lib/Driver# diff -u sql.php ispcp.php
--- sql.php     2009-01-06 16:25:23.000000000 +0100
+++ ispcp.php   2009-06-19 00:57:50.000000000 +0200
@@ -17,7 +17,7 @@
  * @author  Eric Jon Rostetter <eric.rostetter@physics.utexas.edu>
  * @package Passwd
  */
-class Passwd_Driver_sql extends Passwd_Driver {
+class Passwd_Driver_ispcp extends Passwd_Driver {

     /**
      * SQL connection object.
@@ -38,7 +38,7 @@
      *
      * @param array $params  A hash containing connection parameters.
      */
-    function Passwd_Driver_sql($params = array())
+    function Passwd_Driver_ispcp($params = array())
     {
         if (isset($params['phptype'])) {
             $this->_params['phptype'] = $params['phptype'];
@@ -172,6 +172,9 @@
             return $result;
         }

+       # ispCP Update...
+       $this->send_request();
+
         return true;
     }

@@ -255,4 +258,85 @@
         return $this->_modify($username, $new_password);
     }

+
+# ispcp Funktionen
+function read_line(&$socket) {
+    $ch = '';
+    $line = '';
+    do {
+        $ch = socket_read($socket,1);
+        $line = $line . $ch;
+    } while($ch != "\r" && $ch != "\n");
+    return $line;
+}
+
+function send_request() {
+
+#        global $Version;
+       $Version = 'ispCP-Horde-Passwd';
+
+        $code = 999;
+
+    @$socket = socket_create (AF_INET, SOCK_STREAM, 0);
+    if ($socket < 0) {
+        $errno =  "socket_create() failed.\n";
+        return $errno;
+    }
+
+    @$result = socket_connect ($socket, '127.0.0.1', 9876);
+    if ($result == FALSE) {
+        $errno =  "socket_connect() failed.\n";
+        return $errno;
+    }
+
+    /* read one line with welcome string */
+    $out = $this->read_line($socket);
+
+    list($code) = explode(' ', $out);
+    if ($code == 999) {
+        return $out;
+    }
+
+    /* send hello query */
+    $query = "helo  $Version\r\n";
+    socket_write ($socket, $query, strlen ($query));
+
+    /* read one line with helo answer */
+    $out = $this->read_line($socket);
+
+    list($code) = explode(' ', $out);
+    if ($code == 999) {
+        return $out;
+    }
+
+    /* send reg check query */
+    $query = "execute query\r\n";
+    socket_write ($socket, $query, strlen ($query));
+    /* read one line key replay */
+    $execute_reply = $this->read_line($socket);
+
+    list($code) = explode(' ', $execute_reply);
+    if ($code == 999) {
+        return $out;
+    }
+
+    /* send quit query */
+    $quit_query = "bye\r\n";
+    socket_write ($socket, $quit_query, strlen ($quit_query));
+    /* read quit answer */
+    $quit_reply = $this->read_line($socket);
+
+    list($code) = explode(' ', $quit_reply);
+    if ($code == 999) {
+        return $out;
+    }
+
+    list($answer) = explode(' ', $execute_reply);
+
+    socket_close ($socket);
+
+    return $answer;
+}
+
+
}

and the backends-config:
Code:
$backends['ispcp'] = array (
    'name' => 'ispCP Authentication',
    'preferred' => '',
    'password policy' => array(
        'minLength' => 6,
        'maxLength' => 16,
        'maxSpace' => 0,
        'minUpper' => 0,
        'minLower' => 1,
        'minNumeric' => 1,
        'minSymbols' => 0
    ),
    'driver' => 'ispcp',
    'params' => array_merge($conf['sql'],
        array('database' => 'ispcp',
            'table' => 'mail_users',
            'user_col' => 'mail_addr',
            'pass_col' => 'mail_pass',
            'show_encryption' => false,
            'encryption' => 'plain',
            'query_modify' => "UPDATE `mail_users` SET `mail_pass` = %p, `status` = 'change' WHERE mail_addr = %u",
        )),
);

Of cource: the horde mysql user needs update permission on the mail_pass field :-)

There you go.

Biggest difference to the (custom)sql drivers is: run the request manager after changing the database.

/J
(This post was last modified: 09-14-2009 11:36 PM by joximu.)
09-14-2009 11:34 PM
Visit this user's website Find all posts by this user Quote this message in a reply
parmando Offline
Junior Member
*

Posts: 10
Joined: Sep 2009
Reputation: 0
Post: #7
RE: Can I use IMP(part of Horde) as my WebMail
This is very interesting, but far away from my current knowledge. I will need to read more. :(
09-15-2009 02:36 AM
Find all posts by this user Quote this message in a reply
parmando Offline
Junior Member
*

Posts: 10
Joined: Sep 2009
Reputation: 0
Post: #8
RE: Can I use IMP(part of Horde) as my WebMail
I am currently running a fresh installation of lenny ispCPOmega.

After an "aptitude install imp4" I can not access the IMP from webmail/ ... Can you, please, be more specific in the steps that I need to follow to get it integrated (from a debian point of view)?

IMP is in /usr/share/horde3/imp/

Thanks in advance.
09-17-2009 04:21 AM
Find all posts by this user Quote this message in a reply
joximu Offline
helper
*****
Moderators

Posts: 7,024
Joined: Jan 2007
Reputation: 92
Post: #9
RE: Can I use IMP(part of Horde) as my WebMail
hm, I never used the debian-horde, always the original from http://ftp.horde.org

but I'm sure you can set an alias in the apache-config
alias /webmail /usr/share/horde3
or similar...

/J
09-17-2009 07:43 AM
Visit this user's website Find all posts by this user Quote this message in a reply
astern4ispcp@singakademie.at Offline


Posts: 2
Joined: Oct 2009
Reputation: 0
Post: #10
RE: Can I use IMP(part of Horde) as my WebMail
(09-14-2009 11:34 PM)joximu Wrote:  Ok

vacation:
I created a new driver, based on the customsql driver found in horde/vacation/lib/Driver.
Here the "patch -u":

Code:
/vacation/lib/Driver# diff -u customsql.php ispcp.php
--- customsql.php       2009-01-29 17:02:55.000000000 +0100
+++ ispcp.php   2009-06-19 01:04:57.000000000 +0200
@@ -13,7 +13,7 @@
  * @since   Vacation 3.1
  * @package Vacation
  */
-class Vacation_Driver_customsql extends Vacation_Driver {
+class Vacation_Driver_ispcp extends Vacation_Driver {

     /**
      * SQL connection object.
@@ -35,7 +35,7 @@
      * @param string $user   A user name.
      * @param array $params  Configuration parameters for the backend.
      */
-    function Vacation_Driver_customsql($user, $params = array())
+    function Vacation_Driver_ispcp($user, $params = array())
     {
         $params = Horde::getDriverConfig('server', 'sql');
         parent::Vacation_Driver($user, $params);
@@ -91,6 +91,8 @@
         if ($result !== DB_OK) {
             return PEAR::raiseError(_("An unknown error occured while enabling the vacation notice."));
         }
+        # ispCP Update...
+        $this->send_request();
     }

     /**
@@ -135,6 +137,9 @@
         if ($result !== DB_OK) {
             return PEAR::raiseError(_("An unknown error occured while enabling the vacation notice."));
         }
+
+        # ispCP Update...
+        $this->send_request();
     }

     /**
@@ -230,7 +235,12 @@
     {
         if ($this->_realm === 'default' ||
             $this->_realm === '') {
-            return $this->_user;
+            $userid = Auth::getAuth();
+            return $userid;
         } else {
             return $this->_user . '@' . $this->_realm;
         }
@@ -308,4 +318,83 @@
         $this->_connected = true;
     }

+# ispcp Funktionen
+function read_line(&$socket) {
+    $ch = '';
+    $line = '';
+    do {
+        $ch = socket_read($socket,1);
+        $line = $line . $ch;
+    } while($ch != "\r" && $ch != "\n");
+    return $line;
+}
+
+function send_request() {
+
+#        global $Version;
+        $Version = 'ispCP-Horde-Passwd';
+
+        $code = 999;
+
+    @$socket = socket_create (AF_INET, SOCK_STREAM, 0);
+    if ($socket < 0) {
+        $errno =  "socket_create() failed.\n";
+        return $errno;
+    }
+
+    @$result = socket_connect ($socket, '127.0.0.1', 9876);
+    if ($result == FALSE) {
+        $errno =  "socket_connect() failed.\n";
+        return $errno;
+    }
+
+    /* read one line with welcome string */
+    $out = $this->read_line($socket);
+
+    list($code) = explode(' ', $out);
+    if ($code == 999) {
+        return $out;
+    }
+
+    /* send hello query */
+    $query = "helo  $Version\r\n";
+    socket_write ($socket, $query, strlen ($query));
+
+    /* read one line with helo answer */
+    $out = $this->read_line($socket);
+
+    list($code) = explode(' ', $out);
+    if ($code == 999) {
+        return $out;
+    }
+
+    /* send reg check query */
+    $query = "execute query\r\n";
+    socket_write ($socket, $query, strlen ($query));
+    /* read one line key replay */
+    $execute_reply = $this->read_line($socket);
+
+    list($code) = explode(' ', $execute_reply);
+    if ($code == 999) {
+        return $out;
+    }
+
+    /* send quit query */
+    $quit_query = "bye\r\n";
+    socket_write ($socket, $quit_query, strlen ($quit_query));
+    /* read quit answer */
+    $quit_reply = $this->read_line($socket);
+
+    list($code) = explode(' ', $quit_reply);
+    if ($code == 999) {
+        return $out;
+    }
+
+    list($answer) = explode(' ', $execute_reply);
+
+    socket_close ($socket);
+
+    return $answer;
+}
+
}

the configuration (config/conf.php) is simple, but you need a sql users who have access to some fields in the ispcp db (table mail_users) - in my case I gave the needed permissions to the horde mysql user (select and update to the table - or only the needes fields - depends on you).

part of the config:
Code:
$conf['server']['params']['default']['query_set'] = 'UPDATE `ispcp`.`mail_users` SET `mail_auto_respond_text` = \M, `mail_auto_respond` = 1, `status` = \'change\' WHERE mail_addr = \U AND `mail_pass` = \P';

$conf['server']['params']['default']['query_unset'] = 'UPDATE `ispcp`.`mail_users` SET `mail_auto_respond` = 0, `status` = \'change\' WHERE mail_addr = \U AND `mail_pass` = \P';

$conf['server']['params']['default']['query_get'] = "SELECT IF(`mail_auto_respond`=1,'Y', 'N') AS `vacation`, `mail_auto_respond_text` AS `message`, '' AS `subject` FROM `ispcp`.`mail_users` WHERE mail_addr = \U AND `mail_pass` = \P";

$conf['server']['params']['default']['driverconfig'] = 'horde';

$conf['server']['params']['default']['hordeauth'] = false;

$conf['server']['params']['encryption'] = 'plain';

$conf['server']['params']['show_encryption'] = false;

$conf['server']['driver'] = 'ispcp';

***
Passwd:

very similar the password module.
a new Driver, based on the sql.php:
Code:
/passwd/lib/Driver# diff -u sql.php ispcp.php
--- sql.php     2009-01-06 16:25:23.000000000 +0100
+++ ispcp.php   2009-06-19 00:57:50.000000000 +0200
@@ -17,7 +17,7 @@
  * @author  Eric Jon Rostetter <eric.rostetter@physics.utexas.edu>
  * @package Passwd
  */
-class Passwd_Driver_sql extends Passwd_Driver {
+class Passwd_Driver_ispcp extends Passwd_Driver {

     /**
      * SQL connection object.
@@ -38,7 +38,7 @@
      *
      * @param array $params  A hash containing connection parameters.
      */
-    function Passwd_Driver_sql($params = array())
+    function Passwd_Driver_ispcp($params = array())
     {
         if (isset($params['phptype'])) {
             $this->_params['phptype'] = $params['phptype'];
@@ -172,6 +172,9 @@
             return $result;
         }

+       # ispCP Update...
+       $this->send_request();
+
         return true;
     }

@@ -255,4 +258,85 @@
         return $this->_modify($username, $new_password);
     }

+
+# ispcp Funktionen
+function read_line(&$socket) {
+    $ch = '';
+    $line = '';
+    do {
+        $ch = socket_read($socket,1);
+        $line = $line . $ch;
+    } while($ch != "\r" && $ch != "\n");
+    return $line;
+}
+
+function send_request() {
+
+#        global $Version;
+       $Version = 'ispCP-Horde-Passwd';
+
+        $code = 999;
+
+    @$socket = socket_create (AF_INET, SOCK_STREAM, 0);
+    if ($socket < 0) {
+        $errno =  "socket_create() failed.\n";
+        return $errno;
+    }
+
+    @$result = socket_connect ($socket, '127.0.0.1', 9876);
+    if ($result == FALSE) {
+        $errno =  "socket_connect() failed.\n";
+        return $errno;
+    }
+
+    /* read one line with welcome string */
+    $out = $this->read_line($socket);
+
+    list($code) = explode(' ', $out);
+    if ($code == 999) {
+        return $out;
+    }
+
+    /* send hello query */
+    $query = "helo  $Version\r\n";
+    socket_write ($socket, $query, strlen ($query));
+
+    /* read one line with helo answer */
+    $out = $this->read_line($socket);
+
+    list($code) = explode(' ', $out);
+    if ($code == 999) {
+        return $out;
+    }
+
+    /* send reg check query */
+    $query = "execute query\r\n";
+    socket_write ($socket, $query, strlen ($query));
+    /* read one line key replay */
+    $execute_reply = $this->read_line($socket);
+
+    list($code) = explode(' ', $execute_reply);
+    if ($code == 999) {
+        return $out;
+    }
+
+    /* send quit query */
+    $quit_query = "bye\r\n";
+    socket_write ($socket, $quit_query, strlen ($quit_query));
+    /* read quit answer */
+    $quit_reply = $this->read_line($socket);
+
+    list($code) = explode(' ', $quit_reply);
+    if ($code == 999) {
+        return $out;
+    }
+
+    list($answer) = explode(' ', $execute_reply);
+
+    socket_close ($socket);
+
+    return $answer;
+}
+
+
}

and the backends-config:
Code:
$backends['ispcp'] = array (
    'name' => 'ispCP Authentication',
    'preferred' => '',
    'password policy' => array(
        'minLength' => 6,
        'maxLength' => 16,
        'maxSpace' => 0,
        'minUpper' => 0,
        'minLower' => 1,
        'minNumeric' => 1,
        'minSymbols' => 0
    ),
    'driver' => 'ispcp',
    'params' => array_merge($conf['sql'],
        array('database' => 'ispcp',
            'table' => 'mail_users',
            'user_col' => 'mail_addr',
            'pass_col' => 'mail_pass',
            'show_encryption' => false,
            'encryption' => 'plain',
            'query_modify' => "UPDATE `mail_users` SET `mail_pass` = %p, `status` = 'change' WHERE mail_addr = %u",
        )),
);

Of cource: the horde mysql user needs update permission on the mail_pass field :-)

There you go.

Biggest difference to the (custom)sql drivers is: run the request manager after changing the database.

/J
hi,

I just wonder how to set configuration when using encrypted passwords in a mysql DB
regards
A.
10-23-2009 07:56 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 6 Guest(s)