--detect-forged-email-address

git-svn: trunk@1323
remotes/push_mirror/metadata
Nigel Horne 21 years ago
parent 72d627851c
commit 358facc318
  1. 5
      clamav-devel/ChangeLog
  2. 8
      clamav-devel/clamav-milter/INSTALL
  3. 81
      clamav-devel/clamav-milter/clamav-milter.c
  4. 419
      clamav-devel/clamav-milter/clamav-milter.po
  5. 6
      clamav-devel/docs/man/clamav-milter.8

@ -1,3 +1,8 @@
Mon Feb 7 22:13:47 GMT 2005 (njh)
----------------------------------
* clamav-milter: --detect-forged-email-address
--external: NUL terminate the string read from clamd
Sun Feb 6 22:22:10 CET 2005 (tk)
---------------------------------
* contrib/clamdwatch: v0.7.1 (http://mikecathey.com/code/clamdwatch/)

@ -91,7 +91,7 @@ See http://www.nmt.edu/~wcolburn/sendmail-8.12.5/libmilter/docs/sample.html
Installations for RedHat Linux and it's derivatives such as YellowDog:
Ensure that you have the sendmail-devel RPM installed
Add to /etc/mail/sendmail.mc:
Add to /etc/mail/sendmail.mc before the MAILER statement:
INPUT_MAIL_FILTER(`clamav', `S=local:/var/run/clamav/clmilter.sock, F=, T=S:4m;R:4m')dnl
define(`confINPUT_MAIL_FILTERS', `clamav')
@ -183,7 +183,9 @@ the remote end to resend later (temporary failure), setting F=R will reject
the email and setting F= will pass the email through, in this case you should
warn your users that emails are not being scanned.
Don't forget to rebuild sendmail.cf after modifying sendmail.mc.
Don't forget to rebuild sendmail.cf after modifying sendmail.mc. You will
need to restart sendmail after rebuilding sendmail.cf and starting clamd and
clamav-milter.
As with all software it is wise to ensure that clamav-milter has the least
privileges it needs to run. So don't run it as root and don't store the sockets
@ -679,6 +681,8 @@ Changes
0.82 6/2/05: On Solaris, ensure when quarantining a file that the
old location is removed
Up issue
0.82a 7/2/05: Added --detect-forged-email-address
NUL terminate the string read from clamd
INTERNATIONALISATION

@ -26,6 +26,9 @@
*
* Change History:
* $Log: clamav-milter.c,v $
* Revision 1.178 2005/02/07 22:11:21 nigelhorne
* --detect-forged-email-address
*
* Revision 1.177 2005/02/06 10:39:39 nigelhorne
* 0.82
*
@ -542,9 +545,9 @@
* Revision 1.6 2003/09/28 16:37:23 nigelhorne
* Added -f flag use MaxThreads if --max-children not set
*/
static char const rcsid[] = "$Id: clamav-milter.c,v 1.177 2005/02/06 10:39:39 nigelhorne Exp $";
static char const rcsid[] = "$Id: clamav-milter.c,v 1.178 2005/02/07 22:11:21 nigelhorne Exp $";
#define CM_VERSION "0.82"
#define CM_VERSION "0.82a"
#if HAVE_CONFIG_H
#include "clamav-config.h"
@ -886,6 +889,11 @@ static int advisory = 0; /*
* are flagged rather than deleted. Incompatible
* with quarantine options
*/
static int detect_forged_local_address; /*
* for incoming only mail servers, drop emails
* claiming to be from us that must be false
* Requires that -o, -l or -f are NOT given
*/
static short use_syslog = 0;
static const char *pidFile;
static int logVerbose = 0;
@ -967,6 +975,7 @@ help(void)
puts(_("\t--broadcast\t\t-B [IFACE]\tBroadcast to a network manager when a virus is found."));
puts(_("\t--config-file=FILE\t-c FILE\tRead configuration from FILE."));
puts(_("\t--debug\t\t\t-D\tPrint debug messages."));
puts(_("\t--detect-forged-local-address\t-L\tReject mails that claim to be from us."));
puts(_("\t--dont-log-clean\t-C\tDon't add an entry to syslog that a mail is clean."));
puts(_("\t--dont-scan-on-error\t-d\tPass e-mails through unscanned if a system error occurs."));
puts(_("\t--dont-wait\t\t\tAsk remote end to resend if max-children exceeded."));
@ -1049,9 +1058,9 @@ main(int argc, char **argv)
for(;;) {
int opt_index = 0;
#ifdef CL_DEBUG
const char *args = "a:AbB:c:CDefF:lm:nNop:PqQ:dhHs:St:T:U:Vx:";
const char *args = "a:AbB:c:CdDefF:lLm:nNop:PqQ:hHs:St:T:U:Vx:";
#else
const char *args = "a:AbB:c:CDefF:lm:nNop:PqQ:dhHs:St:T:U:V";
const char *args = "a:AbB:c:CdDefF:lLm:nNop:PqQ:hHs:St:T:U:V";
#endif
static struct option long_options[] = {
@ -1070,6 +1079,9 @@ main(int argc, char **argv)
{
"config-file", 1, NULL, 'c'
},
{
"detect-forged-local-address", 0, NULL, 'L'
},
{
"dont-log-clean", 0, NULL, 'C'
},
@ -1212,6 +1224,9 @@ main(int argc, char **argv)
case 'l': /* scan mail from the lan */
lflag++;
break;
case 'L': /* detect forged local addresses */
detect_forged_local_address++;
break;
case 'm': /* maximum number of children */
max_children = atoi(optarg);
break;
@ -1308,6 +1323,21 @@ main(int argc, char **argv)
return EX_CONFIG;
}
if(detect_forged_local_address) {
if(oflag) {
fprintf(stderr, _("%s: --detect-forged-local-addresses is not compatible with --outgoing\n"), argv[0]);
return EX_CONFIG;
}
if(lflag) {
fprintf(stderr, _("%s: --detect-forged-local-addresses is not compatible with --local\n"), argv[0]);
return EX_CONFIG;
}
if(fflag) {
fprintf(stderr, _("%s: --detect-forged-local-addresses is not compatible with --force\n"), argv[0]);
return EX_CONFIG;
}
}
if(Bflag) {
int on;
@ -2491,6 +2521,22 @@ clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr)
return SMFIS_ACCEPT;
}
if(detect_forged_local_address) {
char me[MAXHOSTNAMELEN + 1];
if(gethostname(me, sizeof(me) - 1) < 0) {
if(use_syslog)
syslog(LOG_WARNING, _("clamfi_connect: gethostname failed"));
return SMFIS_CONTINUE;
}
if(strcasecmp(hostname, me) == 0) {
if(use_syslog)
syslog(LOG_NOTICE, _("Rejected email falsely claiming to be from here"));
smfi_setreply(ctx, "550", "5.7.1", _("You have claimed to be me, but you are not"));
broadcast(_("Forged local address detected"));
return SMFIS_REJECT;
}
}
return SMFIS_CONTINUE;
}
@ -2597,6 +2643,22 @@ clamfi_envfrom(SMFICTX *ctx, char **argv)
if(hflag)
privdata->headers = header_list_new();
if(detect_forged_local_address) {
char me[MAXHOSTNAMELEN + 1];
if(gethostname(me, sizeof(me) - 1) < 0) {
if(use_syslog)
syslog(LOG_WARNING, _("clamfi_connect: gethostname failed"));
return SMFIS_CONTINUE;
}
if(strstr(argv[0], me)) {
if(use_syslog)
syslog(LOG_NOTICE, _("Rejected email falsely claiming to be from %s"), argv[0]);
smfi_setreply(ctx, "550", "5.7.1", _("You have claimed to be me, but you are not"));
broadcast(_("Forged local address detected"));
return SMFIS_REJECT;
}
}
if(smfi_setpriv(ctx, privdata) == MI_SUCCESS)
return SMFIS_CONTINUE;
@ -2939,16 +3001,19 @@ clamfi_eom(SMFICTX *ctx)
#endif
if(external) {
int nbytes;
#ifdef SESSION
#ifdef CL_DEBUG
if(debug_level >= 4)
cli_dbgmsg(_("Wating to read status from fd %d\n"),
session->sock);
#endif
if(clamd_recv(session->sock, mess, sizeof(mess)) > 0) {
nbytes = clamd_recv(session->sock, mess, sizeof(mess) - 1);
#else
if(clamd_recv(privdata->cmdSocket, mess, sizeof(mess)) > 0) {
nbytes = clamd_recv(privdata->cmdSocket, mess, sizeof(mess) - 1);
#endif
if(nbytes > 0) {
mess[nbytes] = '\0';
if((ptr = strchr(mess, '\n')) != NULL)
*ptr = '\0';
@ -3346,7 +3411,7 @@ clamfi_eom(SMFICTX *ctx)
snprintf(reject, sizeof(reject) - 1, _("virus %s detected by ClamAV - http://www.clamav.net"), virusname);
smfi_setreply(ctx, (char *)privdata->rejectCode, "5.7.1", reject);
broadcast(mess);
} else if((ptr = strstr(mess, "OK")) == NULL) {
} else if(strstr(mess, "OK") == NULL) {
if(!nflag)
smfi_addheader(ctx, "X-Virus-Status", _("Unknown"));
if(use_syslog)
@ -4469,6 +4534,8 @@ move(const char *oldfile, const char *newfile)
fclose(fout);
#endif
cli_dbgmsg("removing %s\n", oldfile);
return unlink(oldfile);
}

File diff suppressed because it is too large Load Diff

@ -207,6 +207,12 @@ Used in conjuction with max\-children. If clamav\-milter waits for more than
\fIn\fR seconds (default 0) it proceeds with scanning. Setting \fIn\fR to zero
will turn off the timeout and clamav\-milter will wait indefinately for the
scanning to quit. In practice the timeout set by sendmail will then take over.
.TP
\fB\-\-detect-forged-local-address \-L\fR
When neither \-\-force, \-\-local nor \-\-outgoing is given,
this option intercepts incoming mails that incorrectly claim to be from the
local domain.
While this is not an Anti-Virus function, it is quite useful for some systems.
.SH "BUGS"
There is no support for IPv6.
.SH "EXAMPLES"

Loading…
Cancel
Save