30 December 2010

UUCP Configuration for laptop

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. This will be used to keep the mails of the local users on local machine.

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 quesitons 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 support 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 :

UUCP and rmail
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.

Configuring UUCP on users' laptop:

Note :
Here example of User's laptop UUCP configuration is used as example.
* Hostname of the system : userabc.org.domain
* uucpqueue name : userabc.userdomain.com
* uucp queue created on mx server : server (uucp-in1.pub.org.domain).

Configuration files with this document :



Installing required packages

$ 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
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

UUCP and rmail
$ sudo apt-get install uucp rmail

$sudo apt-get install thunderbird

Please check the configuration of the following parameters in config files of cyrus.

# Other options (default: -c -m /var/run/saslauthd)
# Should saslauthd run automatically on startup? (default: no)

# Which authentication mechanisms should saslauthd use? (default: pam)

# Additional options for this mechanism. (default: none)

# How many saslauthd processes should we run? (default: 5)


# most services also accept -U (limit number of reuses) and -T (timeout)
# --- 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

# ----------------------------------------------

# 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

Cyrus Mailbox creation
First, you have define a "password" for the user cyrus . With root make this:
# passwd cyrus
You also have to create the mailboxes for the users. Use the cyradm utility for that:
$ cyradm --user cyrus -auth plain localhost
  password : 
  IMAP Password: 

You can have the full description of the commands available by typing help.
Mailbox creation is done like this:
 localhost>cm user.userabc

Dot not forget the prefix user. or the mailbox created will be considered as a shared mailbox.
Test that your installation works correctly:
$ telnet localhost imap
Connected to localhost.
Escape character is '^]'.
* OK userabc.org.domain Cyrus IMAP4 v2.2.13-Debian-2.2.13-14ubuntu3 server ready
imap login userabc passowrd
imap OK User logged in
If it does not work check /var/log/mail.log for evidence.


dnl DAEMON_OPTIONS(`Family=inet, Name=MTA-v6, Port=smtp, Addr=')dnl
DAEMON_OPTIONS(`Family=inet, Name=MTA-v4, Port=smtp, Addr=')dnl
DAEMON_OPTIONS(`Family=inet, Name=MSP-v4, Port=submission, Addr=')dnl

dnl define(`LUSER_RELAY', `local:cyrusv2')dnl
dnl MASQUERADE_AS(`org.domain')dnl
dnl define(`confDOMAIN_NAME', `org.domain')dnl
define(`confBIND_OPTS', `WorkAroundBrokenAAAA')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(`CYRUSV2_MAILER_ARGS',`FILE /var/run/cyrus/socket/lmtp')dnl
dnl FEATURE(`allmasquerade')dnl
dnl FEATURE(`masquerade_envelope')dnl
dnl FEATURE(`virtusertable', `hash /etc/mail/virtusertable')dnl



C{LOCALUSER}userabc userabc

R$={LOCALUSER} < @ $={LOCALDOMAIN} > $#cyrusv2 $: userabc
R$={LOCALUSER} < @ $={LOCALDOMAIN} . > $#cyrusv2 $: userabc

Note : LOCAL_CONFIG rule is to send mail that are intended to send to userabc@org.domain to
local cyrus mail box of userabc.

Converting sendmail.mc to sendmail.cf
$ m4 sendmail.mc > /var/tmp/sendmail.cf
$ ci -l o sendmail.cf
$ cp /var/tmp/sendmail.cf /etc/mail/

Restart the sendmail :
$ /etc/init.d/sendmail restart

Creating UUCP ssh key for uucp user
# su uucp

# sh-keygen -t dsa -b 1024 -C "UUCP user key for userabc.org.domain"

use blank passphrase.

Add public key uucp user to Server's uucptunnel user's authorized_keys file.

Creating uucp queue on server for laptop user
Login in to server

Specifying user queue parameters in /etc/uucp/sys
System userabc.org.domain
- Name of the user's queue
myname uucp-in1.pub.org.domain
- Server's UUCP name
called-login userabc.org.domain
- Host name of laptop user
time any
commands rmail

Adding password for user in /etc/uucp/passwd
userabc.org.domain password

Adding alias in file /etc/alias
If you want to forward one mail copy to current server queue and one to new uucp queue change the /etc/mail/alias and /etc/virtusrtable as

Add/modify entry of userabc to /etc/mail/alias

userabc: userabc@org.domain,"|/usr/local/bin/viauux userabc.org.domain userabc@org.domain"

Add this entry to /etc/mail/virtusertable

userabc@org.domain userabc

If your do not want to forward mail to other queue except uucp queue /etc/mail/virtusertable

userabc@org.domain uucp-dom:userabc.org.domain

Rebuilding virtusertable and aliases
$ makemap hash /var/tmp/virtusertable.db < /etc/mail/virtusertable
$ ci -l /etc/mail/virtusertable.db
$ cp /var/tmp/virtusertable.db /etc/mail/

On user's Laptop

Add entry in /etc/uucp/sys
system uucp-in1.pub.org.domain

myname userabc.org.domain

port type tcp

port service 7071

address localhost

chat ogin: userabc.org.domain word: password

time any

chat-timeout 300

protocol t

uusched script
This script actually activate the send/receive mail facility for UUCP. This script creates a ssh tunnel to the uucp-in1.pub.org.domain futher communication is done over this ssh tunnel.

For creating a ssh tunnel we need to add a ssh key to server.Create a ssh key for uucpp user of laptop. Add this key to servers uucptunnel user's authorized_file.
The script uusched provided with this document needs to be kept in /usr/local/sbin.

The existing /usr/sbin/uusched needs to be moved to /usr/sbin/uusched.orig,
and a softlink needs to be created:

/usr/sbin/uusched --> /usr/local/sbin/uusched

set script permission to 110 and owner to uucp.uucp

# cd /usr/sbin/
# mv uusched uusched.ori
# cd /usr/sbin/local
# cp /var/tmp/tmp/uucp/uusched .
# chmod 110 uusched
# chown uucp.uucp uusched
# cd /usr/sbin/
# ln -s /usr/sbin/uusched uusched

Adding uusched script in cron
Switch to uucp user
$ sudo su uucp

Add following line to crontab
*/5 * * * * /usr/sbin/uusched >/var/tmp/uusched.out 2>/var/tmp/uusched.err

$ crontab -e

Configuring thunderbird -

account setting -

1. New Account Setup
New E-mail account

2. Identity
your name : userabc
Email-address : userabc@org.domain

3. Server Information
Select type : IMAP
Incomming server : localhost
4. User name : Incomming User Name : userabc
5. Account Name : account name : userabc@org.domai

No comments:

Post a Comment