[Testers wanted] /dev/console cleanups

Carlos A. M. dos Santos unixmania at gmail.com
Wed Nov 19 03:33:07 PST 2008


On Tue, Nov 18, 2008 at 7:34 PM, Ed Schouten <ed at 80386.nl> wrote:
> Hello Carlos, others,
>
> * Ed Schouten <ed at 80386.nl> wrote:
>> About the /dev/console issues: Robert Watson and I discussed this some
>> time ago on IRC and what I did in HEAD (not RELENG_7) was that I changed
>> TIOCCONS not to take a look at the permissions of /dev/console, but we
>> changed it to use priv_check(). This means that right now you can only
>> call TIOCCONS as root. I can't really understand why the problem exists
>> on RELENG_7.
>>
>> About making xconsole setuid: I've read the messages you mentioned, but
>> I think we could just alter console to call TIOCCONS and just drop
>> privileges. An even better solution would be to just get rid of TIOCCONS
>> and invent a better solution to capture syslog messages. I can't really
>> understand why we want to abuse TTY's to do this.
>>
>> So I can't say we're working on this, but at least I can confirm the
>> issue.
>
> One solution would be to let xconsole just display /var/log/messages.
> There shouldn't be a valid reason to let syslogd print messages to
> /dev/console and capture them again using TIOCCONS. We could just
> instruct xconsole to read its data from the log files.
>
> If you save the attached patch as /usr/ports/x11/xconsole/files/
> patch-xconsole.c (create directory first) and recompile xconsole, it
> will use the log file.
>
> I'll discuss this with others to decide if we should take such an
> approach.

It is not necessary to patch xconsole to accomplish this. Using the
-file command line argument would be enough. Be warned, however, that

1. messages sent straight to /dev/console will not show up at the
xconsole window;

2. with large files it will become slow and consume lots of memory,
because it will load the entire contents of /mar/log/messages to its
text buffer;

3. it will show *all* messages, not only the urgent ones, which is not
necessarily the desired behavior;

4. it will stop working upon log rotation.

-- 
cd /usr/ports/sysutils/life
make clean


More information about the freebsd-hackers mailing list