<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>morgan::blog</title>
	<atom:link href="http://morganjones.org/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://morganjones.org/blog</link>
	<description></description>
	<lastBuildDate>Thu, 27 Oct 2011 21:24:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Disable plain text port in CentOS DS</title>
		<link>http://morganjones.org/blog/?p=379</link>
		<comments>http://morganjones.org/blog/?p=379#comments</comments>
		<pubDate>Thu, 27 Oct 2011 21:24:27 +0000</pubDate>
		<dc:creator>morgan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://morganjones.org/blog/?p=379</guid>
		<description><![CDATA[aka: disabling Non-Secure Port. Should work the same in Redhat Directory and 389 Directory. This appears to be undocumented: Validate slapd is listening on 389: # ps -ef&#124;grep slap nobody 11206 1 0 16:00 ? 00:00:00 /usr/sbin/ns-slapd -D /etc/dirsrv/slapd-ldap0 -i /var/run/dirsrv/slapd-ldap0.pid -w /var/run/dirsrv/slapd-ldap0.startpid root 11514 11392 0 16:20 pts/1 00:00:00 grep slap # lsof -p [...]]]></description>
			<content:encoded><![CDATA[<p>aka: disabling Non-Secure Port.  Should work the same in Redhat Directory and 389 Directory.  This appears to be undocumented:</p>
<p>Validate slapd is listening on 389:<br />
<code><br />
# ps -ef|grep slap<br />
nobody   11206     1  0 16:00 ?        00:00:00 /usr/sbin/ns-slapd -D /etc/dirsrv/slapd-ldap0 -i /var/run/dirsrv/slapd-ldap0.pid -w /var/run/dirsrv/slapd-ldap0.startpid<br />
root     11514 11392  0 16:20 pts/1    00:00:00 grep slap<br />
# lsof -p 11206 |grep -i ISTEN<br />
ns-slapd 11206 nobody    6u  IPv6 23460249                TCP *:ldap (LISTEN)<br />
ns-slapd 11206 nobody    7u  IPv6 23460250                TCP *:ldaps (LISTEN)<br />
#<br />
</code></p>
<p>Make the configuration change:<br />
<code><br />
# ldapmodify -xW -D cn=directory\ manager<br />
Enter LDAP Password:<br />
dn: cn=config<br />
changetype: modify<br />
replace: nsslapd-port<br />
nsslapd-port:</p>
<p>modifying entry "cn=config"</p>
<p>#<br />
</code></p>
<p>Restart slapd:<br />
<code><br />
# service dirsrv restart<br />
Shutting down dirsrv:<br />
    ldap0...                                              [  OK  ]<br />
Starting dirsrv:<br />
    ldap0...[27/Oct/2011:16:24:16 -0400] - Information: Non-Secure Port Disabled<br />
                                                           [  OK  ]<br />
#<br />
</code></p>
<p>Validate slapd is only listening on port 636:<br />
<code><br />
# ps -ef|grep slap<br />
nobody   11570     1  0 16:24 ?        00:00:00 /usr/sbin/ns-slapd -D /etc/dirsrv/slapd-ldap0 -i /var/run/dirsrv/slapd-ldap0.pid -w /var/run/dirsrv/slapd-ldap0.startpid<br />
root     11659 11392  0 16:26 pts/1    00:00:00 grep slap<br />
# lsof -p 11570|grep LISTE<br />
ns-slapd 11570 nobody    6u  IPv6 23463024                TCP *:ldaps (LISTEN)<br />
#<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://morganjones.org/blog/?feed=rss2&#038;p=379</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Reinitialize OpenLDAP replica</title>
		<link>http://morganjones.org/blog/?p=360</link>
		<comments>http://morganjones.org/blog/?p=360#comments</comments>
		<pubDate>Wed, 31 Aug 2011 19:31:05 +0000</pubDate>
		<dc:creator>morgan</dc:creator>
				<category><![CDATA[Directory/LDAP]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Zimbra]]></category>

		<guid isPermaLink="false">http://morganjones.org/blog/?p=360</guid>
		<description><![CDATA[The paths are Zimbra specific but this should apply to OpenLDAP 2.4 or later. It was 2am when were troubleshooting but I am surprised at how little information there is on the topic. This was Zimbra 7.1.1p2 for reference. I used this as a baseline: http://wiki.zimbra.com/index.php?title=LDAP_Replicas_4.5.x_to_5.0.x This looks simpler but may be slower on a [...]]]></description>
			<content:encoded><![CDATA[<p>The paths are Zimbra specific but this should apply to OpenLDAP 2.4 or later.  It was 2am when were troubleshooting but I am surprised at how little information there is on the topic.</p>
<p>This was Zimbra 7.1.1p2 for reference.</p>
<p>I used this as a baseline:<br />
<a href="http://wiki.zimbra.com/index.php?title=LDAP_Replicas_4.5.x_to_5.0.x">http://wiki.zimbra.com/index.php?title=LDAP_Replicas_4.5.x_to_5.0.x</a></p>
<p>This looks simpler but may be slower on a large installation.  I haven&#8217;t tried it:<br />
<a href="http://www.zimbra.com/forums/installation/28199-zimbra-ldap-replication-help-existing-environment.html">http://www.zimbra.com/forums/installation/28199-zimbra-ldap-replication-help-existing-environment.html</a></p>
<p>Master:<br />
<code>
<pre>
$ /opt/zimbra/openldap/sbin/slapcat -b '' -F /opt/zimbra/data/ldap/config -l /tmp/ldap.ldif
</pre>
<p></code></p>
<p>Copy ldap.ldif to replica</p>
<p>Replica:<br />
<code></pre>
<p># su - zimbra -c "ldap stop"<br />
# cd /opt/zimbra/data/ldap<br />
# mv hdb hdb-old<br />
# mkdir -p hdb/logs/<br />
# mkdir hdb/db<br />
# cp hdb-old/db/DB_CONFIG hdb/db<br />
# chown -R zimbra:zimbra hdb<br />
# su - zimbra<br />
$ /opt/zimbra/openldap/sbin/slapadd -w -q -b '' -F /opt/zimbra/data/ldap/config -l /var/tmp/ldap.ldif<br />
*#################### 100.00% eta   none elapsed          01m11s spd   1.0 M/s<br />
Closing DB...<br />
$ ldap start<br />
</code></pre>
<p>test replication by making a change to the description field of a user's entry:<br />
<code>
<pre>
$ zmprov ma morgan@domain.org description "test of replication 8/30"
</code></pre>
<p>Use ldapsearch to make sure it was set on the consumer:<br />
<code>
<pre>
$ ldapsearch -xW -h ldap02.domain.org -D uid=zimbra,cn=admins,cn=zimbra  -Lb "" uid=morgan description
</code></pre>
<p>There are of course many reasons you might want to reinitialize replication.  In our case though it was due to this error:<br />
<code>
<pre>
Aug 30 01:35:01 ldap02 slapd[25423]: do_syncrep2: rid=100
cookie=rid=100,csn=20110829220813.829835Z#000000#000#000000
Aug 30 01:35:01 ldap02 slapd[25423]: slap_queue_csn: queing 0x1ce24180
20110829220813.829835Z#000000#000#000000
Aug 30 01:35:01 ldap02 slapd[25423]: syncrepl_message_to_op: rid=100 mods check
(zimbraMailStatus: multiple values provided)
Aug 30 01:35:01 ldap02 slapd[25423]: slap_graduate_commit_csn: removing 0x1dceba20
20110829220813.829835Z#000000#000#000000
Aug 30 01:35:01 ldap02 slapd[25423]: do_syncrepl: rid=100 rc 19 retrying
</code></pre>
<p>LDAP error 19 is a constraint violation, commonly attempting to add multiple attributes to a single valued attribute.  I had just modified zimbraMailStatus for a few users.  I checked and each of their zimbraMailStatuses had a single value so my suspicion is this is just a hiccup in replication and reinitializing cleared it.</p>
]]></content:encoded>
			<wfw:commentRss>http://morganjones.org/blog/?feed=rss2&#038;p=360</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zimbra mailboxd depends on uid rather than username</title>
		<link>http://morganjones.org/blog/?p=351</link>
		<comments>http://morganjones.org/blog/?p=351#comments</comments>
		<pubDate>Wed, 18 May 2011 15:16:49 +0000</pubDate>
		<dc:creator>morgan</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[Messaging]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Zimbra]]></category>

		<guid isPermaLink="false">http://morganjones.org/blog/?p=351</guid>
		<description><![CDATA[We&#8217;re refreshing the hardware on a moderate sized multi-server environment. I&#8217;m testing in our dev environment: install the same version of Zimbra on the target host, then: rm -rf /opt/zimbra mkdir /opt/zimbra rsync /opt/zimbra from the source host to the target host. change the hostname and ip of the target host to that of the [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;re refreshing the hardware on a moderate sized multi-server environment.  I&#8217;m testing in our dev environment:<br />
install the same version of Zimbra on the target host, then:<br />
<code>rm -rf /opt/zimbra<br />
mkdir /opt/zimbra</code><br />
rsync /opt/zimbra from the source host to the target host.<br />
change the hostname and ip of the target host to that of the source host.<br />
start zimbra</p>
<p>mailboxd started but did not log to /opt/zimbra/log/mailboxd.out<br />
but in zmmailboxd.out:</p>
<pre><code>
738  WARN  [main] log - Failed startup of context org.mortbay.jetty.webapp.WebAppContext@35ecfe07{/zimbraAdmin,/opt/zimbra/jetty-6.1.22.z6/webapps/zimbraAdmin}
java.io.FileNotFoundException: /opt/zimbra/jetty-6.1.22.z6/webapps/zimbraAdmin/WEB-INF/web.xml (Permission denied)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:106)
    at java.io.FileInputStream.<init>(FileInputStream.java:66)
    at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
...
</code></pre>
<p>This post brought the solution:</p>
<p>http://www.zimbra.com/forums/administrators/37943-jetty-webapps-not-starting-after-server-move.html</p>
<p>change the uid and gid of zimbra (/etc/passwd and /etc/shadow) to what it was on the source system, then do a global chown:<br />
<code><br />
find / -user
<old uid> -type l -exec chown -h zimbra:zimbra {} \;<br />
</code><br />
Thanks to John W. for finding the -h flag of chown.  Ownership of symbolic links apparently don&#8217;t follow that of the target file.</p>
]]></content:encoded>
			<wfw:commentRss>http://morganjones.org/blog/?feed=rss2&#038;p=351</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>zmrestore, system failure: link (&#8230;) No such file or directory</title>
		<link>http://morganjones.org/blog/?p=342</link>
		<comments>http://morganjones.org/blog/?p=342#comments</comments>
		<pubDate>Tue, 03 May 2011 21:01:32 +0000</pubDate>
		<dc:creator>morgan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://morganjones.org/blog/?p=342</guid>
		<description><![CDATA[On first host: $ zmbackup -z -f -a "user@domain.org" full-20110503.182532.238 Copy the contents of /opt/zimbra/backup/sessions/full-20110503.182532.238 and accounts.xml to /var/tmp/backup on the remote host. # chown -R zimbra:zimbra /var/tmp/backup # su - zimbra $ zmrestore -rf -t /var/tmp/backup -a user@domain.org -lb full-20110503.182532.238 Error occurred: system failure: link(/opt/zimbra/store/21/86487/msg/20/85569-182399.msg, /opt/zimbra/store/21/86487/msg/20/85569-182399.msg): No such file or directory After entirely too [...]]]></description>
			<content:encoded><![CDATA[<p>On first host:</p>
<pre><code>
$ zmbackup -z -f -a "user@domain.org"
full-20110503.182532.238
</code></pre>
<p>Copy the contents of /opt/zimbra/backup/sessions/full-20110503.182532.238 and accounts.xml to /var/tmp/backup on the remote host.  </p>
<pre><code>
# chown -R zimbra:zimbra /var/tmp/backup
# su - zimbra
$ zmrestore -rf -t /var/tmp/backup -a user@domain.org -lb full-20110503.182532.238
Error occurred: system failure: link(/opt/zimbra/store/21/86487/msg/20/85569-182399.msg,
/opt/zimbra/store/21/86487/msg/20/85569-182399.msg): No such file or directory
</code></pre>
<p>After entirely too much time troubleshooting the cause is still a mystery, however the work-around is relatively simple:</p>
<pre><code>
$ zmrestore -ca -pre restored_ -rf -t /var/tmp/backup -a user@domain.org -lb full-20110503.182532.238
$ zmprov ra restored_user@domain.org user@domain.org
</code></pre>
<p>In case you&#8217;re wondering what the use case for this would be:  I&#8217;m migrating users from a production 6.0.7 to a dev 6.0.7 wherein we&#8217;ll upgrade to 7.1 in preparation for their production upgrade.  In short: I am restoring on a different host from which I did the backup.</p>
]]></content:encoded>
			<wfw:commentRss>http://morganjones.org/blog/?feed=rss2&#038;p=342</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cyrus imapd to Zimbra via imapsync</title>
		<link>http://morganjones.org/blog/?p=325</link>
		<comments>http://morganjones.org/blog/?p=325#comments</comments>
		<pubDate>Sat, 26 Feb 2011 20:05:22 +0000</pubDate>
		<dc:creator>morgan</dc:creator>
				<category><![CDATA[Messaging]]></category>
		<category><![CDATA[Zimbra]]></category>

		<guid isPermaLink="false">http://morganjones.org/blog/?p=325</guid>
		<description><![CDATA[It seems simple enough, both servers support imap but the devil&#8217;s in the details: cyrus puts all mail under INBOX, Zimbra does not by default and cyrus uses &#8216;.&#8217; as a separator while Zimbra uses &#8216;/.&#8217; Add &#8211;delete2 if you&#8217;ve been testing for a few days on an active server and the target server has [...]]]></description>
			<content:encoded><![CDATA[<p>It seems simple enough, both servers support imap but the devil&#8217;s in the details: cyrus puts all mail under INBOX, Zimbra does not by default and cyrus uses &#8216;.&#8217; as a separator while Zimbra uses &#8216;/.&#8217;  Add &#8211;delete2 if you&#8217;ve been testing for a few days on an active server and the target server has mail that is getting stale:</p>
<pre><code>
$ imapsync --sep1 \. --prefix1 INBOX\. \
    --authmech1 PLAIN --ssl1 --host1 sourcehost.domain.org \
        --user1 morgan --password1 pass \
    --authmech2 PLAIN --ssl2 --host2 targethost.domain.org \
        --user2 morgan --password2 pass \
    --useheader Message-ID --useheader From --useheader To \
        --skipsize  --delete2
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://morganjones.org/blog/?feed=rss2&#038;p=325</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rsync and zimbra single copy message store</title>
		<link>http://morganjones.org/blog/?p=318</link>
		<comments>http://morganjones.org/blog/?p=318#comments</comments>
		<pubDate>Sat, 26 Feb 2011 19:45:21 +0000</pubDate>
		<dc:creator>morgan</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[Messaging]]></category>
		<category><![CDATA[Zimbra]]></category>

		<guid isPermaLink="false">http://morganjones.org/blog/?p=318</guid>
		<description><![CDATA[In the context of a single message store this seems obvious but it took me an hour of looking around to figure out what was going on. I needed to move several mail store partitions from one SAN volume to another and for various reasons it came down to doing it on the operating system [...]]]></description>
			<content:encoded><![CDATA[<p>In the context of a single message store this seems obvious but it took me an hour of looking around to figure out what was going on.</p>
<p>I needed to move several mail store partitions from one SAN volume to another and for various reasons it came down to doing it on the operating system level as opposed to snapshotting or similar within the san.</p>
<p>This is an extremely busy production server and we get limited downtime on it so the process will have to go like this:<br />
- rsync from the production volume to the new volume mounted in a temporary location while Zimbra is running.<br />
- stop zimbra during an outage window and re-run rsync to get messages that have been delivered since<br />
- unmount the current volume, mount the new volume and start Zimbra.</p>
<p>So we started with a small volume, a 317G secondaryMessage volume.  We created a new 500G volume, mounted it in a temporary location and started the rsync:</p>
<pre><code>
# rsync -avx --delete /opt/zimbra/store1/ /mnt/tmp
</code></pre>
<p>Nagios woke me up around 4am as the temp disk was filling.  Because Zimbra&#8217;s a single message store.  How do you verify that?</p>
<p>Cd into each of the directories and compare the sizes of the sub directories.  Find size mismatches and do an ls -1i:</p>
<pre></code>
# cd /opt/zimbra/store1/1/4139/msg/4
# ls -1i
63148652 17260-86600.msg
63148653 17262-86601.msg
63148654 17280-86700.msg
63148655 17281-86701.msg
...

# cd /mnt/tmp/1/4139/msg/4
# ls -1i
203046917 17260-86600.msg
 85590190 17262-86601.msg
207127555 17280-86700.msg
207127557 17281-86701.msg
...
</code></pre>
<p>The solution is to give rsync the -H option:</p>
<pre><code>
rsync -avxH --delete /opt/zimbra/store1/ /mnt/tmp
</code></pre>
<p>rsync will connect the hard links and disk usage will drop on the target volume.</p>
<pre><code>
...
7/30042/msg/11/47149-170909.msg => 9/38784/msg/0/261-101.msg
7/30042/msg/11/47267-171507.msg => 9/38786/msg/0/280-200.msg
7/30042/msg/11/47268-171508.msg => 9/38786/msg/0/281-201.msg
...
</code></pre>
<p>Update, 3/2/10: if you&#8217;re not using rsync 3.0 or newer you should upgrade!  Once we moved to larger filesystems (1.4tb+) rsync 2.83 spent several days collecting a file list before, we believe, eventually consuming enough memory on the system to trigger the OOM killer.</p>
]]></content:encoded>
			<wfw:commentRss>http://morganjones.org/blog/?feed=rss2&#038;p=318</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Zimbra Cross Mailbox Search</title>
		<link>http://morganjones.org/blog/?p=297</link>
		<comments>http://morganjones.org/blog/?p=297#comments</comments>
		<pubDate>Sat, 26 Feb 2011 18:52:43 +0000</pubDate>
		<dc:creator>morgan</dc:creator>
				<category><![CDATA[Messaging]]></category>
		<category><![CDATA[Zimbra]]></category>

		<guid isPermaLink="false">http://morganjones.org/blog/?p=297</guid>
		<description><![CDATA[I have a client who has long used Zimbra&#8217;s archiving feature: we set it up several versions ago and regularly use it to retrieve messages sent/received on a per-user basis for various purposes. We recently had a need to search across multiple accounts. We&#8217;ve long known that Zimbra offered a tool to do this searching [...]]]></description>
			<content:encoded><![CDATA[<p>I have a client who has long used Zimbra&#8217;s archiving feature: we set it up several versions ago and regularly use it to retrieve messages sent/received on a per-user basis for various purposes.</p>
<p>We recently had a need to search across multiple accounts.  We&#8217;ve long known that Zimbra offered a tool to do this searching but never got around to looking into it.</p>
<p>http://wiki.zimbra.com/wiki/Ajcody-Notes-Archive-Discovery-Mailstore-Setup</p>
<p>So click Tools->Search Mail in the admin interface.  Simple, yes?  In both their development and production environments we get a pop-up error like this: </p>
<p>Message: unknown document: GetXMbxSearchesListRequest Error code: service.UNKNOWN_DOCUMENT Method: GetXMboxSearchListRequest Details:soap:Sender</p>
<p>A quick look at the mailbox.log shows the archive store (mail06) is proxying to the Logger store (mail01).</p>
<p>2010-12-21 12:50:56,480 INFO  [btpool0-7://mail06.domain.org:7071/service/admin/soap/GetXMbxSearchesListRequest] [name=admin@domain.org;mid=33900;ip=10.0.0.123;ua=ZimbraWebClient - FF3.0 (Mac);] soap &#8211; GetXMbxSearchesListRequest (Proxying to ProxyTarget(url=https://mail01.domain.org:7071/service/admin/soap/GetXMbxSearchesListRequest))</p>
<p>I&#8217;m reasonably sure it&#8217;s a coincidence that it is looking to the Logger store but it is consistent in both of their environments.  Incidentally: changing zimbraLogHostname doesn&#8217;t fix the problem.</p>
<p>The only fix I&#8217;ve found is to re-run the installer and add a zimbra-archiving to the Logger host (mail01.domain.org in this example).</p>
<p>There has to be a setting that configures this.</p>
]]></content:encoded>
			<wfw:commentRss>http://morganjones.org/blog/?feed=rss2&#038;p=297</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>move user mail intra-server with imapsync</title>
		<link>http://morganjones.org/blog/?p=308</link>
		<comments>http://morganjones.org/blog/?p=308#comments</comments>
		<pubDate>Mon, 21 Feb 2011 21:30:09 +0000</pubDate>
		<dc:creator>morgan</dc:creator>
				<category><![CDATA[Messaging]]></category>
		<category><![CDATA[Zimbra]]></category>

		<guid isPermaLink="false">http://morganjones.org/blog/?p=308</guid>
		<description><![CDATA[A seemingly innocuous DNS configuration change caused all of the RBL checks in a client&#8217;s Zimbra Spamassassin to trigger mail that would have only had an X-Spam-Score of 2 or 3 to register 7+. This of course lead to legitimate mail to end up in users&#8217; Junk folders. Our Junk boxes age out in 2 [...]]]></description>
			<content:encoded><![CDATA[<p>A seemingly innocuous DNS configuration change caused all of the RBL checks in a client&#8217;s Zimbra Spamassassin  to trigger mail that would have only had an X-Spam-Score of 2 or 3 to register 7+.  This of course lead to legitimate mail to end up in users&#8217; Junk folders.</p>
<p>Our Junk boxes age out in 2 or so weeks and our user base is not in the habit of checking regularly since most SPAM is caught at the gateway and not delivered to Junk.  It was decided that the best solution for us was to just move mail delivered to Junk in the last 5 days back into users&#8217; inboxes.</p>
<p>It turns out imapsync can be easily configured to move mail intra-server and intra-account by supplying the same host and user, limiting to &#8211;folder Junk and changing &#8211;prefix1 and &#8211;prefix2.  If you have tens of thousands of accounts you may want to parallelize this but for the sake of brevity here&#8217;s a short shell script that moves all mail from the last 5 days from Junk to INBOX in a Zimbra environment:</p>
<pre><code>
#!/bin/sh
#
p=pass
au=user
h=imap.domain.org

echo starting at `date`
for u in `sudo su - zimbra -c "zmprov -l gaa"|grep -v archive|cut -d @ -f 1`; do
    echo; echo ${u}:
    c="imapsync ${1} --folder Junk --maxage 5 \
        --prefix1 Junk  --ssl1 --host1 ${h} --authuser1 ${au} --user1 ${u} --password1 ${p}\
        --prefix2 INBOX --ssl2 --host2 ${h} --authuser2 ${au} --user2 ${u} --password2 ${p}"
    echo $c
    $c
done
echo finished at `date`
</code></pre>
<p>This is Zimbra 6.0.8 but it should work in any version at least up to that:</p>
<p>&#8220;user&#8221; must be set up as a zimbra admin.  I imagine the Zimbra admin user would work.</p>
<p>This script does disclose the password on the command line so it will show up in a ps(1) output.  imapsync does include &#8211;passfile options to correct this.</p>
<p>If you&#8217;re thinking this looks handy but are overwhelmed by the idea of installing imapsync (it has a ton of dependencies) and use CentOS or Redhat I can vouch for epel&#8217;s (http://fedoraproject.org/wiki/EPEL) distribution of imapsync.  Install the epel repository and imapsync is just a &#8220;yum install imapsync&#8221; away.</p>
]]></content:encoded>
			<wfw:commentRss>http://morganjones.org/blog/?feed=rss2&#038;p=308</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>command line base64 decoding</title>
		<link>http://morganjones.org/blog/?p=301</link>
		<comments>http://morganjones.org/blog/?p=301#comments</comments>
		<pubDate>Thu, 06 Jan 2011 19:41:44 +0000</pubDate>
		<dc:creator>morgan</dc:creator>
				<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://morganjones.org/blog/?p=301</guid>
		<description><![CDATA[Based on instructions here: http://face.centosprime.com/macosxw/base64-decoding LDAP attributes are sometimes base64 encoded in ldapsearch output: postalAddress:: MTI1NCBDZW50cmFsIEF2ZS4K In OS X and presumably any system with openssl installed: $ openssl base64 -d MTI1NCBDZW50cmFsIEF2ZS4K ^d 1254 Central Ave. $ for &#8216;^d&#8217; you hold the control key and type &#8216;d.&#8217; If you&#8217;re looking for a method that does not [...]]]></description>
			<content:encoded><![CDATA[<p>Based on instructions here: <a href="http://face.centosprime.com/macosxw/base64-decoding">http://face.centosprime.com/macosxw/base64-decoding</a></p>
<p>LDAP attributes are sometimes base64 encoded in ldapsearch output:<br />
<code>postalAddress:: MTI1NCBDZW50cmFsIEF2ZS4K</code></p>
<p>In OS X and presumably any system with openssl installed:<br />
<code>$ openssl base64 -d<br />
MTI1NCBDZW50cmFsIEF2ZS4K<br />
^d<br />
1254 Central Ave.<br />
$</code><br />
for &#8216;^d&#8217; you hold the control key and type &#8216;d.&#8217;</p>
<p>If you&#8217;re looking for a method that does not involve using stdin:<br />
<code>$ echo MTI1NCBDZW50cmFsIEF2ZS4K | openssl base64 -d<br />
1254 Central Ave.<br />
$<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://morganjones.org/blog/?feed=rss2&#038;p=301</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>simple perl to remove line continuation in ldif</title>
		<link>http://morganjones.org/blog/?p=284</link>
		<comments>http://morganjones.org/blog/?p=284#comments</comments>
		<pubDate>Tue, 21 Dec 2010 19:10:16 +0000</pubDate>
		<dc:creator>morgan</dc:creator>
				<category><![CDATA[Directory/LDAP]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://morganjones.org/blog/?p=284</guid>
		<description><![CDATA[ldapsearch -xW -D cn=directory\ manager -LLLb dc=example,dc=org objectclass=\* &#124;perl -0000 -p -e '$_=~s/\n\s//; $_.="\n\n";' This is also an example of how to set the input record separator to null (with -000, the same as $/=&#8221;";) with the -p (or -n) switch. If you just want a list of DNs add &#8216;dn&#8217; to the ldapsearch and [...]]]></description>
			<content:encoded><![CDATA[<p><code><br />
ldapsearch -xW -D cn=directory\ manager -LLLb dc=example,dc=org objectclass=\* |perl -0000 -p -e '$_=~s/\n\s//; $_.="\n\n";'<br />
</code></p>
<p>This is also an example of how to set the input record separator to null (with -000, the same as $/=&#8221;";) with the -p (or -n) switch.</p>
<p>If you just want a list of DNs add &#8216;dn&#8217; to the ldapsearch and &#8216;chop&#8217; before the &#8216;s///:&#8217;<br />
<code><br />
ldapsearch -xW -D cn=directory\ manager -LLLb dc=example,dc=org objectclass=\* dn|perl -0000 -p -e 'chop; $_=~s/\n\s//'<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://morganjones.org/blog/?feed=rss2&#038;p=284</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

