1# Copyright (c) 2010 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 logging 6 7from autotest_lib.client.bin import test, utils 8from autotest_lib.client.common_lib import error 9 10class security_RootfsOwners(test.test): 11 """Ensures there are no files owned by chronos/chronos-access on the rootfs. 12 """ 13 version = 1 14 15 def run_once(self): 16 """ 17 Do a find on the system for rootfs files owned by chronos 18 or chronos-access. Fail if there are any. 19 """ 20 cmd = 'find / -xdev -user chronos -print -o -user chronos-access -print' 21 cmd_output = utils.system_output(cmd, ignore_status=True) 22 23 if (cmd_output != ''): 24 logging.error('chronos-/chronos-access-owned files:') 25 logging.error(cmd_output) 26 raise error.TestFail( 27 'Rootfs contains files owned by chronos or chronos-access, ' 28 'see error log') 29