Take Back Your Inbox
Not too long ago, email was a wonderful thing. It provided a fast and easy method to communicate with family, friends, and co-workers, regardless of timezone or location. Unfortunately, due to spam and viruses, many people now find email almost unusable. In this month's Tech Support, let's take back that inbox.
Spam
The first item on the agenda is eliminating spam. Spam, or unsolicited commercial email (UCE), is not only a nuisance, it's a productivity killer.
SpamAssassin (SA), which is distributed under the same license as Perl, helps put an end to this problem. Using its rule base, SA performs a wide range of heuristic tests on email headers and body text to identify and score spam. SA can also use blacklists and optional modules such as Razor, Pyzor, and a built-in Bayesian filter that learns new spam characteristics.
One of SpamAssassin's greatest assets is its flexibility. You can install SA in a wide variety of configurations, from a local install in your home directory (on a machine where you do not have root access), to a system-wide install that affects all users. You can also configure SA to allow each individual user to set their own rules, thresholds, and settings. And, because SpamAssassin tags messages by adding additional headers, it allows you to control what happens to each message.
To install SA, do the following as root:
# perl �MCPAN �e shell
cpan> install Mail::SpamAssassin
Alternatively, if you don't have root access, you can download the source from http://www.spamassassin.org and do the following after unpacking the tarball:
% cd Mail-SpamAssassin-*
% perl Makefile.PL PREFIX=~/sausr
SYSCONFDIR=~/saetc; make; make install
After you install SA, look at the configuration file called local.cf. This file allows you to whitelist certain addresses, tweak rules, add custom rules, enable/disable specific tests, and change a variety of other options.
You can also choose how you'd like to integrate SA into your MTA (if site-wide), or how you'd like to process your mail with SA (local install). SA works well with sendmail, qmail, PostFix, Exim, and most others. It can even be called via procmail, milter, AMaViS, MIMEDefang, or QMAILQUEUE.
If you installed SA in your home directory, you can put the following two rules in your procmailrc file to run SA on your mail and sort spam into a folder named caughtspam:
:0fw: spamassassin.lock
| /home/user/sausr/bin/spamassassin
:0:
* ^X-Spam-Status: Yes
caughtspam
While running SpamAssassin as above is fine for small setups, most large or system-wide configurations should consider running spamd/spamc, which improves performance by avoiding the overhead of starting Perl for each message.
Viruses
You may be thinking, "I use Linux, why do I need a virus scanner?" While it's true that not many viruses have targeted Linux, as Linux's popularity grows, it's likely that the number of viruses will increase. Beyond that, many people who run a Linux machine may have a mail server setup for a few friends and family. Some of these users likely use an operating system that is more prone to viruses. By scanning for viruses, you're not only doing them a favor, but are helping stop the spreading of viruses. After all, if everyone had an up-to-date virus scanner, the outbreaks that we've come to accept would be much less common.
Luckily, there is a free GPLed virus scanner called ClamAV (available from http://clamav.sourceforge.net/) that keeps updated definitions. Like SpamAssassin, ClamAV can be run in both system-wide and local configurations, and allows easy integration with many MTAs. It can also be called via procmail, milter, AMaViS, MIMEDefang, or QMAILQUEUE, and allows you to either reject or quarantine infected messages.
As ClamAV integration can be quite specific to your environment, specific installation and configuration instructions are beyond the scope of this article, but the install is the standard ./configure && make && make install. After installation, become acquainted with the configuration file clamav. conf, and choose between using clamscan or clamd/clamdscan. ClamAV also comes with freshclam. It can be run as a daemon or via cron to keep virus definitions up-to-date.
# perl �MCPAN �e shell
cpan> install Mail::SpamAssassin
% cd Mail-SpamAssassin-*
% perl Makefile.PL PREFIX=~/sausr
SYSCONFDIR=~/saetc; make; make install
:0fw: spamassassin.lock
| /home/user/sausr/bin/spamassassin
:0:
* ^X-Spam-Status: Yes
caughtspam
3. Still doesn't work? Lets troubleshoot.
Assuming you have rebooted, the card is well installed, lets go on troubleshooting.
First step: syslog!
A lot of errors are caught and reported to syslog. Depending on your distribution, your log may (or may not) be located at /var/log/messages, /var/log/dmesg, /var/log/syslog... etc etc... please consult whatever reference manual is available with your distribution.
The command you should run as root will be cat /var/log/messages | less or perhaps cat /var/log/messages | tail.
Less will show you the date in a scrollable way and tail will post the last messages of dmesg.
These error messages are important to you, and to us. We need to know what the error messages are and the specs of your hardware at LQ if you want us to help you optimally, if this article is not sufficient, or you can't find the solution by yourself.
If you see there is an IRQ error, you will need to play with the IRQ settings in your BIOS. To enter the BIOS, you will need to press F1, F2, ESC, or similar keys at the first splash screen of your system to get into the BIOS. This, however, is tricky for inexperienced users. For the other users, you may go right ahead and modify it. How to fix IRQ problems is outside the scope of this document.
If there isn't anything that's obvious that pops out at you while reading the syslog or dmesg messages. Lets go on to the next steps.
4. Is it a classic error? Permission, module loaded, card in use, muted, external amplifier?
The most classic error is the permission denied error, IMHO.
To quickly test out whether root can access the sound card or not, test the card (To test a card, type cat /dev/urandom > /dev/dsp, type CTRL+C to stop the action.
) as root. If it works, congratulations! You are closer to making your soundcard work. If you can also test it as a normal user, you should have no problem making the sound card work.
type these commands:
ls -l /dev/dsp
ls -l /dev/audio
ls -l /dev/mixer
The owners, user would naturally be root, and the group (on some distros) "audio".
In that case, using any available GUI tool, add your user to the audio group. or using the console, type gpasswd -a user audio . You will need to relogin for the group change to make effect.
If the permissions read this : rwx------, or didn't permit "group" or "users" to read and write. Then we have a permission issue.
As root, type chmod 660 /dev/dsp or chmod 666 /dev/dsp . do that for /dev/audio and /dev/mixer too.
You can change the user and group by typing chown root:audio /dev/dsp . Change /dev/dsp for the name of the device.
If /dev/dsp doesn't exist, it's probably because your modules aren't loaded properly. Assuming the drivers are modules, and not built in the kernel, you can know whether they are loaded by typing /sbin/lsmod . If you aren't sure what modules are needed for your soundcard.... google it... http://www.google.com
If they aren't loaded, load them using modprobe or insmod... like this, as root :
modprobe atiixp
The module name will vary.
If it is loaded... we move on to the other classical error.
If the card is in use... it's in use! You can know who uses it by typing /sbin/fuser /dev/dsp.
You can also restart the alsa service using the commands provided to you by your distro.
(gentoo: /etc/init.d/alsasound restart)
(Mandrake: service alsa restart)
You may type alsamixer, to look and modify the mixer's settings. Make sure the master's volume is high enough to hear, and not muted (having "MM" below it's bar). Use the arrow keys to raise and lower the volume. Use M to unmute and mute. Use left and right to move from one bar to the other. Make sure that PCM is high enough and not muted. If you have something called external amplifier, unmuted it.
5. Testing
To test a card, type cat /dev/urandom > /dev/dsp, type CTRL+C to stop the action.