RHEL/Centos – Program Setting /var/log/boot.log to 644 Permissions

centoslogspermissionsrhel

I've been assigned to lock down all /var/log files so that they cannot be read except by the root user. I've been stumped by the /var/log/boot.log file. It seems that after every boot the file no matter what what previous permission state gets set to 644 permissions.

I've gone through the exercise of changing the umask in a number of key /etc/init.d files and functions to no avail.

Anybody got any idea as to the specific program doing this and maybe how to get the perms on /var/log/boot.log to be 600?

Best Answer

Via a fgrep -r boot.log /usr, it is plymouth to blame. The plymouth manual page is uh kinda lacking on Centos 6, though a romp through the source code does show that there is a no_boot_log option, apparently that can be set by passing no-boot-log somewhere (assuming you're okay with no logs from plymouth). Ah! With more digging there is a world_readable flag that twiddles the mode used for the open(2) call, except this is set only as the third argument to

        log_is_opened = ply_logger_open_file (session->logger, filename, true);

Sad trombone. Anyways, you'll probably be fiddling with the initrd image to customize this, or maybe filing bug reports with RedHat to a) write some damn docs so that less source code spelunking is required and b) offer an option somehow to configure that mode perhaps via kernel arg or something.

Related Question