Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Administrators

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-26-2009, 03:37 PM
Active Member
 
Posts: 37
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.
Reply With Quote
  #2 (permalink)  
Old 01-26-2009, 11:26 PM
Zimbra Consultant & Moderator
 
Posts: 20,312
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
Reply With Quote
  #3 (permalink)  
Old 01-27-2009, 07:30 AM
Active Member
 
Posts: 37
Default

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

Paras.
Reply With Quote
  #4 (permalink)  
Old 04-15-2009, 01:48 PM
Junior Member
 
Posts: 7
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
Reply With Quote
  #5 (permalink)  
Old 12-14-2009, 02:48 AM
Starter Member
 
Posts: 2
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?
Reply With Quote
  #6 (permalink)  
Old 01-19-2010, 07:08 AM
Starter Member
 
Posts: 2
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..
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.