Archives page

Posts Tagged ‘cyrus’

Upgrading Fedora 8 to Fedora 9

It’s time for another Fedora upgrade. Whilst the installations aren’t necessarily getting any better – fixing them is becoming a bit faster, because the problems are pretty similar every time and these notes I’m keeping are helping.

  1. System won”t boot. Met with a grub> prompt, and no menu
    • Boot the system from the DVD again, and select “rescue an install system”.
    • ‘chroot /mnt/sysimage/’
    • “nano /boot/grub/grub.conf”
    • Change this line, “root (hd2,0)” to root “(hd0,0)”. (I’m not sure why Grub seems incapable of finding the right hard drive to boot from each time… It doesn’t change.)
    • Uncomment the line at the top #boot
  2. Cyrus imapd won”t start. Complaining of libcrypto.so.6 library missing.
    • Upgrade Cyrus – “yum upgrade -y cyrus”
    • Restart the service – ‘service cyrus-imapd restart’
  3. Rss2imap no longer posts the messages into Cyrus IMAPD
    • Difficult to place the blame on this one. One turning on Rss2imap debug mode, I see i@m getting the error ‘Message contains bare newlines’, and although Rss2imap has posted the message. It’s been discarded by Cyrus. This is actually proper RFC behaviour for Cyrus – as message’s shouldn’t contain the broken ‘\n’ character, but rather ‘\r\n’. At the same time, I also think, ‘so what?’. Either way, the Cyrus behaviour has changed, or Mail::IMAPClient modules have.
    • So the fix… Edit Rss2imap\RSS2IMAPLIB\Rss2imap.pm, and add the bold text.
       my $message = ($headers . $body);
      $message =~ s/\n/\r\n/g;
      utf8::encode ( $message );

      and
       my $folder = $this->get_real_folder_name ($this->{'last-modified-folder'});
      $body =~ s/\n/\r\n/g;
      $this->{imap}->append_string ($folder, $body);

      You’ll notice we’ve replaced all the \n line endings with the more correct \r\n. Let’s just hope we don’t have to undo that later when the problem gets resolved elsewhere 😉

Remarkably, this was the first time the wireless card started up immediately after the upgrade, perhaps things are improving after all 😉

Cyrus Certificate Authentication

This is probably of no interest to anyone whatsoever. Except me, in a few months time when I try and configure another mail server – and can’t remember how to generate certificates for Windows.

So first off, create the certificates for your Cyrus IMAP server (you’ve already set all that up, right?)

openssl req -new -nodes -out req.pem -keyout key.pem
openssl rsa -in key.pem -out new.key.pem
openssl x509 -in req.pem -out ca-cert -req \
-signkey new.key.pem -days 999
mkdir /var/imap
cp new.key.pem /var/imap/server.pem
rm new.key.pem
cat ca-cert >> /var/imap/server.pem
chown cyrus:mail /var/imap/server.pem
chmod 600 /var/imap/server.pem # Your key should be protected
echo tls_ca_file: /var/imap/server.pem >> /etc/imapd.conf
echo tls_cert_file: /var/imap/server.pem >> /etc/imapd.conf
echo tls_key_file: /var/imap/server.pem >> /etc/imapd.conf

Then generate the certificate for the client.

openssl pkcs12 -export -in server.pem -inkey server.pem -out iestuff.p12

You’ll need to add that iestuff to your trusted certificates – but that’s pretty much it 🙂 No more annoying messages from Outlook.