Tips from The Answer Guy

Learn how to block mail your mail and tighten your security from The Answer Guy.
Dealing with E-mail on a POP3 Server

Is there any way (or any program out there) which will not only get my e-mail from a POP3 server off of one account, but distribute it to multiple users on my system by either the from: or subject: lines?

Perhaps popclient could get the mail and save to temp. Then a program could go through the saved mail and say, “Hmmm, this mail is from and it goes to root—then the next message is from and it goes to Dave.” Is there a program that will do this? —Moe Green,

And the Answer Is...

It is possible to write procmail scripts that can take this sort of action for you. Although I don't recommend this approach, I'll tell you how to do it.

The current version of popclient is called fetchmail, because it supports IMAP and some other mail store and forward protocols. The fetchmail default is to fetch the mail from your POP or IMAP server and feed it to the smtpd (sendmail) on your local host. This means that any special processing that would be done by the aliases or .forward files (especially any processing through procmail scripts) will be done automatically.

It is possible to override that feature and feed the messages through a pipe or into a file. It is also possible, using procmail or any scripting language, to parse and dispatch the file. Using anything other than procmail would require that you know a lot about RFC822, the standard for Internet mail headers, and about e-mail in general.

I wrote an article on procmail that appears in February's Linux Gazette, Issue 14. The gist of it is also available on my own mail server, and can be obtained by sending mail to with a subject of procmail or mailbot.

The reason I don't recommend using procmail in this way is that it violates the intentions and design of Internet e-mail. A better solution is to find a provider of UUCP (Unix-to-Unix CoPy) services or at least SMTP/MX (Simple Mail Transfer Protocol) services. UUCP is the right way to provide e-mail to disconnected (dial-up) hosts and networks. It was designed and implemented over 25 years ago, and all of the mail systems on the Internet know how to gateway to UUCP sites.

As for SMTP/MX services for disconnected hosts/networks, there are various ways of hacking sendmail and DNS (Domain Name Service) configurations that have been developed in the last few years with a variety of shell scripts and custom programs to support them. All of these methods provide essentially the same services as mail via UUCP over TCP but do not conform to any standard, which means that whatever you learn and configure with one ISP probably won't work with the next one. —Jim

Security Problem

Recently a cracker got into my Linux system on the Internet. He didn't do a lot of damage, but I guess he did turn off system logging, since I couldn't see what he'd done. Now I can't get it working again. Here's what I've done so far:

  1. I've made sure that the syslogd program is running using ps.

  2. I've read the syslogd.conf file to make sure it's logging everything, and where it's going to.

  3. I've checked permissions on the log file.

  4. I did a kill -HUP on the syslogd process, and it writes restart to the log.

  5. logger does nothing when I run it (no log entry, no error).

  6. All my C programs that wrote to syslog don't anymore.

Anyone have any good ideas what to do from here? —

And the Answer Is...

I do, but they are rather too involved for me to type up tonight. However, I highly recommend that you reinstall the OS and all binaries from scratch whenever you think root has been compromised on your system. I realize this is a time-consuming proposition, but it is the only way to truly be sure.

I also recommend the program tripwire that can be found at in the COAST archive, and its mirrors.

Please feel free to write me at if you continue to have system security problems.

Sorry to take so long to respond. I've been literally swamped all month. —Jim

More on Security

I found that the cracker had replaced my syslogd with a packet sniffer. I think he had copied the syslogd code and replaced parts of it with his sniffer. It seemed to have some functionality but not a lot...

I also found a SUID version of bash in my /tmp directory. My thought is this is the way he originally got root access. —Jay

Not too surprising. He was probably using a rootkit; however, he obviously didn't do a very good job of covering his tracks. You should consider all passwords for all of the systems on the local net to be compromised. Force password changes across the board and consider installing ssh or stelnet. Both are secure, encrypted replacements to rlogin/rsh and telnet respectively.

He probably got in through the “Leshka” sendmail bug that allows any shell user to create a root-owned SUID shell in /tmp/ on any system that has an SUID root copy of sendmail (version ~8.6.x to 8.7.x ?). The bug involves sendmail's handling of ARGV[0] and it's subsequent SIGHUP (signal to disconnect) handling. Everyone using earlier versions of sendmail should upgrade to 8.8.3 or later (see for details).

How important are this system and the other systems on the same LAN segment to your business? I'd seriously consider hiring a qualified consultant for a full day risk assessment and audit. Unfortunately, you'll probably pay at least $125/hr for anyone that's worth talking to, and many of the “security consultants” out there are snake oil salesmen, so beware. —Jim

This article was first published in Issue 14 of, an on-line e-zine formerly published by Linux Journal.

Jim Dennis is the proprietor of Starshine Technical Services. His professional experience includes work in technical support, quality assurance and information services (MIS) for software companies like Quarterdeck, Symantec/Peter Norton Group and McAfee Associates—as well as positions with smaller VARs. He's been using Linux since version 0.99p10 and is an active participant on an ever-changing list of mailing lists and newsgroups. He's just started collaborating on the 2nd Edition for a book on Unix systems administration. Jim is an avid science fiction fan—and recently got married at the World Science Fiction Convention in Anaheim