[LinuxFocus-icon]
Home  |  Map  |  Index  |  Search

News | Archives | Links | About LF
This article is available in: English  Castellano  Deutsch  Francais  Nederlands  Portugues  Russian  Turkce  

convert to palmConvert to GutenPalm
or to PalmDoc

[Photo of the Author]
by Guido Socher

About the author:

Guido has been using UUCP for many years and thinks that it is the best way to connect the mail system on your computer to the Internet.


Content:

 

E-mail over UUCP: The professional solution for dialup users

[uucp]

Abstract:

UUCP is one of the very old protocols of the Internet. It is in many cases now replaced by more modern protocols but it is still one of the best solutions for sending e-Mail from and to a dialup sites. Unfortunately many people connecting from home via a dialup link are not aware of the great potentials of UUCP and do not demand this service. As a consequence less service oriented Service providers do not offer UUCP these days.



 

Introduction

UUCP is very old protocol and was originally used to copy any type of files between Unix systems. Thus the name: "Unix to Unix Copy". These early computer systems were not permanently connected via a network. Instead dialup modem connections where used to exchange data in regular time intervals.

To copy the file mynotes.txt to a remote system called "mars" one would use the command:

uucp mynotes.txt mars!~/mynotes.txt
This copies for the moment the data just to a "spool directory" and later on when a dialup connection is made to that site the files will get physically copied over.

Today this type of application for UUCP is hardly used anymore. More modern protocols such as TCP/IP and e.g scp are now available to copy files between computer systems.

UUCP could do much more than that. It allowed you to execute a limited number of commands remotely. To send the command "rnews" on the remote system "mars" data from stdin one would issue the command:
cat somedata.txt | uux - mars!rnews
Again the command rnews would not be executed immediately on the remote site but only later on when a dialup connection to "mars" was established. The command would be parked in the local "spool directory".

What does all this have to do with e-mail?
E-mail is typically an application where it does not matter if the sending of the data is delayed a bit. Typically you would go through your mail, write e.g some reply messages to friends and "send it off". However you don't want to have all your reply windows from your mail application open all the time until you connect again to your ISP. You want to "send" the mail and close this window. If it is really immediately send is not important here as long as it gets send out later on.

This is exactly the type of application that you can reliably and easily implement with UUCP.  

Your own mail system

UUCP is flexible. You can set it up such that you have your own mailserver for a whole network of computers. Your Linux computer can be the central mail system serving e-mail to all kind of computers and operating systems in your private LAN (Local Area Network):
[A private
mail system connected via dialup]


Setting up a mailserver this way can be convenient for a family and very cost efficient for a small company. You can provide e-mail accounts to any number of users and at the same time you just need a dialup connection to your ISP. A company will probably establish that connection periodically (e.g every hour) and private persons would e.g set it only up if they go online for other reasons.

To conclude: E-mail over UUCP is not something old and dusty. It is a very convenient, cost efficient, and smart application of UUCP.  

How does it work?

Using UUCP you will get from your ISP your own MX Domain (MX=Mail Exchanger, Domain name part of e-mail address). E.g if your ISP's home page is at www.my-friendly-isp.com then he might give Joe Miller the domain miller.my-friendly-isp.com. All mail for that domain will be send to Joe Miller's mailserver using UUCP. Joe can then configure any number of users: joe@miller.my-friendly-isp.com, diana@miller.my-friendly-isp.com, frank@miller.my-friendly-isp.com ... It's all up to Joe. Since you get a free mail server with Linux which can again serve different protocols such as pop, imap, nfs or mail box directly over the local filesystem ... etc there is no restriction to the type of operating system or e-mail client that users use to access their mail.

UUCP as such is a stand alone protocol and you could run it directly hardware level (e.g the modem line without any ppp-protocol) however you can run it as well over TCP/IP and this gives you new possibilities:

You can have one dedicated ISP somewhere in the world with a good backbone connection (e.g in Amsterdam) and you connect to the Internet via any random ISP using cheap local connections. Since UUCP runs on top of TCP/IP the physical location of your E-mail/UUCP ISP does not matter any longer. It's accessible from anywhere in the world through the Internet.  

Setting it up

Most Linux distributions have a package called uucp and it contains usually Tailer UUCP. If it is not already on any of your CDs then you can get it at:
www.airs.com/ian

Apart from the UUCP package you need as well a mail system that can handle UUCP. I will describe Sendmail in this article but most other systems can handle UUCP too. A mail system that can handle UUCP will have a command called rmail in the rpm or deb package.

Mail is send to your system via remote command execution, similar to the uux/rnews example above. rmail is the command that receives the mail via the UUCP "pipe" and feeds it into your mail system.

The following information is needed by your ISP to setup the account:
The data you need from you ISP:  

Testing the account step by step

