[syslog-ng] Usertty sending messages to all user and without login also

Balazs Scheidler bazsi at balabit.hu
Thu Jul 24 10:28:06 CEST 2008


On Wed, 2008-07-23 at 13:39 +0530, Anurag Agarwal wrote:
> Hello everybuddy,
>  
> I am using syslog-ng and used usertty in destination. I am using a user
> 'test' as destination. But other users can also see the message on their
> console e.g root and other users. Please help as this is creating a
> problem and NG not working as desired.
>  OS: Solaris 10
> 

It does work for me. Can you show us the relevant portions of your
configuration file? I tried with this:

source local { sun-streams("/dev/log" door("/etc/.syslog_door"));
internal(); };

destination all { file("/var/log/messages"); };

log { source(local); destination(all); };

destination all_users {
  usertty("bazsi");
};

filter alert_emerg {
  level(err..emerg);
};
log {
  source(local);
  filter(alert_emerg);
  destination(all_users);
};


It correctly printed err..emerg messages on my tty, and not on others.
The relevant portion of the code is here:

#if HAVE_MODERN_UTMP
      if (ut->ut_type == USER_PROCESS &&
          ((self->username->len == 1 &&
            self->username->str[0] == '*') ||
           (self->username->len <= sizeof(ut->ut_user) &&
            memcmp(self->username->str, ut->ut_user, self->username->len) == 0))) 
#else
      if ((self->username->len == 1 &&
           self->username->str[0] == '*') ||
          (self->username->len <= sizeof(ut->ut_name) &&
           memcmp(self->username->str, ut->ut_name, self->username->len) == 0)) 
#endif

I don't see how this condition could match for everyone. Even if the
wtmp format is different and ut->ut_name would contain a bogus value,
the expected breakage would be to not display anywhere, not to display
everywhere.

-- 
Bazsi



More information about the syslog-ng mailing list