import of mail users from standalone postfix server.

Discussion in 'General' started by nhybgtvfr, Jun 20, 2017.

  1. nhybgtvfr

    nhybgtvfr Member

    Hi,
    i'm trying to migrate all our mail users from a single standalone postfix server, into ispconfig multi-server (3.1.3).
    since it's a standalone postfix install, and the current users are configured in a custom db, created by a previous employee, i doubt the migration tool will be of much use.

    it appears the easiest method i have available to me is to create a csv file with all the required details and import that straight into the mail_users table on the ispconfig master database and then run a resync of the mail services.

    the existing mail accounts in this old db have passwords encrypted using mysql's encrypt function. although i may be able to retrieve most, if not all these passwords in clear text format from log files if needed. ( a feature i don't want available on the new mailserver )

    i'd rather not be forced to change a load of mail passwords at this point if possible, a lot of our clients seem to have enough trouble coping with how to use a pc's power switch, trying to talk them all through reconfiguring outlook/macmail/thunderbird/etc would be a nightmare.

    what's the best way to get all these passwords in unchanged, can i just import them and run encrypt on the field in mysql, import in cleartext and encrypt the field during the import process? are there any ispconfig seeds/salts i need to be concerned with?

    thanks
    lee.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

  3. nhybgtvfr

    nhybgtvfr Member

    cool. thanks till. that looks much easier :)
    although just to be absolutely clear, the passwords given in the csv file are in cleartext?
    and for mailbox quota, if we're not applying a quota yet, should that field be blank, NULL, or 0?

    thanks.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    yes

    0
     
  5. nhybgtvfr

    nhybgtvfr Member

    excellent. thanks Till.
     
  6. nhybgtvfr

    nhybgtvfr Member

    i'm having problems with that import script. i've put it on the server and run install.sh, and it's moved all the files to the relevant locations, and it shows up in the tools area on the control panel. so all ok there.
    but i choose a csv file to import, select a user, (admin is selected by default, i've tried it with that and various other client acounts). but absolutely nothing seems to happen when i click the import button, there's no indication of the page reloading, or script running. nothing happens at all. this is the same for any selected user, with 'run a test' checked or not.
    i've gone through various log files, there's simply nothing to indicate that it's attempted to do anything once the import button is clicked.
    running ispconfig version is 3.1.3
     
  7. nhybgtvfr

    nhybgtvfr Member

    further to the above, clicking on the cancel button also does nothing, it should load the tools/index.php file.
    it's seems like the onClick function simply isn't working.
     
  8. nhybgtvfr

    nhybgtvfr Member

    ok, looking at the other import scripts in the folder, i've changed some lines in /usr/localispconfig/interface/web/tools/templates/mailbox_import.htm from:

    <button class="positive iconstxt icoPositive" type="button" value="Import" onClick="submitUploadForm('pageForm','tools/mailbox_import.php');"><span>Import</span></button>
    <button class="negative iconstxt icoNegative" type="button" value="Cancel" onClick="loadContent('tools/index.php');"><span>Cancel</span></button>

    to:

    <button class="positive iconstxt icoPositive" type="button" value="Import" data-submit-form="pageForm" data-form-action="tools/mailbox_import.php"><span>Import</span></button>
    <button class="negative iconstxt icoNegative" type="button" value="Cancel" data-load-content="tools/index.php"><span>Cancel</span></button>


    and the buttons now actually do something, only done a test import, so can't confirm everything works yet, it does return any changed settings back to the default, and the cancel button does load tools/index.php

    so if anyone else is stuck gets stuck on this, give it a try. can't test on earlier versions now, so no idea if the script works unchanged on 3.1 - 3.1.2 or only on 3.0.*
     
  9. nhybgtvfr

    nhybgtvfr Member

    ok. well the import doesn't work.
    the button does call the import script according to the apache logs:
    84.45.154.103 - - [21/Jun/2017:15:27:24 +0100] "POST /tools/mailbox_import.php HTTP/1.1" 200 4344 "https://cp.scl.co.uk:8080/index.php" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0"
    but none of the accounts listed in the csv file get created, and as far as i can see, no errors are being generated.
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    If I remember correctly, someone posted here in the forum an adaption for the ISPConfig 3.1 theme for that addon.
     
  11. nhybgtvfr

    nhybgtvfr Member

    cool. hopefully i can find it...
     
  12. nhybgtvfr

    nhybgtvfr Member

    i've found this, https://www.howtoforge.com/community/threads/email-mass-importation.55644/
    i'd assume from the dates though that this isn't the adaption you're referring to.


    i've been looking through the script and unless i'm completely lost, the problem is with this line:
    $tmp = $app->db->queryOneRecord('SELECT default_mailserver FROM sys_group,client WHERE sys_group.client_id = client.client_id and sys_group.groupid = '.$sys_groupid);

    the clientlist is created from sys_group, for which i have admin, with a groupid of 1 and a client_id of 0
    also for admin from sys_user:
    userid, sys_userid, sys_groupid, default_group, client_id
    1 1 0 1 0
    but there is no entry for the admin user in the client table. so the query above is always going to return an empty result.

    am i on the right lines here? or should the admin account have an entry in the client table and my install is fubared?
     

Share This Page