3
# $Id: audit 483 2007-03-23 19:52:22Z steve-beattie $
5
# ----------------------------------------------------------------------
6
# Copyright (c) 2005 Novell, Inc. All Rights Reserved.
8
# This program is free software; you can redistribute it and/or
9
# modify it under the terms of version 2 of the GNU General Public
10
# License as published by the Free Software Foundation.
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with this program; if not, contact Novell, Inc.
20
# To contact Novell about this file by physical or electronic mail,
21
# you may find current contact information at www.novell.com.
22
# ----------------------------------------------------------------------
28
use Immunix::SubDomain;
35
# initialize the local poo
36
setlocale(LC_MESSAGES, "");
37
textdomain("apparmor-utils");
45
'dir|d=s' => \$profiledir,
49
# tell 'em how to use it...
50
&usage && exit if $help;
52
# let's convert it to full path...
53
$profiledir = get_full_path($profiledir);
55
unless (-d $profiledir) {
56
UI_Important("Can't find subdomain profiles in $profiledir.");
60
# read the settings in /etc/logprof.conf
63
# what are we profiling?
64
my @profiling = @ARGV;
67
@profiling = (UI_GetString("Please enter the program to switch to audit mode: ", ""));
70
for my $profiling (@profiling) {
72
next unless $profiling;
76
$fqdbin = get_full_path($profiling);
79
if ($profiling !~ /\//) {
80
my $which = which($profiling);
82
$fqdbin = get_full_path($which);
90
if ($fqdbin =~ /^$profiledir\//) {
93
$filename = getprofilefilename($fqdbin);
96
# argh, skip directories
97
next unless -f $filename;
99
# skip rpm backup files
100
next if isSkippableFile($filename);
102
printf(gettext('Setting %s to audit mode.'), $fqdbin);
104
setprofileflags($filename, "audit");
106
system("cat $filename | $parser -I$profiledir -r >/dev/null 2>&1")
107
if check_for_subdomain();
109
if ($profiling =~ /^[^\/]+$/) {
110
UI_Info(sprintf(gettext('Can\'t find %s in the system path list. If the name of the application is correct, please run \'which %s\' as a user with the correct PATH environment set up in order to find the fully-qualified path.'), $profiling, $profiling));
113
UI_Info(sprintf(gettext('%s does not exist, please double-check the path.') . $profiling));
122
UI_Info(sprintf(gettext("usage: \%s [ -d /path/to/profiles ] [ program to switch to audit mode ]"), $0));