Apache mod_evasive can't find the mail command

Bug #605679 reported by KyleAnderson
32
This bug affects 6 people
Affects Status Importance Assigned to Milestone
libapache-mod-evasive (Debian)
Fix Released
Unknown
libapache-mod-evasive (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Binary package hint: libapache2-mod-evasive

1) Description: Ubuntu 10.04 LTS
Release: 10.04

2) libapache2-mod-evasive: 1.10.1-1

3) Mod_evasive has the "DOSEmailNotify" option to send emails, but it tries to send use /bin/mail, but on ubuntu it is /usr/bin/mail.

4) I expected it to be able to send, but go this in the logs:
[Wed Jul 14 17:13:23 2010] [notice] Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.2 with Suhosin-Patch mod_ssl/2.2.14 OpenSSL/0.9.8k configured -- resuming normal operations
sh: /bin/mail: not found

5) Solution 1: Just symlink: (what I did)
ln -s /etc/alternatives/mail /bin/mail

Solution 2: Patch the code in mod_evasive. (I'm not quite savvy enough to know how to do this, if this is the preferred solution I can try to learn how to make a patch)

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in libapache-mod-evasive (Ubuntu):
status: New → Confirmed
Changed in libapache-mod-evasive (Debian):
status: Unknown → New
Revision history for this message
Jozsef Dubravszky (0cs935kb517wwmwa7m9428daadkyev88fk76o0c6sq9gd8al-mail-wz6bkyhu4uqpfausw0ege9b0y33ege6o4wzvqwe1gy11yyt2) wrote :

Symlinking to /bin/mail does not solve the problem on Ubuntu 12.04 LTS Server. Actually the mod never calls /bin/mail. This is tested with a script logging parameters passed to /bin/mail. Like this:

#!/bin/sh
touch /path/to/logfile
echo $* > /path/to/logfile

But no log is generated so /bin/mail is never called.

Changed in libapache-mod-evasive (Debian):
status: New → Fix Released
Revision history for this message
Christian Reis (kiko) wrote :

Jozsef, does the module in Precise or Trusty work at all? I've tried enabling it but am yet to see an actual DOS lockout work for me.

Revision history for this message
Christian Reis (kiko) wrote :

Okay, so this has been fixed in Debian's 1.10.1-3, but to work around it you can actually create a /bin/mail replacement that invokes "sendmail -t". I haven't run into the problem that Jozsef indicates -- but I can imagine it will break if www-user can't invoke the command for whatever reason.

The reason you should use sendmail -t instead of mailx is that the mail is sent with the headers as part of the main message body (i.e. it doesn't provide subject and recipient as commandline arguments).

Revision history for this message
Christian Reis (kiko) wrote :

Okay, so this has been fixed in Debian's 1.10.1-3, but to work around it you can actually create a /bin/mail replacement that invokes "sendmail -t". I haven't run into the problem that Jozsef indicates -- but I can imagine it will break if www-user can't invoke the command for whatever reason.

The reason you should use sendmail -t instead of mailx is that the mail is sent with the headers as part of the main message body (i.e. it doesn't provide subject and recipient as commandline arguments). See https://bugzilla.novell.com/show_bug.cgi?id=884877 for details -- but note that the patch there won't work if mailx is used, as mailx doesn't accept a -t:

  kiko@gasolinux:~$ /usr/bin/mailx -t
  /usr/bin/mailx: invalid option -- 't'

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.