UUCP over TCP/IP uses TCP port 540 and you can therefore easily test your account before going into the configuration of your UUCP system. That way you can be sure that your ISP made no mistakes and that you have the right IDs and passwords. Run the command:
telnet uucp.my-friendly-isp.com 540
You will get then something like this:
Trying 1.2.3.42...
Connected to uucp.my-friendly-isp.com
Escape character is '^]'.
login:
Type login name and password:
Trying 1.2.3.42...
Connected to uucp.my-friendly-isp.com
Escape character is '^]'.
login: linux
Password: tux.1234
Shere=mfic
After a successful login the other side answers with "Shere" which stands for System here followed by the name of the remote system (check against the data from your ISP).
To close the connection use crtl-] and then type "q" at the telnet prompt:
^]
telnet> q
Connection closed.
Now you know that your account is setup correctly.  

Configuring your UUCP system

To receive (and finally send out) mail via UUCP you need to put the right configuration data into the UUCP configuration files. These files are usually found in /etc/uucp. You need to create/edit the following files: All files must be owned by user uucp and group uucp. The file call must not be world readable (chmod 640 call). Log files are usually written in /var/log/uucp/ and /var/spool/uucp/ must contain a directory with the name of the remote system. Make sure that both are writable for the user uucp.

call
# call file
# The format is just remote-system-name login-name password.
mfic linux tux.1234

port
# port file
# No need to change this
type tcp
port tcp
service 540

sys
# sys file
# defines information about the remote system
# system name of your ISP:
system mfic
# the server of your ISP:
address uucp.my-friendly-isp.com
# do not change the next 3 lines, see documentation of Tailer UUCP
# for details
time Any 2
port tcp
chat-timeout 60
# allowed commands:
commands rmail
# take the password and user name from the call file:
call-login *
call-password *
# do not change the next line:
chat ogin: \L assword: \P
#

config
# The config file just defines the path names
# of the other files and directories as well as your
# system name.
# Your system name:
nodename oblelix
# max number of request from other systems to execute in parallel:
max-uuxqts 2
# The UUCP spool directory
spool /var/spool/uucp
# The other fields are usually already compiled into
# as defaults:
# pubdir /var/spool/uucppublic
# logfile /var/log/uucp/Log
# statfile /var/log/uucp/Stats
# debugfile /var/log/uucp/Debug
# callfile /etc/uucp/call
# ....

After saving the config files run the command "uuchk". It's probably in sbin: /usr/sbin/uuchk

The output is a summary of your configuration including some default values that you have not set. The hostname of your ISPs server, uucp.my-friendly-isp.com in our example, appears as "phone number":

Phone number uucp.my-friendly-isp.com
This is strange but correct for UUCP over TCP/IP. Check especially that all the directories, log files, debug files etc are pointing to the right place and belong to the user uucp.

Now you should be able to receive mail via UUCP but your local mailer (MTA=mail transport agent) still needs to know that it is allowed to handle mail for the domain registered with your ISP. In our case this domain is miller.my-friendly-isp.com. The configuration of this domain depends on your MTA. In sendmail you need to write miller.my-friendly-isp.com on a single line in the file /etc/sendmail.cw:

# sendmail.cw define the domains for which we handle mail
miller.my-friendly-isp.com
Now we are ready to test receiving e-mail via UUCP. Sending out mails will not yet work because sendmail is not fully configured yet.
Run
/usr/sbin/uucico -x 11 -S mfic
mfic is the UUCP system name of my-friendly-isp.com.

Open a second terminal window and watch the result with "tail -f /var/log/uucp/Debug".
The "-x 11" specifies the highest debug level and should only be used during testing. You will see all the details of the UUCP protocol. Watch out for any errors. If you get at the end something like
uucico mfic - (2001-06-22 20:20:57.73 1020) Call complete (31 seconds 42835 bytes 1381 bps)
then everything is working. Congratulations!

Run the command "uulog". It will print a more compressed summary about the mails received via UUCP/rmail.

 

Setting up sendmail to send e-mail out via UUCP

Sendmail uses a m4 pre-processor based configuration system. Other mail systems such as postfix have more readable config files and it is no problem to edit them directly. I am using sendmail therefore I am describing my experiences with sendmail here. Your are welcome to add information about a different MTA on the talkback page below. I saw that postfix just requires that you edit the transport/transport.db and you need a definition for uucp in the master.cf that seems to be all but I have not much experience with postfix.

The m4 configuration system might not be included in the same package as sendmail it self. Check the CDs of your distribution your might need to install a package called something like "sendmail-cf".

Create a new sendmail-uucp.mc file in the cf directory for sendmail (probably /usr/lib/sendmail-cf/cf):

