Mailboxes Auto Login for ispconfog administrators

Discussion in 'Tips/Tricks/Mods' started by adammazin, Oct 4, 2019.

?

You found this instruction and feature

  1. good

    0 vote(s)
    0.0%
  2. not useful

    0 vote(s)
    0.0%
  3. sucks

    0 vote(s)
    0.0%
  1. adammazin

    adammazin New Member

    Hello guys,
    finally i got it work, I'm not programmer so i hope programmers help make it easier for others. i did it because my clients was nagging since i moved them from Cpanel to awesome Ispconfig to give them ability for auto login to other mailboxes without remembering or resetting mailbox passwords. so steps like below:
    Step One: create dovecot master password following these instructions: https://wiki1.dovecot.org/Authentication/MasterUsers
    changes will be done here /etc/dovecot/dovecot.conf
    like below:
    PHP:
    auth_master_user_separator = :
    passdb {
        
    args = /etc/dovecot/dovecot-master-users
        master 
    yes
        pass 
    yes
        driver 
    passwd-file
      
    }
    you can use another separators as you like " _ , - , +" just don't use "*"
    and you have to create this file /etc/dovecot/dovecot-master-users and but master password inside like below
    Code:
    admin:{SSHA512}PUTMdnfsflskjdctsLobSmGEndfklsdjk9WSaiHnudjflksjdskjsF2eJkjdhsddjslkdfjlV/BbSJ5M3BXOChEpo=
    to create master password like above use this CLI command
    Code:
    doveadm pw -s SSHA512
    keep in mind this text {SSHA512} is important read instruction.
    don't forget to restart dovecot
    Code:
    service dovecot restart
    keep this password save or simply don't keep it on your PC use it and forget it, if anyone got them you and your clients will be hacked :D
    before i forget change file permission
    Code:
    chown -R root:dovecot /etc/dovecot/dovecot-master-users
    chmod 644 /etc/dovecot/dovecot-master-users
    Step Two: you have to play with ispconfig files :rolleyes: so go and add these lines to /var/www/ispconfig/mail/webmailer.php
    Code:
    include "/var/www/ispconfig/mail/RoundcubeLogin.class.php";
    $dbemail = $app->db->queryOneRecord("SELECT email FROM mail_user WHERE mailuser_id = ?", $emailId);
    $rcl = new RoundcubeLogin("/roundcube/", $debug);
    $rcl->setHostname($serverData['server_name']);
    $rcl->setPort(80);
    $rcl->setSSL(false);
    $rcl->logout();
    try {
            $rcl->login($dbemail['email'].":admin", "Your PLAIN Password");
            $rcl->redirect();
    }
    catch (RoundcubeLoginException $ex) {
     echo "ERROR: Technical problem, ".$ex->getMessage();}
    
    and replace "Your PLAIN Password" on above code with your plain master password you created earlier, remember plain not encrypted. above line will be added after line 59 right after
    Code:
           $webmail_url = str_replace('[SERVERNAME]', $serverData['server_name'], $webmail_url);
    
    and you have to comment out this line
    Code:
    //      header('Location:' . $webmail_url);
    then go and create this file /var/www/ispconfig/mail/RoundcubeLogin.class.php on same directory like you see, fill it with code from this file https://blog.heckel.io/wp-content/uploads/2008/05/RoundcubeLogin.class.php.txt or or just download file and upload it to above directory.
    ***All thanks after Brilliant Ispconfig Team to this guy Philipp C. Heckel and his script find it here: https://blog.heckel.io/2008/05/16/roundcube-login-via-php-script/
    after creating it don't forget to change file permission:
    Code:
    chown -R ispconfig:ispconfig /var/www/ispconfig/mail/RoundcubeLogin.class.php

    Now go and test your new feature ;)
     
    Last edited: Oct 5, 2019
    Jesse Norell likes this.

Share This Page