[5879] in Moira
[PATCH] Create the moira logfile with umask 077
daemon@ATHENA.MIT.EDU (Geoffrey Thomas)
Sat Nov 27 22:14:23 2010
Date: Sat, 27 Nov 2010 22:14:16 -0500 (EST)
From: Geoffrey Thomas <geofft@MIT.EDU>
To: moiradev@mit.edu
Message-ID: <alpine.DEB.1.10.1011272050390.15830@dr-wily.mit.edu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII
When you "toggle logging on" in the Moira command, the logfile in /var/tmp
should not be created world-readable, as it will almost certainly include
private information.
This may have been less important in the past when the default Athena
umask was 077 instead of 022 (but users could still override that).
Index: clients/moira/menu.c
===================================================================
--- clients/moira/menu.c (revision 4023)
+++ clients/moira/menu.c (working copy)
@@ -802,13 +802,16 @@
int toggle_logging(int argc, char *argv[])
{
char buf[BUFSIZ];
+ mode_t oldmask;
if (!log_file)
{
sprintf(buf, "%s/%s-log.%d", get_tmp_dir(), whoami, getpid());
/* open the file */
+ oldmask = umask(077);
log_file = fopen(buf, "a");
+ umask(oldmask);
if (!log_file)
Put_message("Open of log file failed. Logging is not on.");