Cyrus is one of the most widely used IMAP/POP servers. Cyrus is appreciated for virtualisation of mailboxes and cool stuff like server side filtering (sieve) or shared folders. It is frequently used in universities. This will be used to keep the mails of the local users on local machine.
You have to configure your mail transfer agent to deliver your local messages in your Cyrus mailbox.
Sendmail is the most popular mail transfer agent (MTA) on the Internet. Its popularity is due in part to its position as the standard MTA under most variants of the Unix and other Unix-like operating system.
Sendmail supports a variety of mail transfer protocols, including SMTP, ESMTP, DECnet's mail 11, HylaFax, QuickPage and UUCP. Additionally, Sendmail v8.12 as of September 2001 introduced support for milters - external mail filtering programs that can participate in each step of the SMTP conversation.
BIND is an implementation of the Domain Name System (DNS) protocols.
The BIND software distribution contains three parts:
A Domain Name System server. This is a program called "named", which is pronounced "name-dee" and stands for "name daemon". It answers questions that are sent to it, following the rules specified in the DNS protocol standards. You can provide DNS service on the internet by installing this software on a server computer and giving it correct information about your domain names.
A Domain Name System "resolver library". A "resolver" is a program that resolves questions about names by sending those questions to appropriate servers and responding appropriately to the servers' replies. A "resolver library" is a collection of software components that a programmer can add to software being developed, which will give that software the ability to resolve names. For example, a programmer who was programming a new web browser does not need to create the part of it that looks up names in DNS; he or she can plug in the resolver library and then send questions to the library software components. This saves time (the programmer does not need to re-invent that particular wheel) and helps ensure that the new browser correctly follows the DNS standards.
Software tools for testing servers. These are the tools that we use for testing and we include them in the distribution in case you would like to do your own testing, perhaps to make sure your server configuration is working properly.
Fetchmail is a full-featured, robust, remote-mail retrieval and forwarding utility intended to be used over on-demand TCP/IP links (such as SLIP or PPP connections). It supports every remote-mail protocol now in use on the Internet: POP2, POP3, RPOP, APOP, KPOP, all flavors of IMAP, ETRN, and ODMR. It can even support IPv6 and IPSEC.
Fetchmail retrieves mail from remote mail servers and forwards it via SMTP, so it can then be read by normal mail user agents such as mutt, elm(1) or BSD Mail. It allows all your system MTA's filtering, forwarding, and aliasing facilities to work just as they would on normal mail.
Fetchmail offers better protection against password-sniffing than any other Unix remote-mail client. It supports APOP, KPOP, OTP, Compuserve RPA, Microsoft NTLM, and IMAP RFC1731 encrypted authentication methods including CRAM-MD5 to avoid sending passwords en clair. It can be configured to upport end-to-end encryption via tunneling with ssh, the Secure Shell.
Fetchmail can be used as a POP/IMAP-to-SMTP gateway for an entire DNS domain, collecting mail from a single drop box on an ISP and SMTP-forwarding it based on header addresses. (We don't really recommend this, though, as it may lose important envelope-header information. ETRN or a UUCP connection is better.)
References :
http://fetchmail.berlios.de/
UUCP can transfer anything. It can be told to transfer some data to remote system and execute some program on that remote system having this data as input. Or in back direction -- sending output of remote command to local system.
Rmail command is a traditional way for transmitting mail over uucp. One system prepares email message and tells uucp to deliver it to remote system and call `rmail' program there, so this program will read the message and deliver it using local (from the remote side) ways. Trivial rmail "program" is distributed with Postfix. It is a simple shell script that calls local /usr/sbin/sendmail with appropriate arguments, giving it the input received from remote side.
May be. The `server' is a system name configured in local /etc/uucp/sys file. If you name it `server.fq.dn', then you should use this name when invoking uucico (or uux for queuing a command for a system, or uucp for simple file transfer, or uustat for displaying a queue and so on).
UUCP (UNIX-to-UNIX Copy Protocol) is a set of unix program for copying (sending) files between different UNIX systems and for sending commands to be executed on another system. The main UUCP commands (each supported by a UUCP program) are:
uucp, which requests the copying of a specific file to another specified system.
uux, which sends a UNIX command to another system where it is queued for execution
uucico, which runs on a UNIX system as the program that carries out the copying and initiates execution of the commands that have been sent. Typically, this program is run at various times of day; meanwhile, the copy (uucp) and command (uux) requests are queued until the uucico program is run.
uuxqt, which executes the commands sent by uux, usually after being started by the uucico program
The uucico programs are the programs that actually communicate across a network.
There are several network protocols (variations on packet size and error-checking) that can be used by uucico programs, depending on the kinds of carrier networks being used.
Note :
Here example of Ram's laptop UUCP configuration is used as example.
One more account is created on atlantic (uucp-in2.pub.merceworld.com) but is not explained here. It is similar to configuration done on pacific. Only need to done the server side uucp queue creating and creating alias similar to pacific. We have sent one copy of Ram's mail to newly created uucp queue and other to his regular queue.
Required configuration files to setup IMAP mails:
/etc/imapd.conf /etc/cyrus.conf /etc/default/saslauthd
/etc/mail/sendmail.mc /etc/mail/sendmail.conf
/user/sbin/uusched /etc/uucp/sys
$ sudo apt-get install cyrus-admin-2.2 cyrus-clients-2.2 cyrus-imapd-2.2 sasl2-bin cyrus-pop3d-2.2 cyrus-doc-2.2 cyrus-sasl2-doc On Postfix Configuration Screen select No configuration and hit.
sudo apt-get install sendmail-base sendmail-bin sendmail-cf sendmail-doc
$ sudo apt-get install bind9 bind9-doc
$ sudo apt-get install fetchmail
$ sudo apt-get install uucp rmail
$sudo apt-get install thunderbird
Please check the configuration of the following parameters in config files of cyrus.
vim /etc/default/saslauthd
# Other options (default: -c -m /var/run/saslauthd) # Should saslauthd run automatically on startup? (default: no) START=yes # Which authentication mechanisms should saslauthd use? (default: pam) MECHANISMS="pam" # Additional options for this mechanism. (default: none) MECH_OPTIONS="" # How many saslauthd processes should we run? (default: 5) THREADS=5
vim /etc/cyrus.conf
Uncomment "imap" line as shown below.
# most services also accept -U (limit number of reuses) and -T (timeout) 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 #nntp cmd="nntpd -U 30" listen="nntp" prefork=0 maxchild=100 #nntps cmd="nntpd -s -U 30" listen="nntps" prefork=0 maxchild=100 .... # ---------------------------------------------- }
vim /etc/imapd.conf
# UNIX Hierarchy Convention unixhierarchysep: no # and including 2.2.12-4. lmtp_downcase_rcpt: yes # Uncomment the following and add the space-separated users who # have admin rights for all services. # admins: cyrus # Space-separated list of users that have imapd "admin" status, in # addition to those in the admins: entry above imap_admins: cyrus # Allow plaintext logins by default (SASL PLAIN) allowplaintext: yes # # SASL library options (these are handled directly by the SASL libraries, # refer to SASL documentation for an up-to-date list of these) # sasl_pwcheck_method: saslauthd
Login with "root" and set Cyrus "password" first.
# passwd cyrus Enter new UNIX password: TYPE YOUR CYRUS PASSWORD HERE Retype new UNIX password: RETYPE YOUR CYRUS PASSWORD
To create user mail box you need to login with cyrus user and use cyradm command (Note:- For example here I took "kmram" user name).
su - cyrus
Syntax :- localhost>cm user.username
$ cyradm --user cyrus -auth plain localhost password :IMAP Password: localhost>cm user.kmram
Here you can get full description of the available commands by typing help.
Dot not forget the prefix "user." or the mailbox created will be considered as a shared mailbox.
Test that your cyrus user works correctly or not?
$ telnet localhost imap Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. OK kmram.merceworld.com Cyrus IMAP4 v2.2.13-Debian-2.2.13-14ubuntu3 server ready imap login kmram passowrd imap OK User logged in
If it does not work check /var/log/mail.log for troubleshoot.
vim /etc/mail/sendmail.mc
Make changes to sendmail.mc configuration file as shown below
DAEMON_NETMODE="Dynamic"; QUEUE_INTERVAL="5m"; MSP_MODE="Daemon"; MSP_INTERVAL="1m"; /etc/mail/sendmail.mc FEATURE(`no_default_msa')dnl FEATURE(`use_cw_file')dnl FEATURE(`accept_unresolvable_domains')dnl dnl DAEMON_OPTIONS(`Family=inet, Name=MTA-v6, Port=smtp, Addr=127.0.0.1')dnl DAEMON_OPTIONS(`Family=inet, Name=MTA-v4, Port=smtp, Addr=127.0.0.1')dnl DAEMON_OPTIONS(`Family=inet, Name=MSP-v4, Port=submission, Addr=127.0.0.1')dnl dnl define(`LUSER_RELAY', `local:cyrusv2')dnl FEATURE(`always_add_domain')dnl dnl MASQUERADE_AS(`merceworld.com')dnl dnl define(`confDOMAIN_NAME', `merceworld.com')dnl define(`ALIAS_FILE',`/etc/aliases') define(`confBIND_OPTS', `WorkAroundBrokenAAAA')dnl define(`confLOCAL_MAILER',`cyrusv2')dnl define(`confCON_EXPENSIVE',`False')dnl define(`confQUEUE_LA',`40')dnl define(`confREFUSE_LA',`60')dnl define(`confMIN_QUEUE_AGE',`2m')dnl define(`confMAX_DAEMON_CHILDREN',`20')dnl dnl define(`confMIN_FREE_BLOCKS',`250000')dnl Minimum number of free blocks needed to accept new mail dnl define(`confMAX_MESSAGE_SIZE',`50000000')dnl Maximum size of the message to accept define(`UUCP_MAILER_MAX', `50000000') define(`confTO_IDENT', `0')dnl define(`SMART_HOST',`uucp-dom:uucp-in1.pub.merceworld.com')dnl define(`CYRUSV2_MAILER_ARGS',`FILE /var/run/cyrus/socket/lmtp')dnl FEATURE(`smrsh')dnl dnl FEATURE(`allmasquerade')dnl dnl FEATURE(`masquerade_envelope')dnl dnl FEATURE(`virtusertable', `hash /etc/mail/virtusertable')dnl MAILER_DEFINITIONS MAILER(`local')dnl MAILER(`smtp')dnl MAILER(`cyrusv2')dnl MAILER(`uucp')dnl dnl MODIFY_MAILER_FLAGS(`SMTP',`+e')dnl dnl MODIFY_MAILER_FLAGS(`UUCP',`+e')dnl dnl MODIFY_MAILER_FLAGS(`CYRUSV2',`+we')dnl dnl MODIFY_MAILER_FLAGS(`ESMTP',`+e')dnl LOCAL_CONFIG C{LOCALUSER}kmram km.ram C{LOCALDOMAIN}merceworld.com LOCAL_RULE_0 R$={LOCALUSER} < @ $={LOCALDOMAIN} > $#cyrusv2 $: kmram R$={LOCALUSER} < @ $={LOCALDOMAIN} . > $#cyrusv2 $: kmram
Note : LOCAL_CONFIG rule is to send a mail that are intended to send to km.ram@merceworld.com to local cyrus mail box of kmram.
Converting sendmail.mc to sendmail.cf
$ cd /etc/mail/ $ ls -l sendmail.cf $ mkdir RCS $ ci -l sendmail.cf $ m4 sendmail.mc > /var/tmp/sendmail.cf $ mv /var/tmp/sendmail.cf /etc/mail/
Restart the sendmail :
$ /etc/init.d/sendmail restart
Login with uucp user to create UUCP ssh key.Note that use blank passphrase for uucp key.
$ su uucp $ sh-keygen -t dsa -b 1024 -C "UUCP user key for kmram.merceworld.com"
For creating a ssh tunnel we need to add a uucp ssh key to server. Copy uucp id_dsa.pub key to server's /var/tmp using scp command. Add this key to uucptunnel user's authorized_keys file on server (pacific.merceworld.com).
Add laptop users uucp ssh key to uucptunnel user
$ su – uucptunnel $ cd .ssh/ $ cat /var/tmp/id_dsa.pub >> authorized_keys $ chown uucptunnel.uucptunnel authorized_keys $ chmod 640 authorized_keys
Logout from uucptunnel users
Add user queue parameters in /etc/uucp/sys at bottom.
$ cd /etc/uucp $ ci -l sys $ chown uucp.uucp sys $ chmod 644 sys $ vim sys System kmram.merceworld.com myname uucp-in1.pub.merceworld.com called-login kmram.merceworld.com time any commands rmail
Add user uucp password in /etc/uucp/passwd at bottom.
$ cd /etc/uucp $ ls -l passwd $ ci -l passwd $ chown root.uucp passwd $ chmod 640 passwd $ vim passwd kmram.merceworld.com password
Add user alias in /etc/aliases file.
If you want to forward one copy of mail to current merce queue and one to new uucp queue, then make changes in /etc/aliases and /etc/mail/virtusrtable.
as below.
$ cd /etc $ ci -l aliases $ chown root.root aliases $ chmod 644 aliases kram: km.ram@arctic.merceworld.com,"|/usr/local/bin/viauux kmram.merceworld.com km.ram@merceworld.com"
Add this entry in /etc/mail/virtusertable.
$ cd /etc/mail $ ci -l virtusertable $ chown root.root virtusertable $ chmod 644 virtusertable $ vim virtusertable km.ram@merceworld.com kram kmram@merceworld.com kram
If you want to forward mail to only uucp queue, then do the following.
$ cd /etc/mail $ ci -l virtusertable $ chown root.root virtusertable $ chmod 644 virtusertable $ vim virtusertable km.ram@merceworld.com uucp-dom:kmram.merceworld.com
Rebuilding virtusertable and aliases
$ cd /etc/mail $ ci -l /etc/mail/virtusertable.db $ chown root.root virtusertable.db $ chown 640 virtusertable,db $ makemap hash /var/tmp/virtusertable.db < /etc/mail/virtusertable $ mv /var/tmp/virtusertable.db /etc/mail/ $newaliases
Add entry in /etc/uucp/sys
$ cd /etc/uucp $ vim sys system uucp-in1.pub.merceworld.com myname kmram.merceworld.com port type tcp port service 7071 address localhost chat ogin: kmram.merceworld.com word: password time any chat-timeout 300 protocol t
This script actually activate the send/receive mail facility for UUCP. This script creates a ssh tunnel to the uucp-in1.pub.merceworld.com futher communication will do over this ssh tunnel.
Take a backup of existing /usr/sbin/uusched file and copy the uusched sccript provided with this document in to /usr/local/sbin and create a symlink
.Copy the uusched file from /var/tmp and set the permission for /usr/local/sbin/uusched
$ cp /var/tmp/uusched /usr/local/sbin/uusched $ chown uucp.uucp /usr/local/sbin/uusched $ chmod 510 /usr/local/sbin/uusched
$ cd /usr/sbin/ $ mv uusched uusched.ori $ ln -s /usr/local/sbin/uusched uusched
$ su - uucp $ crontab -e
Add the following in uucp crontab
# Enable this cronjob for uusched */5 * * * * /usr/sbin/uusched >/var/tmp/uusched.out 2>/var/tmp/uusched.err
We need to add the laptop user entry in /etc/sysconfig/laptopuser file for the user. So when any mail is sent from Merce office will sent to server(pacific.merceworld.com)UUCP queue rather than the local cyrus inbox's of user.
.
Configuring thunderbird -
account setting -
1. New Account Setup
New E-mail account
2. Identity
your name : K M Ram
Email-address : km.ram@merceworld.com
3. Server Information
Select type : IMAP
Incomming server : localhost
4. User names
Incomming User Name : kmram
5. Account Name :
account name : km.ram@merceworld.com
6. Click "Finish".
Attachment | Size |
---|---|
Laptop-Mail-setup.txt [1] | 18.74 KB |
uusched.bz2 [2] | 1.85 KB |
Links:
[1] http://intranet.merceworld.com/system/files/Laptop-Mail-setup.txt
[2] http://intranet.merceworld.com/system/files/uusched.bz2