#divert(-1)
# `This is config sends outgoing mail via uucp using /usr/bin/uux
#
# to generate a sendmail.cf out of this .mc file use the sendmail sources
# and run m4 thisfile.mc > sendmail.cf.'
divert(0)
include(`../m4/cf.m4')
VERSIONID(`UUCP, Jan 28 2001, without DNS')
undefine(`BITNET_RELAY')
undefine(`DECNET_RELAY')
undefine(`UUCP_RELAY')
OSTYPE(`linux')
MASQUERADE_AS(miller.my-friendly-isp.com)
MASQUERADE_DOMAIN(localdomain)
MASQUERADE_DOMAIN(localhost)
# ` add any local hostnames here:'
MASQUERADE_DOMAIN(philosophus)
# ` needed if you use an internal domain that does not exist: '
FEATURE(`masquerade_envelope')
FEATURE(always_add_domain)
# ` read allowed domains from cw file: '
FEATURE(use_cw_file)
FEATURE(local_procmail)
# `important for uucp:'
FEATURE(accept_unresolvable_domains)dnl
# `the /etc/passwd entry: mail:*:8:12:mail:/var/spool/mail:'
define(`confDEF_USER_ID',``8:12'')
define(`confSAFE_QUEUE',`True')
define(`confDELIVERY_MODE',`background')dnl
# 'replace mfic by the UUCP system name of your ISP:'
define(`SMART_HOST',uucp-uudom:mfic)dnl
define(`confSERVICE_SWITCH_FILE',/etc/service.switch)dnl
define(`confHOSTS_FILE',/etc/hosts)dnl
define(`UUCP_MAILER_MAX',1024000)dnl
MAILER(procmail)dnl
MAILER(local)dnl
MAILER(smtp)dnl
MAILER(uucp)dnl
Adapt the file to your situation and compile it with the command:
m4 sendmail-uucp.mc > sendmail.cf
Copy the sendmail.cf file to /etc and restart sendmail with
/etc/rc.d/init.d/sendmail restart
The above path for the init script is for redhat/mandrake. It's different for Suse, Debian etc...

In the /etc/service.switch file you should use:
hosts   files
aliases files
Now send an E-mail to somebody. You can do this with your favorite mail program or directly from the unix command line using:
echo "hello john, just testing..." | Mail john@somewhere.org
This mail will not directly be send out. Instead it will be queued in the UUCP system. You should see it if you run:
uustat -a
uustat will print:
mfic.CRJjd4uAAAPs mfic joe 07-24 20:19 Executing rmail john@somewhere.org
(sending 50 bytes)
Next run
/usr/sbin/uucico -x 11 -S mfic
mfic is again the UUCP system name at my-friendly-isp.com. You can now watch the Debug file and observe how the mail is sent out.  

All automatic

Create the following /usr/bin/uumail script:
#!/bin/sh
hostn=uucp.my-friendly-isp.com
# first check that the server of my ISP is reachable.
# This requires a more recent version of ping where you can
# specify the timeout:
if ping -w 3 -qn -c 1 $hostn > /dev/null ; then
  /usr/sbin/uucico -S mfic
  #sleep 1
  #uulog -s mfic -5
else
  echo "ERROR: $hostn is down"
  exit 1
fi
Make the script executable with "chmod 755 /usr/bin/uumail" and run it manually to see that it works.

To exchange e-mails automatically every time you go online just add the line /usr/bin/uumail to /etc/ppp/ip-up.

Ok, that's it. Your mail system is up and running.  

Things to do

The mail system is completely configured. All the users (/etc/passwd, command adduser) will automatically be able to send and receive mail. The mail will be stored in the traditional spool folders under /var/spool/mail and can be read locally. If you want that user are able to read the mail via the protocols pop3 or imap then you need to install a package which is usually called "imap" and provides the daemons /usr/sbin/imapd and /usr/sbin/ipop3d
In /etc/inetd.conf you just start them by uncommenting the lines:
pop-3   stream  tcp     nowait  root    /usr/sbin/tcpd  ipop3d
imap    stream  tcp     nowait  root    /usr/sbin/tcpd  imapd
If you have xinetd then you need to create an appropriate config file for this service (see as well the LinuxFocus article 175 on this subject). Remember as well to enable access in the /etc/hosts.allow file if users access mail from other host in your local LAN:
# hosts.allow , tcp wrapper config file
# anybody can get access to imap:
imapd: ALL
# pop3 is only allowed from 2 hosts:
ipop3d: 10.0.0.1, 10.0.0.2, 127.0.0.1
 

Finding an ISP

Finding a good and reliable Internet Service Provider for UUCP is sometimes not easy especially since most ISPs target at Mr. Noclue Windowspreinstalled.

I know 2 rather good ISPs in Germany that do offer E-mail over UUCP:

Both of them are organizations and you basically join the organization to use the service. Prices are roughly between 11 and 20 Euro per Month.

At LinuxFocus.org we can as well provide e-mail over UUCP to a limited number of friendly Linux fans, if you join our organization and support us financially and/or work with us regularly. Contact me if you are interested.

A good way to find a suitable ISP in your country might be to just try a search in Google or any other search engine. The smaller more service and customer oriented ISPs will most likely have e-mail over UUCP as a product.

 

References

 

Talkback form for this article

Every article has its own talkback page. On this page you can submit a comment or look at comments from other readers:
 talkback page 

Webpages maintained by the LinuxFocus Editor team
© Guido Socher, FDL
LinuxFocus.org

Click here to report a fault or send a comment to LinuxFocus

2001-09-06, generated by lfparser version 2.17