Changeset 2093


Ignore:
Timestamp:
Dec 17, 2011, 12:00:18 AM (13 years ago)
Author:
geofft
Message:
d_zroot: Don't accidentally let @recipients be empty

d_zroot.pl fails to notice when the .k5login is nonexistent/empty, and
when it runs ("zwrite", "-c", "scripts-spew", @k5login), it ends up
giving zwrite no recipients, which causes the message to go to
<scripts-spew,*,*>. This has the potential to leak sensitive logs on a
misconfigured server.

Fix this by redacting messages and also warning at startup if the
.k5login is empty.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/fedora/config/etc/syslog-ng/d_zroot.pl

    r2066 r2093  
    1717@USERS{@USERS} = undef;
    1818
    19 sub zwrite($;$$@) {
    20     my ($message, $class, $instance, @recipients) = @_;
     19sub zwrite($;$$\@) {
     20    my ($message, $class, $instance, $recipref) = @_;
     21    my @recipients = ();
     22    if (defined($recipref)) {
     23        if (@$recipref) {
     24            @recipients = @$recipref;
     25        } else {
     26            $message = '@b(Empty recipient list specified, message redacted)';
     27        }
     28    }
    2129    $class ||= $ZCLASS;
    2230    $instance ||= 'root.'.hostname;
     
    2432    print ZWRITE $message;
    2533    close(ZWRITE);
     34}
     35
     36unless (@RECIPIENTS) {
     37    zwrite('@b(No .k5login found, sensitive logs will not be zephyred)', $ZCLASS);
    2638}
    2739
     
    126138
    127139    foreach my $class (keys %toclass) {
    128         if ($class eq "scripts-auto") {
     140        if ($class eq $ZCLASS) {
    129141            zwrite($toclass{$class}, $class);
    130142        } else {
Note: See TracChangeset for help on using the changeset viewer.