特殊:Badtitle/NS100:Cyrus:修订间差异

来自Ubuntu中文
跳到导航跳到搜索
Wikibot留言 | 贡献
无编辑摘要
Wikibot留言 | 贡献
无编辑摘要
第4行: 第4行:
Cyrus is one of the most widely used IMAP/POP servers. Cyrus is apreciated for virtualisation of mailboxes and cool stuff like server side filtering (sieve) or shared folders. It is frequently used in universities. In this howto, a basic installation of Cyrus with authentication on PAM will be explained.
Cyrus is one of the most widely used IMAP/POP servers. Cyrus is apreciated for virtualisation of mailboxes and cool stuff like server side filtering (sieve) or shared folders. It is frequently used in universities. In this howto, a basic installation of Cyrus with authentication on PAM will be explained.
== Installation ==
== Installation ==
Cyrus is in the main repository of Ubuntu (and as a consequence benefit from canonical security support). Install the following packages: <code><nowiki>cyrus21-admin cyrus21-clients cyrus21-imapd sasl2-bin</nowiki></code> (see [[UbuntuHelp:InstallingSoftware|InstallingSoftware]]).
Cyrus is in the main repository of Ubuntu (and as a consequence benefit from<pre><nowiki>no</nowiki></pre>al security support). Install the following packages: <pre><nowiki>cyrus21-admin cyrus21-clients cyrus21-imapd sasl2-bin</nowiki></pre> (see [[UbuntuHelp:InstallingSoftware|InstallingSoftware]]).
If you dot not have a [http://en.wikipedia.org/wiki/Mail_transfer_agent MTA] yet, this step will install <code><nowiki>postfix</nowiki></code>. Please refer to the [[UbuntuHelp:Postfix|Postfix]] page for details.
If you dot not have a [http://en.wikipedia.org/wiki/Mail_transfer_agent MTA] yet, this step will install <pre><nowiki>postfix</nowiki></pre>. Please refer to the [[UbuntuHelp:Postfix|Postfix]] page for details.
== Configuration ==
== Configuration ==
=== Cyrus ===
=== Cyrus ===
Cyrus configuration is done in two configurations files: <code><nowiki>/etc/imapd.conf</nowiki></code> and <code><nowiki>/etc/cyrus.conf</nowiki></code>.
Cyrus configuration is done in two configurations files: <pre><nowiki>/etc/imapd.conf</nowiki></pre> and <pre><nowiki>/etc/cyrus.conf</nowiki></pre>.
First, edit the <code><nowiki>/etc/cyrus.conf</nowiki></code> to activate the protocols you want. Here, imap and imaps will be activated:
First, edit the <pre><nowiki>/etc/cyrus.conf</nowiki></pre> to activate the protocols you want. Here, imap and imaps will be activated:
<pre><nowiki>
<pre><nowiki>
8<----------------------------------------
8<----------------------------------------
SERVICES {
SERVICES {
# --- Normal cyrus spool, or Murder backends ---
        # --- Normal cyrus spool, or Murder backends ---
# add or remove based on preferences
        # add or remove based on preferences
imap            cmd="imapd -U 30" listen="imap" prefork=0 maxchild=100
        imap            cmd="imapd -U 30" listen="imap" prefork=0 maxchild=100
imaps          cmd="imapd -s -U 30" listen="imaps" prefork=0 maxchild=100
        imaps          cmd="imapd -s -U 30" listen="imaps" prefork=0 maxchild=100
#pop3          cmd="pop3d -U 30" listen="pop3" prefork=0 maxchild=50
        #pop3          cmd="pop3d -U 30" listen="pop3" prefork=0 maxchild=50
#pop3s          cmd="pop3d -s -U 30" listen="pop3s" prefork=0 maxchild=50
        #pop3s          cmd="pop3d -s -U 30" listen="pop3s" prefork=0 maxchild=50
8<----------------------------------------
8<----------------------------------------
</nowiki></pre>
</nowiki></pre>
Then edit <code><nowiki>/etc/imapd.conf</nowiki></code> (do not believe the name, it concerns general Cyrus stuff configuration). Only some parameters will be focused as most of options will match most of the needs.
Then edit <pre><nowiki>/etc/imapd.conf</nowiki></pre> (do not believe the name, it concerns general Cyrus stuff configuration). Only some parameters will be focused as most of options will match most of the needs.
<pre><nowiki>
<pre><nowiki>
8<----------------------------------------
8<----------------------------------------
第28行: 第28行:
# slash "/" to delimit levels of the hierarchy. This is done by converting
# slash "/" to delimit levels of the hierarchy. This is done by converting
# internally all dots to "^", and all "/" to dots. So the "rabbit.holes"
# internally all dots to "^", and all "/" to dots. So the "rabbit.holes"
# mailbox of user "helmer.fudd" is stored in "user.elmer<sup>fud.rabbit</sup>holes"
# mailbox of user "helmer.fudd" is stored in "user.elmer^fud.rabbit^holes"
unixhierarchysep: no
unixhierarchysep: no
8<----------------------------------------
8<----------------------------------------
</nowiki></pre>
</nowiki></pre>
By default, unixhierarchysep if set to <code><nowiki>no</nowiki></code> which means that the separator is "." and not "/". You will have to turn in to <code><nowiki>yes</nowiki></code> if you want your mailbox to contains "." for example if you use mail addresses for naming your mailboxes.
By default, unixhierarchysep if set to <code><nowiki>no</nowiki></code> which means that the separator is "." and not "/". You will have to turn in to <pre><nowiki>yes</nowiki></pre> if you want your mailbox to contains "." for example if you use mail addresses for naming your mailboxes.
<pre><nowiki>
<pre><nowiki>
8<----------------------------------------
8<----------------------------------------
第48行: 第48行:
8<----------------------------------------
8<----------------------------------------
</nowiki></pre>
</nowiki></pre>
Indicates the method used for user authentication. <code><nowiki>saslauthd</nowiki></code> can also be used for Postfix authentication, as detailed in [[UbuntuHelp:Postfix|Postfix]] page.
Indicates the method used for user authentication. <pre><nowiki>saslauthd</nowiki></pre> can also be used for Postfix authentication, as detailed in [[UbuntuHelp:Postfix|Postfix]] page.
Last, change the <code><nowiki>/etc/default/saslauthd</nowiki></code>:
Last, change the <pre><nowiki>/etc/default/saslauthd</nowiki></pre>:
<pre><nowiki>
<pre><nowiki>
# This needs to be uncommented before saslauthd will be run automatically
# This needs to be uncommented before saslauthd will be run automatically
START=yes
START=yes
# You must specify the authentication mechanisms you wish to use.
# You must specify the authentication mechanisms you wish to use.
# This defaults to "pam" for PAM support, but may also include
# This defaults to "pam" for PAM support, but may also include
第59行: 第60行:
</nowiki></pre>
</nowiki></pre>
Your authentication will be based on PAM. Probabily PAM is correctly setup on your machine.
Your authentication will be based on PAM. Probabily PAM is correctly setup on your machine.
Just launch <code><nowiki>saslauthd</nowiki></code> daemon:
Just launch <pre><nowiki>saslauthd</nowiki></pre> daemon:
<pre><nowiki>
<pre><nowiki>
# /etc/init.d/saslauthd start
# /etc/init.d/saslauthd start
</nowiki></pre>
</nowiki></pre>
=== Mail Transfert Agent ===
=== Mail Transfert Agent ===
You have to configure your mail transfert agent to deliver your messages in your cyrus mailbox. In this howto, Postfix MTA will be presented. Feel free to add you favorite MTA.
You have to configure your mail transfert agent to deliver your messages in yo<pre><nowiki>cyrus</nowiki></pre>ilbox. In this howto, Postfix MTA will be presented. Feel free to add you favorite MTA.
==== Postfix ====
==== Postfix ====
With postfix, there are two ways of delivering messages in you mailbox: with a special transport named cyrus, or via lmtp (which is a protocol more or less similar to smtp). '''Choose the one you prefer'''. The <code><nowiki>cyrus</nowiki></code> transport is the simplest, <code><nowiki>lmtp</nowiki></code> is the most powerfull (you can communicate with lmtp between machines).
With postfix, there are two ways of delivering messages in you mailbox: with a special transport nam<pre><nowiki>cyrus</nowiki></pre>r v<pre><nowiki>lmtp</nowiki></pre>hich is a protocol more or less similar to smtp). '''Choose the one you prefer'''. The <code><nowiki>cyrus</nowiki></code> transport is the simplest, <code><nowiki>lmtp</nowiki></code> is the most powerfull (you can communicate with lmtp between machines).
===== cyrus transport =====
===== cyrus transport =====
In your postfix <code><nowiki>main.cf</nowiki></code> configuration file, add the following line:
In your postfix <pre><nowiki>main.cf</nowiki></pre> configuration file, add the following line:
<pre><nowiki>
<pre><nowiki>
mailbox_transport = cyrus
mailbox_transport = cyrus
</nowiki></pre>
</nowiki></pre>
On Ubuntu installation, the transport <code><nowiki>cyrus</nowiki></code> is NOT already configured in <code><nowiki>/etc/postfix/master.cf</nowiki></code>. You must add manually at the end of <code><nowiki>master.cf</nowiki></code> the following lines:
On Ubuntu installation, the transport <code><nowiki>cyrus</nowiki></code> is NOT already configured in <pre><nowiki>/etc/postfix/master.cf</nowiki></pre>. You must add manually at the end of <pre><nowiki>master.cf</nowiki></pre> the following lines:
<pre><nowiki>
<pre><nowiki>
# The Cyrus deliver program has changed incompatibly, multiple times.
# The Cyrus deliver program has changed incompatibly, multiple times.
cyrus    unix  -  n  n  -  -  pipe
cyrus    unix  -  n  n  -  -  pipe
flags=R user=cyrus argv=/usr/sbin/cyrdeliver -e -m "${extension}" ${user}
  flags=R user=cyrus argv=/usr/sbin/cyrdeliver -e -m "${extension}" ${user}
</nowiki></pre>
</nowiki></pre>
===== lmtp =====
===== lmtp =====
In your postfix <code><nowiki>main.cf</nowiki></code> configuration file, add the following line:
In your postfix <pre><nowiki>main.cf</nowiki></pre> configuration file, add the following line:
<pre><nowiki>
<pre><nowiki>
mailbox_transport = lmtp:unix:/var/run/lmtp
mailbox_transport = lmtp:unix:/var/run/lmtp
</nowiki></pre>
</nowiki></pre>
By default, on Ubuntu, the Unix socket lmtp is opened.  Make sure the socket matches the socket specified in your <code><nowiki>/etc/cyrus.conf</nowiki></code> and <code><nowiki>/etc/imapd.conf</nowiki></code>.  
By default, on Ubuntu, the Unix socket lmtp is opened.  Make sure the socket matches the socket specified in your <pre><nowiki>/etc/cyrus.conf</nowiki></pre> and <pre><nowiki>/etc/imapd.conf</nowiki></pre>.  
In your postfix <code><nowiki>master.cf</nowiki></code> configuration file, edit the following line:
In your postfix <pre><nowiki>master.cf</nowiki></pre> configuration file, edit the following line:
<pre><nowiki>
<pre><nowiki>
lmtp      unix  -      -      -      -      -      lmtp
lmtp      unix  -      -      -      -      -      lmtp
第92行: 第93行:
lmtp      unix  -      -      n      -      -      lmtp
lmtp      unix  -      -      n      -      -      lmtp
</nowiki></pre>
</nowiki></pre>
Otherwise, "No such file or directory" errors will be logged in the <code><nowiki>/var/log/mail.log</nowiki></code> as postfix tries to look for the socket in a chrooted environment.
Otherwise, "No such file or directory" errors will be logged in the <pre><nowiki>/var/log/mail.log</nowiki></pre> as postfix tries to look for the socket in a chrooted environment.
== Mailbox creation ==
== Mailbox creation ==
First, you have define a "password" for the user admin for the cyrusadm. With root make this:
First, you have define a "password" for the user admin for the cyrusadm. With root make this:
第100行: 第101行:
Again (for verification): RETYPE YOUR CYRUS PASSWORD
Again (for verification): RETYPE YOUR CYRUS PASSWORD
</nowiki></pre>
</nowiki></pre>
You also have to create the mailboxes for the users. User the <code><nowiki>cyradm</nowiki></code> utility for that:
You also have to create the mailboxes for the users. User the <pre><nowiki>cyradm</nowiki></pre> utility for that:
<pre><nowiki>
<pre><nowiki>
cyradm --user cyrus localhost
cyradm --user cyrus localhost
第106行: 第107行:
localhost>
localhost>
</nowiki></pre>
</nowiki></pre>
You can have the full description of the commands available by typing <code><nowiki>help</nowiki></code>. We will give more details in the section Administration & Maintenance.
You can have the full description of the commands available by typing <pre><nowiki>help</nowiki></pre>. We will give more details in the section Administration & Maintenance.
Mailbox creation is done like this:
Mailbox creation is done like this:
<pre><nowiki>
<pre><nowiki>
localhost>cm user.toto
localhost>cm user.toto
</nowiki></pre>
</nowiki></pre>
Dot not forget the prefix <code><nowiki>user.</nowiki></code> or the mailbox created will be considered as a shared mailbox.
Dot not forget the prefix <pre><nowiki>user.</nowiki></pre> or the mailbox created will be considered as a shared mailbox.
== Test ==
== Test ==
Test that your installation works correctly:
Test that your installation works correctly:
第123行: 第124行:
imap OK User logged in
imap OK User logged in
</nowiki></pre>
</nowiki></pre>
Where ''user'' and ''password'' are your login and password on the server. If it does not work check <code><nowiki>/var/log/mail.log</nowiki></code> for evidence.
Where ''user'' and ''password'' are your login and password on the server. If it does not work check <pre><nowiki>/var/log/mail.log</nowiki></pre> for evidence.
== Administration / Maintenance ==
== Administration / Maintenance ==
== Links ==
== Links ==

2007年12月6日 (四) 10:10的版本

{{#ifexist: :Cyrus/zh | | {{#ifexist: Cyrus/zh | | {{#ifeq: {{#titleparts:Cyrus|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:Cyrus|1|-1|}} | zh | | }}

Introduction

Cyrus is one of the most widely used IMAP/POP servers. Cyrus is apreciated for virtualisation of mailboxes and cool stuff like server side filtering (sieve) or shared folders. It is frequently used in universities. In this howto, a basic installation of Cyrus with authentication on PAM will be explained.

Installation

Cyrus is in the main repository of Ubuntu (and as a consequence benefit from

no

al security support). Install the following packages:

cyrus21-admin cyrus21-clients cyrus21-imapd sasl2-bin

(see InstallingSoftware). If you dot not have a MTA yet, this step will install

postfix

. Please refer to the Postfix page for details.

Configuration

Cyrus

Cyrus configuration is done in two configurations files:

/etc/imapd.conf

and

/etc/cyrus.conf

. First, edit the

/etc/cyrus.conf

to activate the protocols you want. Here, imap and imaps will be activated:

8<----------------------------------------
SERVICES {
        # --- Normal cyrus spool, or Murder backends ---
        # add or remove based on preferences
        imap            cmd="imapd -U 30" listen="imap" prefork=0 maxchild=100
        imaps           cmd="imapd -s -U 30" listen="imaps" prefork=0 maxchild=100
        #pop3           cmd="pop3d -U 30" listen="pop3" prefork=0 maxchild=50
        #pop3s          cmd="pop3d -s -U 30" listen="pop3s" prefork=0 maxchild=50
8<----------------------------------------

Then edit

/etc/imapd.conf

(do not believe the name, it concerns general Cyrus stuff configuration). Only some parameters will be focused as most of options will match most of the needs.

8<----------------------------------------
# UNIX Hierarchy Convention
# Set to yes, and cyrus will accept dots in names, and use the forward
# slash "/" to delimit levels of the hierarchy. This is done by converting
# internally all dots to "^", and all "/" to dots. So the "rabbit.holes"
# mailbox of user "helmer.fudd" is stored in "user.elmer^fud.rabbit^holes"
unixhierarchysep: no
8<----------------------------------------

By default, unixhierarchysep if set to no which means that the separator is "." and not "/". You will have to turn in to

yes

if you want your mailbox to contains "." for example if you use mail addresses for naming your mailboxes.

8<----------------------------------------
# Uncomment the following and add the space-separated users who
# have admin rights for all services.
admins: cyrus
8<----------------------------------------

This parameter define an administrator for all the services. It will be require for administration operations like mailbox creation.

8<----------------------------------------
# Do note that, since sasl will be run as user cyrus, you may have a lot of
# trouble to set this up right.
sasl_pwcheck_method: saslauthd
8<----------------------------------------

Indicates the method used for user authentication.

saslauthd

can also be used for Postfix authentication, as detailed in Postfix page. Last, change the

/etc/default/saslauthd

:

# This needs to be uncommented before saslauthd will be run automatically
START=yes

# You must specify the authentication mechanisms you wish to use.
# This defaults to "pam" for PAM support, but may also include
# "shadow" or "sasldb", like this:
MECHANISMS="pam"

Your authentication will be based on PAM. Probabily PAM is correctly setup on your machine.

Just launch

saslauthd

daemon:

# /etc/init.d/saslauthd start

Mail Transfert Agent

You have to configure your mail transfert agent to deliver your messages in yo

cyrus

ilbox. In this howto, Postfix MTA will be presented. Feel free to add you favorite MTA.

Postfix

With postfix, there are two ways of delivering messages in you mailbox: with a special transport nam

cyrus

r v

lmtp

hich is a protocol more or less similar to smtp). Choose the one you prefer. The cyrus transport is the simplest, lmtp is the most powerfull (you can communicate with lmtp between machines).

cyrus transport

In your postfix

main.cf

configuration file, add the following line:

mailbox_transport = cyrus

On Ubuntu installation, the transport cyrus is NOT already configured in

/etc/postfix/master.cf

. You must add manually at the end of

master.cf

the following lines:

# The Cyrus deliver program has changed incompatibly, multiple times.
cyrus     unix  -   n   n   -   -   pipe
  flags=R user=cyrus argv=/usr/sbin/cyrdeliver -e -m "${extension}" ${user}
lmtp

In your postfix

main.cf

configuration file, add the following line:

mailbox_transport = lmtp:unix:/var/run/lmtp

By default, on Ubuntu, the Unix socket lmtp is opened. Make sure the socket matches the socket specified in your

/etc/cyrus.conf

and

/etc/imapd.conf

. In your postfix

master.cf

configuration file, edit the following line:

lmtp      unix  -       -       -       -       -       lmtp

to

lmtp      unix  -       -       n       -       -       lmtp

Otherwise, "No such file or directory" errors will be logged in the

/var/log/mail.log

as postfix tries to look for the socket in a chrooted environment.

Mailbox creation

First, you have define a "password" for the user admin for the cyrusadm. With root make this:

# saslpasswd2 -c cyrus
Password: TYPE YOUR CYRUS PASSWORD HERE
Again (for verification): RETYPE YOUR CYRUS PASSWORD

You also have to create the mailboxes for the users. User the

cyradm

utility for that:

cyradm --user cyrus localhost
IMAP Password:
localhost>

You can have the full description of the commands available by typing

help

. We will give more details in the section Administration & Maintenance.

Mailbox creation is done like this:

localhost>cm user.toto

Dot not forget the prefix

user.

or the mailbox created will be considered as a shared mailbox.

Test

Test that your installation works correctly:

# telnet localhost imap
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
* OK hostname Cyrus IMAP4 v2.1.18-IPv6-Debian-2.1.18-2ubuntu2 server ready
imap login user password
imap OK User logged in

Where user and password are your login and password on the server. If it does not work check

/var/log/mail.log

for evidence.

Administration / Maintenance

Links

Postfix Cyrus Web cyradm HOWTO