[Mimedefang] Syslog facility inconsistency.
John Nemeth
jnemeth at victoria.tc.ca
Sat Sep 4 21:24:40 EDT 2010
On Dec 17, 9:19am, Cale Fairchild wrote:
} On Tue, 24 Aug 2010, John Nemeth wrote:
} > Cale Fairchild wrote:
} > }
} > } I am setting up a mail server with mimedefang 2.70 and I have run into
} > } logging inconsistencies.
} > }
} > } I have set up md_graphdefang_log_enable('local5', 1) and most of the
} > } logging is going to the appropriate place, however I am also using the
} > } md_check_against_smtp_server function in a filter_recipient check and all
} > } the logging associated with that function is still being logged to the
} > } mail facility. I believe that I have found the place to change this in the
} > } mimedefang.pl but I wanted to make sure I will not break anything.
} > }
} > } Sorry if this has already been addressed, I could not find anything in
} > } searching the mailing list archives.
} > }
} > } --- mimedefang.pl.dist 2010-08-09 21:51:04.000000000 -0400
} > } +++ mimedefang.pl 2010-08-24 21:18:00.000000000 -0400
} > } @@ -7518,13 +7518,13 @@
} > } if ($code =~ /^[123]/) {
} > } $retval = 'CONTINUE';
} > } } elsif ($code =~ /^4/) {
} > } - md_syslog('info', "$MsgID: md_check_against_smtp_server
} > } for $recip on $server returned $code $dsn $text");
} > } + md_syslog("$GraphDefangSyslogFacility|info", "$MsgID:
} > } md_check_against_smtp_server for $recip on $server returned $code $dsn
} > } $text");
} >
} > "info" is a logging level, not a logging facility, so this patch is
} > completely wrong. Also, there is no reason why general logging and
} > graphdefang logging have to go to the same place and it would be wrong to
} > force that. Finally, MIMEDefang provides $SyslogFacility and md_openlog()
} > for specifying the facility. See man mimedefang-filter.
}
} Actually the syntax of both uses of md_syslog was pulled from the current
} mimedefang.pl (2.70)
}
} line 7621: md_syslog('info', "$MsgID: ...
That would be 7521.
} line 7265: md_syslog("$GraphDefangSyslogFacility|info", "MDLOG,$id ...
}
} So they seem to both be valid, if undocumented, which is why I sent this
} question to the mailing list.
Okay, undocumented in man mimedefang-filter, but the underlying
functions Unix::Syslog::syslog or Sys::Syslog::syslog are documented as
accepting it.
} The usage in line 7265 redirects the syslog messages to the facility which
} is set up in the mimedefang-filter example file:
} md_graphdefang_log_enable('local5', 1);
As expected since that line is in md_graphdefang_log().
} The usage in line 7621 forwards it to the mail facility no matter what
} parameters the md_graphdefang_log_enable is called with.
Why would you expect general logging to be affected by something
that is quite obviously specifically for GraphDefang?
} The part that confuses me is that the general logging is being rediected
} to local5 as directed in the md_graphdefang_log_enable call which lead me
Something seems to be seriously confused here. Maybe you should
post your entire mimedefang-filter somewhere so that it can be
reviewed.
} to assume that this function sets the $SyslogFacility variable. It is the
No, md_graphdefang_log_enable() uses $SyslogFacility as a default
if you don't pass it a facility; it does not set $SyslogFacility. It
is a very short and simple function and easily read.
} built in function feedback from the function md_check_against_smtp_server
} which is still being directed to the LOG_MAIL facility. I read the
$SyslogFacility is set to LOG_MAIL by default, which would be the
most sane default.
} mimedefang-filter man page many times and it still appears to me when
} looking at the code that the logging in this particular function may not
} be set up the same as the other logging within the mimedefang.pl program.
It is setup the same as any other general logging.
} Perhaps I am just being obtuse but something just doesn't seem right.
Either set $SyslogFacility which will be used in an implicit call
to md_openlog() the first time something calls md_syslog(), or
explicitly call md_openlog() yourself.
}-- End of excerpt from Cale Fairchild
More information about the MIMEDefang
mailing list