1# Copyright (c) 2012 The Chromium OS Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5import grp 6import logging 7import os 8import pwd 9import stat 10 11from autotest_lib.client.bin import test, utils 12from autotest_lib.client.common_lib import error 13 14class security_SysLogPermissions(test.test): 15 version = 1 16 17 def run_once(self, baseline='suid'): 18 syslog_uid = pwd.getpwnam('syslog').pw_uid 19 syslog_gid = grp.getgrnam('syslog').gr_gid 20 st = os.stat('/var/log') 21 if not (st.st_mode & stat.S_ISVTX): 22 raise error.TestFail('/var/log is not sticky') 23 if st.st_gid != syslog_gid: 24 raise error.TestFail('/var/log is not group syslog') 25 st = os.stat('/var/log/messages') 26 if st.st_uid != syslog_uid: 27 raise error.TestFail('/var/log/messages is not user syslog') 28