Results 1 to 6 of 6

Thread: Adding external accounts from CLI

  1. #1
    kathmandu is offline Active Member
    Join Date
    Jan 2009
    Posts
    37
    Rep Power
    6

    Default Adding external accounts from CLI

    hi,

    My zimbra (5.0.11 NE) domain in ZCS will hold up to 500 accounts. I am not using zcs for mail servers but planning to use the webmail interface of zimbra beacuse for several reasons. Since zcs doesn't allow external imap server access , I am thinking to assign accounts to users using external imap account setup using CLI batch processing.

    The command that I have used assign a external imap account to a user successfully is using the following command. But the problem is after logging into the account i do not see password saved which I have provided in the command.

    Here is the command:

    --

    zmprov cds parasp@maindomainlfram.com imap XYZ zimbraDataSourceEmailAddress parasp@domain.com zimbraDataSourceEnabled TRUE zimbraDataSourceHost imap.myserver.com zimbraDataSourceUsername parasp zimbraDataSourcePassword test1234 zimbraPrefFromAddress parasp@domain.com zimbraPrefFromDisplay 'Paras Pradhan' zimbraDataSourceConnectionType ssl zimbraDataSourceFolderId 52121 zimbraDataSourcePort 993

    ---

    Also, i will be exporting account information from my non-zimbra ldap master server and use the password field to feed in the above command. so my question is which password data type (md5,ascii) does zmDataSourcePassword supprts and where do i for this info?


    Thanks in adv
    Paras.

  2. #2
    phoenix is offline Zimbra Consultant & Moderator
    Join Date
    Sep 2005
    Location
    Vannes, France
    Posts
    23,504
    Rep Power
    57

    Default

    Quote Originally Posted by kathmandu View Post
    Since zcs doesn't allow external imap server access ....
    What does that comment mean? Zimbra is an IMAP server and users can access their Zimbra accounts via IMAP clients, where's the problem with that?
    Regards


    Bill


    Acompli: A new adventure for Co-Founder KevinH.

  3. #3
    kathmandu is offline Active Member
    Join Date
    Jan 2009
    Posts
    37
    Rep Power
    6

    Default

    I am not talking about zimbra's imap server. I am taking about the external imap server or my existing imap servers.

    Paras.

  4. #4
    robert_pang@sd63.bc.ca is offline Junior Member
    Join Date
    Apr 2009
    Location
    Victoria BC Canada
    Posts
    7
    Rep Power
    6

    Default Adding external accounts from CLI

    We too are not able to import the password from the external imap server. Perhaps someone at Zimbra has a list of all the attributes for this zmprov cds command Maybe I am using the wrong one

    zmprov cds rpang@sd63.bc.ca imap 'First Class' zimbraDataSourceConnectionType cleartext zimbraDataSourceEmailAddress rpang@sd63.bc.ca zimbraDataSourceEnabled TRUE zimbraDataSourceHost fc.sd63.bc.ca zimbraDataSourceUsername rpang zimbraDataSourcePassword password zimbraPrefFromAddress rpang@sd63.bc.ca zimbraPrefFromDisplay 'Robert Pang' zimbraDataSourceFolderId 2 zimbraDataSourcePort 143

  5. #5
    akovonklap is offline Starter Member
    Join Date
    Oct 2009
    Posts
    2
    Rep Power
    5

    Question Adding external accounts from CLI zmprov cds problem

    I think there is a problem with CLI command 'zmprov cds' - I will try to explain..

    I have test box with zcs-6.0.3_GA_1915.RHEL5_64.20091118095806 installed, then i have created some test users with passwords from CLI - so far so good..

    After that I decided to connect external account to existing production imap server via Preferences > Accounts > Add External Account - it worked well..

    Now I create same thing with CLI command 'zmprov cds ...' with no error message, but problem appear. There are no folder in users web gui for external account. Preferences > Accounts are filled with correct values. In ldap zimbraDataSourceName container are created and filled with options (including zimbraDataSourcePassword), but there are no row(s) in mysql table in mboxgroup(...).data_source_name with $zimbraDataSourceId, also there are no rows in mboxgroup(...).mail_item with new $zimbraDataSourceName.

    To make things work i need to log in to the user account from web interface, go to Preferences > Accounts mark the account i have created from cli and type the password for that external account > Test Settings > Save > Mail > Get External Mail (in ldap $zimbraDataSourcePassword changes to new one).
    Only after that external mail appear and mysql tables are filled right...

    Is this bug or feature?

  6. #6
    akovonklap is offline Starter Member
    Join Date
    Oct 2009
    Posts
    2
    Rep Power
    5

    Smile Script to add external accounts from CLI

    Hello again,
    thanks to guys at Zimbra for providing some help to figure all the missing things out. First of all you need zimbraDataSourceFolderId value. You can get it by executing something like this:
    Code:
    ~]$ zmmailbox -z -m "$email" createFolder -F u /"$exmserv"`
    $email is email and $exmserv is external mail server URL (as folder name). This will create folder and return folder id.
    To add bulk external accounts from CLI I wrote quick and dirty bash script. There is also requirement for userlist.txt - csv file with following fields:
    Code:
    email,password,display name,givenname,secondname
    This script reads file line by line, splits line into fields then creates folder and adds external account to it. If you want to use this script then correct it to your needs e.g. change or add mail server, add SSL support, change user name etc.

    Code:
    #!/bin/bash
    #addexmail.sh script by akovonklap (c). Add external accounts from CLI
    exec 3< userlist.txt
    while read <&3
    do
    email=`echo "$REPLY"| awk -F, '{print $1}'`
    passwd=`echo "$REPLY"| awk -F, '{print $2}'`
    dispname=`echo "$REPLY"| awk -F, '{print $3}'`
    gname=`echo "$REPLY"| awk -F, '{print $4}'`
    sn=`echo "$REPLY"| awk -F, '{print $5}'`
    exmserv="mail.example.com" #External mail server
    user=`echo "$email"|awk -F@ '{print $1}'`
    zmmailbox -z -m "$email" createFolder -F u /"$exmserv" > /tmp/$exmserv".txt"
    foldid=`cat /tmp/$exmserv".txt"`
    
    zmprov cds "$email" imap "$exmserv" \
             objectClass zimbraDataSource \
             objectClass zimbraImapDataSource \
             zimbraPrefFromDisplay "$dispname" \
             zimbraPrefReplyToDisplay "$dispname" \
             zimbraDataSourceName "$exmserv" \
             zimbraDataSourceFolderId "$foldid" \
             zimbraDataSourceType imap \
             zimbraDataSourceConnectionType cleartext \
             zimbraDataSourceEnabled TRUE \
             zimbraDataSourceUseAddressForForwardReply TRUE \
             zimbraDataSourceHost "$exmserv" \
             zimbraDataSourceUsername "$user" \
             zimbraDataSourcePassword "$passwd" \
             zimbraPrefFromAddress "$email" \
             zimbraDataSourceEmailAddress "$email" \
             zimbraPrefReplyToAddress "$email" \
             zimbraDataSourcePollingInterval 9m \
             zimbraDataSourcePort 143 \
    done
    rm -f /tmp/$exmserv".txt"
    exit 0
    I Hope this will help to someone..

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. migrate20070809-Signatures.pl?
    By j.mc in forum Installation
    Replies: 4
    Last Post: 06-11-2008, 09:52 AM
  2. Replies: 13
    Last Post: 07-20-2007, 03:21 AM
  3. Is it started or not
    By kwelipatton in forum Installation
    Replies: 10
    Last Post: 03-28-2006, 11:11 PM
  4. Replies: 13
    Last Post: 10-31-2005, 04:22 PM
  5. Replies: 18
    Last Post: 10-30-2005, 09:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •