<?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>IT CAFFE . NET</title>
	<atom:link href="http://itcaffe.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://itcaffe.net</link>
	<description>IT solutions over a cup of coffee</description>
	<lastBuildDate>Sun, 15 Apr 2012 19:37:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>Restrict SSH to certain IPs</title>
		<link>http://itcaffe.net/uncategorized/restrict-ssh-to-certain-ips/</link>
		<comments>http://itcaffe.net/uncategorized/restrict-ssh-to-certain-ips/#comments</comments>
		<pubDate>Sun, 15 Apr 2012 19:37:27 +0000</pubDate>
		<dc:creator>Valkyrka</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://itcaffe.net/?p=470</guid>
		<description><![CDATA[Here&#039;s how you can restrict SSH only to a couple of IPs : iptables -A INPUT -p tcp &#8211;dport 22 -s 1.1.1.1 -j ACCEPT iptables -A INPUT -p tcp &#8211;dport 22 -s 2.2.2.2 -j ACCEPT iptables -A INPUT -p tcp &#8211;dport 22 -j DROP This will only allow access to SSH from IPs 1.1.1.1 and [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#039;s how you can restrict SSH only to a couple of IPs :</p>
<p>iptables -A INPUT -p tcp &#8211;dport 22 -s 1.1.1.1 -j ACCEPT<br />
iptables -A INPUT -p tcp &#8211;dport 22 -s 2.2.2.2 -j ACCEPT<br />
iptables -A INPUT -p tcp &#8211;dport 22 -j DROP</p>
<p>This will only allow access to SSH from IPs 1.1.1.1 and 2.2.2.2. If you&#039;re using a custom SSH port, make sure you adjust the rule for that port.</p>
<p>HTH.</p>
]]></content:encoded>
			<wfw:commentRss>http://itcaffe.net/uncategorized/restrict-ssh-to-certain-ips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading PHP to 5.2.x on CentOS 5</title>
		<link>http://itcaffe.net/apache/upgrading-php-to-5-2-x-on-centos-5/</link>
		<comments>http://itcaffe.net/apache/upgrading-php-to-5-2-x-on-centos-5/#comments</comments>
		<pubDate>Sun, 15 Apr 2012 19:30:28 +0000</pubDate>
		<dc:creator>Valkyrka</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[tips & tricks]]></category>

		<guid isPermaLink="false">http://itcaffe.net/?p=466</guid>
		<description><![CDATA[CentOS 5 comes by default with PHP version 5.1.6 and MySQL 5.0. Here&#039;s how you can upgrade to version 5.2.17 using a 3rd party repo. I have been using the Atomic repository for a while now and the RPMs are well built : echo &#034;exclude=php*5.3*&#034; >> /etc/yum.conf rpm -ivh http://www6.atomicorp.com/channels/atomic/centos/5/i386/RPMS/atomic-r$ yum update php* mysql* -y [...]]]></description>
			<content:encoded><![CDATA[<p>CentOS 5 comes by default with PHP version 5.1.6 and MySQL 5.0. Here&#039;s how you can upgrade to version 5.2.17 using a 3rd party repo. I have been using the Atomic repository for a while now and the RPMs are well built :</p>
<p>echo &#034;exclude=php*5.3*&#034; >> /etc/yum.conf<br />
rpm -ivh http://www6.atomicorp.com/channels/atomic/centos/5/i386/RPMS/atomic-r$<br />
yum update php* mysql* -y</p>
<p>At the moment, you&#039;d get PHP version 5.2.17 and MySQL 5.5. If you want to upgrade to PHP 5.3.10, you&#039;d skip running the following command from above :</p>
<p>echo &#034;exclude=php*5.3*&#034; >> /etc/yum.conf</p>
<p>If you don&#039;t want to install MySQL 5.5, you can add the following line to /etc/yum.conf :</p>
<p>exclude=mysql*5.5*</p>
<p>If you are upgrading MySQL, don&#039;t forget to run the following :</p>
<p>mysql_upgrade -uroot -p</p>
<p>HTH <img src='http://itcaffe.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://itcaffe.net/apache/upgrading-php-to-5-2-x-on-centos-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing PHP Fatal error: Class &#039;OptionalServices_ServicesConfiguration&#039; Plesk error</title>
		<link>http://itcaffe.net/plesk/fixing-php-fatal-error-class-optionalservices_servicesconfiguration-plesk-error/</link>
		<comments>http://itcaffe.net/plesk/fixing-php-fatal-error-class-optionalservices_servicesconfiguration-plesk-error/#comments</comments>
		<pubDate>Mon, 14 Nov 2011 16:21:35 +0000</pubDate>
		<dc:creator>Valkyrka</dc:creator>
				<category><![CDATA[plesk]]></category>

		<guid isPermaLink="false">http://itcaffe.net/?p=461</guid>
		<description><![CDATA[A client got an email this morning with the following content from the Plesk cron daemon : /usr/local/psa/libexec/modules/watchdog/cp/send-report weekly PHP Fatal error: Class &#039;OptionalServices_ServicesConfiguration&#039; not found in /usr/local/psa/admin/plib/common_func.php3 on line 2948 Apparently, Plesk already released a fix for this and the fix can be seen at http://kb.parallels.com/en/9329. The thing is, the attachment is double-zipped so [...]]]></description>
			<content:encoded><![CDATA[<p>A client got an email this morning with the following content from the Plesk cron daemon :</p>
<p>/usr/local/psa/libexec/modules/watchdog/cp/send-report weekly<br />
PHP Fatal error: Class &#039;OptionalServices_ServicesConfiguration&#039; not found<br />
in /usr/local/psa/admin/plib/common_func.php3 on line 2948 </p>
<p>Apparently, Plesk already released a fix for this and the fix can be seen at http://kb.parallels.com/en/9329. The thing is, the attachment is double-zipped so here&#039;s how you&#039;d apply the fix :</p>
<p>gunzip send-report.gz<br />
mv send-report send-report.gz<br />
gunzip send-report.gz<br />
cp /usr/local/psa/libexec/modules/watchdog/cp/send-report /usr/local/psa/libexec/modules/watchdog/cp/send-report.backup<br />
mv send-report /usr/local/psa/libexec/modules/watchdog/cp/send-report<br />
chmod 754 /usr/local/psa/libexec/modules/watchdog/cp/send-report</p>
<p>Good luck <img src='http://itcaffe.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://itcaffe.net/plesk/fixing-php-fatal-error-class-optionalservices_servicesconfiguration-plesk-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find broken symlinks</title>
		<link>http://itcaffe.net/bash/find-broken-symlinks/</link>
		<comments>http://itcaffe.net/bash/find-broken-symlinks/#comments</comments>
		<pubDate>Wed, 24 Nov 2010 02:36:23 +0000</pubDate>
		<dc:creator>Valkyrka</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://itcaffe.net/?p=455</guid>
		<description><![CDATA[Often times you may find that your directories contain broken symlinks ( symlinks from folders which have been deleted ). In order to find broken symlinks, the following should help : find -L /home/user/public_html -type l]]></description>
			<content:encoded><![CDATA[<p>Often times you may find that your directories contain broken symlinks ( symlinks from folders which have been deleted ). In order to find broken symlinks, the following should help :</p>
<p>find -L /home/user/public_html -type l</p>
]]></content:encoded>
			<wfw:commentRss>http://itcaffe.net/bash/find-broken-symlinks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sort files in current directory by modification time</title>
		<link>http://itcaffe.net/bash/sort-files-in-current-directory-by-modification-time/</link>
		<comments>http://itcaffe.net/bash/sort-files-in-current-directory-by-modification-time/#comments</comments>
		<pubDate>Sun, 30 May 2010 17:23:38 +0000</pubDate>
		<dc:creator>Valkyrka</dc:creator>
				<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://itcaffe.net/?p=450</guid>
		<description><![CDATA[This is how you can list all the files in the current directory, sorting them by modification time :]]></description>
			<content:encoded><![CDATA[<p>This is how you can list all the files in the current directory, sorting them by modification time :</p>
<pre class="brush: bash; title: ; notranslate">
find . -type f | xargs ls -ltrhg
</pre>
]]></content:encoded>
			<wfw:commentRss>http://itcaffe.net/bash/sort-files-in-current-directory-by-modification-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check the validity of your ssl certificates</title>
		<link>http://itcaffe.net/bash/check-the-validity-of-your-ssl-certificates/</link>
		<comments>http://itcaffe.net/bash/check-the-validity-of-your-ssl-certificates/#comments</comments>
		<pubDate>Thu, 27 May 2010 13:08:56 +0000</pubDate>
		<dc:creator>BritishSongWriter</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cyrus]]></category>
		<category><![CDATA[dovecot]]></category>
		<category><![CDATA[postfix]]></category>

		<guid isPermaLink="false">http://itcaffe.net/?p=441</guid>
		<description><![CDATA[With this command you can check the validity period of your generated certificates (apache, postfix, dovecot, cyrus, etc ). Example: Encrypted certificate Content of the certificate decrypted:]]></description>
			<content:encoded><![CDATA[<p>With this command you can check the validity period of your generated certificates (apache, postfix, dovecot, cyrus, etc ).</p>
<pre class="brush: bash; title: ; notranslate">openssl x509 -in &lt;certificate.name&gt;.crt -noout -text</pre>
<h5>Example:</h5>
<p><strong>Encrypted certificate</strong></p>
<pre class="brush: bash; title: ; notranslate">
cat /etc/ssl/postfix/server.crt
-----BEGIN CERTIFICATE-----
MIIC1DCCAj2gAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBrzELMAkGA1UEBhMCVVMx
EzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbnRhIEJhcmJhcmExHDAa
BgNVBAoTE1Bvc3RmaXggU01UUCBTZXJ2ZXIxIjAgBgNVBAsTGUZvciBUZXN0aW5n
IFB1cnBvc2VzIE9ubHkxEjAQBgNVBAMTCWxvY2FsaG9zdDEdMBsGCSqGSIb3DQEJ
ARYOcm9vdEBsb2NhbGhvc3QwHhcNMDkwOTE4MTQxMjI5WhcNMTEwOTE4MTQxMjI5
WjCBrzELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcT
DVNhbnRhIEJhcmJhcmExHDAaBgNVBAoTE1Bvc3RmaXggU01UUCBTZXJ2ZXIxIjAg
BgNVBAsTGUZvciBUZXN0aW5nIFB1cnBvc2VzIE9ubHkxEjAQBgNVBAMTCWxvY2Fs
aG9zdDEdMBsGCSqGSIb3DQEJARYOcm9vdEBsb2NhbGhvc3QwgZ8wDQYJKoZIhvcN
AQEBBQADgY0AMIGJAoGBAO8K8RKNDh+YZWWzTMozD94ThTYUheEiXuwY0t3AjuG+
BoftdCQLxDrxEDukNH6DPLFhHvW7GSjAd3iuTmuYbz39vR0PgfLfaNAj5Bn478DA
EL3+bK/ktomOlRJWgfS7MjDXH2qkO+HwZj5mDAGsS8sLvrQcKab0Ez+NIRZ/toEt
AgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAokQHek3DBBupTZCw1pMiPxdHZPlTTqRj
7OzahdcyhoruUVs15AzhhHB50ZYoILZWeBJ6h7Xxk/jPSm46JvSII2/bUj5ze2H7
qeNN/tll5cS+0ImjGRKgv081HIDIlYxvsrsgijfOE3EHMtgfo0olXemzHBhm/L2u
RJrOYK2it1c=
-----END CERTIFICATE-----</pre>
<p><strong>Content of the certificate decrypted:</strong></p>
<pre class="brush: bash; title: ; notranslate">
# openssl x509 -in /etc/ssl/postfix/server.crt -noout -text
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 2 (0x2)
        Signature Algorithm: sha1WithRSAEncryption
        Issuer: C=US, ST=California, L=Santa Barbara, O=Postfix SMTP Server, OU=For Testing Purposes Only, CN=localhost/emailAddress=root@localhost
        Validity
            Not Before: Sep 18 14:12:29 2009 GMT
            Not After : Sep 18 14:12:29 2011 GMT
        Subject: C=US, ST=California, L=Santa Barbara, O=Postfix SMTP Server, OU=For Testing Purposes Only, CN=localhost/emailAddress=root@localhost
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
            RSA Public Key: (1024 bit)
                Modulus (1024 bit):
                    00:ef:0a:f1:12:8d:0e:1f:98:65:65:b3:4c:ca:33:
                    0f:de:13:85:36:14:85:e1:22:5e:ec:18:d2:dd:c0:
                    8e:e1:be:06:87:ed:74:24:0b:c4:3a:f1:10:3b:a4:
                    34:7e:83:3c:b1:61:1e:f5:bb:19:28:c0:77:78:ae:
                    4e:6b:98:6f:3d:fd:bd:1d:0f:81:f2:df:68:d0:23:
                    e4:19:f8:ef:c0:c0:10:bd:fe:6c:af:e4:b6:89:8e:
                    95:12:56:81:f4:bb:32:30:d7:1f:6a:a4:3b:e1:f0:
                    66:3e:66:0c:01:ac:4b:cb:0b:be:b4:1c:29:a6:f4:
                    13:3f:8d:21:16:7f:b6:81:2d
                Exponent: 65537 (0x10001)
    Signature Algorithm: sha1WithRSAEncryption
        a2:44:07:7a:4d:c3:04:1b:a9:4d:90:b0:d6:93:22:3f:17:47:
        64:f9:53:4e:a4:63:ec:ec:da:85:d7:32:86:8a:ee:51:5b:35:
        e4:0c:e1:84:70:79:d1:96:28:20:b6:56:78:12:7a:87:b5:f1:
        93:f8:cf:4a:6e:3a:26:f4:88:23:6f:db:52:3e:73:7b:61:fb:
        a9:e3:4d:fe:d9:65:e5:c4:be:d0:89:a3:19:12:a0:bf:4f:35:
        1c:80:c8:95:8c:6f:b2:bb:20:8a:37:ce:13:71:07:32:d8:1f:
        a3:4a:25:5d:e9:b3:1c:18:66:fc:bd:ae:44:9a:ce:60:ad:a2:
        b7:57
</pre>
]]></content:encoded>
			<wfw:commentRss>http://itcaffe.net/bash/check-the-validity-of-your-ssl-certificates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Password protect web directories</title>
		<link>http://itcaffe.net/apache/password-protect-web-directories/</link>
		<comments>http://itcaffe.net/apache/password-protect-web-directories/#comments</comments>
		<pubDate>Sun, 23 May 2010 09:12:42 +0000</pubDate>
		<dc:creator>Valkyrka</dc:creator>
				<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">http://itcaffe.net/?p=436</guid>
		<description><![CDATA[Here is how you can password protect web directories using Apache. First, you would need to make sure that Apache allows the use of .htaccess. This can be simply done by changing the following directive : As you can see, mine is already set to &#039;All&#039;. After you have set AllowOverride to All, reload Apache [...]]]></description>
			<content:encoded><![CDATA[<p>Here is how you can password protect web directories using Apache. First, you would need to make sure that Apache allows the use of .htaccess. This can be simply done by changing the following directive :</p>
<pre class="brush: bash; title: ; notranslate">
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be &quot;All&quot;, &quot;None&quot;, or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
    AllowOverride All
</pre>
<p>As you can see, mine is already set to &#039;All&#039;. After you have set AllowOverride to All, reload Apache in order for the new changes to be picked up :</p>
<pre class="brush: bash; title: ; notranslate">
/etc/init.d/httpd reload
</pre>
<p>Secondly, you would need to make sure that you have the following modules loaded in your Apache configuration :<br />
<a href="http://httpd.apache.org/docs/2.1/mod/mod_auth_basic.html">mod_auth_basic</a><br />
<a href="http://httpd.apache.org/docs/2.1/mod/mod_authn_file.html">mod_authn_file</a></p>
<p>You can do so by typing the following command :</p>
<pre class="brush: bash; title: ; notranslate">
httpd -t -D DUMP_MODULES
</pre>
<p>Sample output :</p>
<pre class="brush: bash; title: ; notranslate">
# httpd -t -D DUMP_MODULES | grep auth_basic_module
Loaded Modules:
 core_module (static)
 mpm_prefork_module (static)
 http_module (static)
 so_module (static)
 auth_basic_module (shared)
 auth_digest_module (shared)
 authn_file_module (shared)
 authn_alias_module (shared)
 authn_anon_module (shared)
 authn_dbm_module (shared)
 authn_default_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 authz_owner_module (shared)
 authz_groupfile_module (shared)
 authz_dbm_module (shared)
 authz_default_module (shared)
 ldap_module (shared)
 authnz_ldap_module (shared)
 include_module (shared)
 log_config_module (shared)
 logio_module (shared)
 env_module (shared)
 ext_filter_module (shared)
 mime_magic_module (shared)
 expires_module (shared)
 deflate_module (shared)
 headers_module (shared)
 usertrack_module (shared)
 setenvif_module (shared)
 mime_module (shared)
 dav_module (shared)
 status_module (shared)
 autoindex_module (shared)
 info_module (shared)
 dav_fs_module (shared)
 vhost_alias_module (shared)
 negotiation_module (shared)
 dir_module (shared)
 actions_module (shared)
 speling_module (shared)
 userdir_module (shared)
 alias_module (shared)
 rewrite_module (shared)
 proxy_module (shared)
 proxy_balancer_module (shared)
 proxy_ftp_module (shared)
 proxy_http_module (shared)
 proxy_connect_module (shared)
 cache_module (shared)
 suexec_module (shared)
 disk_cache_module (shared)
 file_cache_module (shared)
 mem_cache_module (shared)
 cgi_module (shared)
 version_module (shared)
 fcgid_module (shared)
 limitipconn_module (shared)
 log_post_module (shared)
 evasive20_module (shared)
 mono_module (shared)
 perl_module (shared)
 php5_module (shared)
 proxy_ajp_module (shared)
 python_module (shared)
 ssl_module (shared)
Syntax OK
</pre>
<p>As you can see, the modules are loaded on my server.</p>
<p>Let&#039;s say that you have a directory viewable via web &#8211; /var/www/html/website/admin. First, we create a .htaccess file in /var/www/html/website/admin with the following content :</p>
<pre class="brush: bash; title: ; notranslate">
AuthUserFile /home/valkyrka/.htpasswd
AuthName EnterPassword
AuthType Basic
require valid-user
</pre>
<p>We will then need to create users and setup a password for them. They must be created in the .htpasswd file as this was used in the AuthUserFile directive :</p>
<pre class="brush: bash; title: ; notranslate">
# htpasswd -c /home/valkyrka/.htpasswd admin
New password:
Re-type new password:
Adding password for user admin
</pre>
<p>The -c option will create the .htpasswd file and must only be used for the first time creating a user. Afterwards, simply create users using the following command :</p>
<pre class="brush: bash; title: ; notranslate">
# htpasswd /home/valkyrka/.htpasswd valkyrka
New password:
Re-type new password:
Adding password for user valkyrka
</pre>
<p>Here is the content of my .htpasswd file :</p>
<pre class="brush: bash; title: ; notranslate">
 # cat /home/valkyrka/.htpasswd
admin:dTTsGDkA5ZHKg
valkyrka:HpLHf68KTZSCs
</pre>
<p>After you have followed these steps, you should be able to see a login prompt while trying to access the &#039;admin&#039; directory over the web.</p>
]]></content:encoded>
			<wfw:commentRss>http://itcaffe.net/apache/password-protect-web-directories/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cyrus 2 Dovecot mail stack migration</title>
		<link>http://itcaffe.net/email/cyrus/cyrus-2-dovecot-mail-stack-migration/</link>
		<comments>http://itcaffe.net/email/cyrus/cyrus-2-dovecot-mail-stack-migration/#comments</comments>
		<pubDate>Thu, 20 May 2010 21:14:26 +0000</pubDate>
		<dc:creator>BritishSongWriter</dc:creator>
				<category><![CDATA[cyrus]]></category>
		<category><![CDATA[dovecot]]></category>

		<guid isPermaLink="false">http://itcaffe.net/?p=352</guid>
		<description><![CDATA[Motto : I hate the DOTS !!! Cyrus 2 Dovecot Migration In our organization, we have an internal application using a mysql database structure. We also have some linux boxes with squid and postfix/cyrus MTA/POP-IMAP-MDA using their own databases. So, you can imagine the mess caused by these applications having separate ways to store the [...]]]></description>
			<content:encoded><![CDATA[<h5>Motto : I hate the DOTS !!!</h5>
<p><strong>Cyrus 2 Dovecot Migration</strong></p>
<p>In our organization, we have an internal application using a mysql database structure.<br />
We also have some linux boxes with squid and postfix/cyrus MTA/POP-IMAP-MDA using their own databases.<br />
So, you can imagine the mess caused by these applications having separate ways to store the user/password fields.<br />
You can take the following example: a new user is created, he&#039;s got only an email account. Some time afterwards, the guy is transferred to another department and he needs to work with the internal application and also needs a squid proxy account. The password is generated, and for easy remembering the password is the same for both. After some time, the user is changing his application password, the PC gets a fresh install of the OS, user doesn&#039;t remember the password for the email account, we don&#039;t know his password, being encrypted. And guess who is going to sort all the things out &#8230;</p>
<p>This it&#039;s gonna stop! I said to myself. How ?</p>
<p>And the solution is &#8230; going full to mysql \:D/.</p>
<p>I&#039;m not covering in this post how I did it with the proxy server,  it&#039;s fairly simple.</p>
<p>Our current configuration of the mail server is using postfix as the MTA and Cyrus as the IMAP/POP3 server. After some time searching for solutions as how to make Cyrus to use MySQL database format, we concluded that this is not feasible or is too difficult to implement, as Cyrus does not natively support authentication from a mysql database.<br />
We had no alternative but to migrate from Cyrus to Dovecot. We considered this migration as an upgrade to the current setup, since Dovecot is a more featured POP3/IMAP server than Cyrus, ultimately having a mail delivery agent (LDA) and our most wanted mysql native support.</p>
<p>Searching the .net for scripts that can do the trick, converting from Cyrus mailbox format to Dovecot maildir++ format I found the following:</p>
<p>1. <a href="http://cyrus2dovecot.sw.fu-berlin.de/download.html" target="_blank">cyrus2dovecot</a> (by Freie Universität Berlin) allows you to perform a server transition which is fully transparent to both POP and IMAP users, as virtually all available metadata is preserved during the conversion. This includes message UIDs, INTERNALDATEs, IMAP folder subscriptions, the UIDVALIDITY and UIDNEXT values for each folder, as well as all IMAP flags (including the first 26 user-defined keywords). Cyrus2Dovecot is supposed to work with all Cyrus releases up to (at least) version 2.3.x. So far, it has been tested with Cyrus 1.4, 2.1.18, 2.2.12, and 2.3.12p2</p>
<p>2. <a href="http://www.madness.at/blog/projects/cyrus2courier.html" target="_blank">cyrus2courier</a> is Dovecot-compatible. A non-official v1.6ts release works up to Cyrus v2.3.9. It should be able to preserve message UIDs, INTERNALDATEs, flags and the first 26 keywords. It works only with the supported Cyrus versions, so if Cyrus once again changes its internal formats this tool might break again.</p>
<p>3. <a href="http://majid.info/blog/migrating-from-cyrus-to-dovecot/" target="_blank">cyrus2maildir.py</a> (for Cyrus v2.2) preserves (only) INTERNALDATEs and \Seen flags.</p>
<p>4. <a href="http://trukenmueller.de/cyrus2dovecot" target="_blank">cyrus2dovecot </a>(by Trukenmüller) doesn&#039;t preserve timestamps or flags.</p>
<p>I&#039;ve tested all of them, but neither of these can do the things flawlessly.<br />
The most complete and efficient script is <strong>cyrus2dovecot</strong> by Freie Universität Berlin. BUT, it has a BUG.</p>
<p>All of our email addresses are in this form: firstname.lastname@domain.com &#8211; and the BUG comes from the dot &#8211; yeah, that little thing.</p>
<p>Cyrus transparently replaces any &#034;.&#034; character in folder names with a &#034;^&#034; character so although the account name is firstname.lastname , the mail directory will be firstname^lastname. This includes even the folders or subfolders created by users.</p>
<p>So &#8230;</p>
<h5>Cyrus:</h5>
<p>- maildir location : /var/spool/imap<br />
- .sub (subscription) and .seen (read/new) files : /var/imap/user</p>
<p>Put all the files needed for conversion in the same directory <strong> /home/migration</strong></p>
<pre class="brush: bash; title: ; notranslate">
mkdir /home/migration
mkdir /home/migration/dovecot
cp -a /var/spool/imap /home/migration
cp -a /var/imap/user /home/migration
</pre>
<p>Download the conversion script:</p>
<pre class="brush: bash; title: ; notranslate">cd /home/migration
wget http://www.cyrus2dovecot.sw.fu-berlin.de/download/cyrus2dovecot
</pre>
<p>Now, you probably want to run the script, move the result to dovecot maildir and start dovecot to see if it works. It should be that simple, but not in my case, remember the dot(.) ? Watch this :</p>
<pre class="brush: bash; title: ; notranslate">./cyrus2dovecot --cyrus-inbox /home/migration/imap/%h/user/%u --cyrus-seen /home/migration/user/%h/%u.seen --cyrus-sub /home/migration/user/%h/%u.sub --dovecot-inbox /home/migration/dovecot/%u british.songwriter</pre>
<p><strong>Result:</strong></p>
<pre class="brush: bash; title: ; notranslate">#cyrus2dovecot [british.songwriter]: (error) No Cyrus INBOX at: /home/migration/imap/a/user/british.songwriter</pre>
<p>Hmmm &#8230; this was expected as the argument containing the user which should be written at the end of the script is not actually the username, but the mailbox name, in this case &#8211; british^songwriter.</p>
<p>&#8230; and the correct syntax (see <a href="http://www.cyrus2dovecot.sw.fu-berlin.de/documentation.html">documentation</a> page):</p>
<pre class="brush: bash; title: ; notranslate">./cyrus2dovecot --cyrus-inbox /home/migration/imap/%h/user/%u --cyrus-seen /home/migration/user/%h/%u.seen --cyrus-sub /home/migration/user/%h/%u.sub --dovecot-inbox /home/migration/dovecot/%u british^songwriter</pre>
<p><strong>Result:</strong></p>
<pre class="brush: bash; title: ; notranslate"># cyrus2dovecot [british^songwriter]: (error) Cannot open /home/migration/imap/a/user/british^songwriter//home/migration/imap/a/user/british^songwriter/INBOX^Sent/1.: No such file or directory</pre>
<p>Even with debug on, it doesn&#039;t output any error that might help. The evident cause for spitting this error is that the script is trying to concatenate the paths from cyrus-mailbox argument and the path for the subfolders.<br />
Although I have some knowledge of perl, I didn&#039;t waste time finding the broken chunk of code trying some repairs. I searched for a quick solution and I found out that all I got to do is to rename mailboxes, subscription and .seen file names from british^songwriter to british.songwriter.</p>
<h5>Renaming</h5>
<p><strong>Renaming folders and files</strong><br />
Dry test run (see what will be renamed):</p>
<pre class="brush: bash; title: ; notranslate">for i in `find /home/migration -maxdepth 4 -name *^*` ; do echo &quot;$i&quot; &quot;-&gt;&quot; &quot;`echo $i | sed -e 's/\^/\./g'`&quot; ; done</pre>
<p>Actual renaming:</p>
<pre class="brush: bash; title: ; notranslate">for i in `find /home/migration -maxdepth 4 -name *^*` ; do mv &quot;$i&quot; &quot;`echo $i | sed -e 's/\^/\./g'`&quot; ; done</pre>
<p>I&#039;ve set maximum depth for a reason. Some users might have subfolders that contains dots (like a date &#8211; 12.23.2010). Default dovecot behaviour, if not otherwise specified, is to use Maildir++ folder format, meaning that all folders and subfolders are stored in main mailbox.</p>
<p><strong>Example:</strong><br />
cur &#8211; readed emails<br />
new &#8211; new emails (unreaded)<br />
tmp &#8211; temporary folder<br />
.directory<br />
.directory.another-folder &#8211; a subdirectory of directory<br />
.directory.another-folder.my-folder &#8211; a subdirectory of another-folder<br />
.directory.another-folder.pictures &#8211; a subdirectory of another-folder</p>
<p>You got the point. Also, in this setup, using dots in folder names is illegal, which is frustrating nonetheless.<br />
So I chose FS in dovecot mailbox format (that is using / in folders tree &#8211; Maildir/sub/folder).<br />
Doing so, you must rename folders during conversion adding</p>
<pre class="brush: bash; title: ; notranslate">--edit-foldernames 's/^\.//' --edit-foldernames 's/\./\//g'</pre>
<p> as script execution argument.<br />
If maximum depth in previous command was bigger, default cyrus folders like INBOX.Sent, INBOX.Trash will be tranformed in such way that Sent and Trash will be subdirectories of INBOX, and we don&#039;t want that.<br />
If users already possess directories with dots in them, you must delete the dots from the names before script execution.</p>
<p>We&#039;re using postfix&#039;s canonical maps for email accounts, so through a chain of commands, I can get all of our active accounts, passing these as a script argument.</p>
<pre class="brush: bash; title: ; notranslate">./cyrus2dovecot --cyrus-inbox /home/migration/imap/%h/user/%u --cyrus-seen /home/migration/user/%h/%u.seen --cyrus-sub /home/migration/user/%h/%u.sub --dovecot-inbox /home/migration/dovecot/%u --edit-foldernames 's/^\.//' --edit-foldernames 's/\./\//g' `grep -v &quot;#&quot; /etc/postfix/canonical| awk '{print $1}' |sort -r|cut -d &quot;@&quot; -f 1|tr '\n' ' '`</pre>
<p>Another problem encountered after conversion is that all .sub files contained &#034;^&#034; character in folder names.<br />
One solution is to edit subscribed folder names before running the script by issuing:</p>
<pre class="brush: bash; title: ; notranslate">for i in `find /home/migration/user -maxdepth 2 -name *.sub`; do cat &quot;$i&quot;|sed -e 's/\^/\./g' &gt; `echo &quot;$i&quot;` ; done</pre>
<p>Another one, after execution of the script, but subscribing all existing folders:</p>
<pre class="brush: bash; title: ; notranslate">for i in `grep -v &quot;#&quot; /etc/postfix/canonical| awk '{print $1}' |sort -r|cut -d &quot;@&quot; -f 1` ; do find /home/migration/dovecot/$i -type d |egrep -v '(cur|tmp|new)'|cut -d &quot;/&quot; -f 5,6,7 &gt; /home/migration/dovecot/$i/subscriptions ; done</pre>
<p>Enjoy migrating your email accounts!</p>
]]></content:encoded>
			<wfw:commentRss>http://itcaffe.net/email/cyrus/cyrus-2-dovecot-mail-stack-migration/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Print the IPs which have more than 1000 hits</title>
		<link>http://itcaffe.net/bash/print-the-ips-which-have-more-than-1000-hits/</link>
		<comments>http://itcaffe.net/bash/print-the-ips-which-have-more-than-1000-hits/#comments</comments>
		<pubDate>Tue, 11 May 2010 19:11:43 +0000</pubDate>
		<dc:creator>Valkyrka</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://itcaffe.net/?p=395</guid>
		<description><![CDATA[Here is how you can print the IPs ( fetched from the access_log of Apache ) which have more than 1000 hits : Additionally, you can change 1000 to your desired value.]]></description>
			<content:encoded><![CDATA[<p>Here is how you can print the IPs ( fetched from the access_log of Apache ) which have more than 1000 hits :</p>
<pre class="brush: bash; title: ; notranslate">
cat /var/log/httpd/access_log | awk '{print $1}' | sort | uniq -c | sort -n | awk '{ if ($1 &gt; 1000)print $1,$2}'
</pre>
<p>Additionally, you can change 1000 to your desired value.</p>
]]></content:encoded>
			<wfw:commentRss>http://itcaffe.net/bash/print-the-ips-which-have-more-than-1000-hits/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Installing BIND on a FreeBSD server</title>
		<link>http://itcaffe.net/dns/installing-bind-on-a-freebsd-server/</link>
		<comments>http://itcaffe.net/dns/installing-bind-on-a-freebsd-server/#comments</comments>
		<pubDate>Sat, 08 May 2010 13:41:11 +0000</pubDate>
		<dc:creator>Valkyrka</dc:creator>
				<category><![CDATA[dns]]></category>
		<category><![CDATA[freebsd]]></category>

		<guid isPermaLink="false">http://itcaffe.net/?p=392</guid>
		<description><![CDATA[Here is how you can install BIND on a FreeBSD server : You will be prompted with a window like the following : Select the stuff that you need, and hit &#039;OK&#039;. After this, run the following to begin the installation : Add the following to /etc/rc.conf : Now, simply start the named service by [...]]]></description>
			<content:encoded><![CDATA[<p>Here is how you can install BIND on a FreeBSD server :</p>
<pre class="brush: bash; title: ; notranslate">
cd /usr/ports/dns/bind96
make config
</pre>
<p>You will be prompted with a window like the following :<br />
<img alt="" src="http://itcaffe.net/wp-content/uploads/2010/05/freebsd-bind.png" title="FreeBSD-bind" class="aligncenter" width="720" height="400" /><br />
Select the stuff that you need, and hit &#039;OK&#039;. After this, run the following to begin the installation :</p>
<pre class="brush: bash; title: ; notranslate">
make install distclean
</pre>
<p>Add the following to /etc/rc.conf :</p>
<pre class="brush: bash; title: ; notranslate">
named_enable=&quot;YES&quot;
</pre>
<p>Now, simply start the named service by issuing the following command :</p>
<pre class="brush: bash; title: ; notranslate">
/etc/rc.d/named start
</pre>
<p>This will also create the rndc key. Here is a sample output of what I got upon starting named for the first time :</p>
<pre class="brush: bash; title: ; notranslate">
freebsd# /etc/rc.d/named start
wrote key file &quot;/var/named/etc/namedb/rndc.key&quot;
Starting named.
</pre>
]]></content:encoded>
			<wfw:commentRss>http://itcaffe.net/dns/installing-bind-on-a-freebsd-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

