mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
Adding custom notification on AppArmor.
This commit is contained in:
parent
41b6182019
commit
86db2263b8
1 changed files with 12 additions and 8 deletions
|
@ -234,7 +234,7 @@ sub readconf {
|
|||
s/\s+$//; # no trailing white
|
||||
next unless length; # anything left?
|
||||
my ($var, $value) = split(/\s*=\s*/, $_, 2);
|
||||
if ($var eq "show_notifications" or $var eq "use_group") {
|
||||
if ($var eq "show_notifications" or $var eq "use_group" or $var eq "message_body" or $var eq "message_title" or $var eq "message_footer") {
|
||||
$value =~ s/^"(.*)"$/$1/g;
|
||||
$prefs{$var} = $value;
|
||||
}
|
||||
|
@ -285,12 +285,16 @@ sub format_message {
|
|||
my ($profile, $operation, $name, $denied, $family, $sock_type, $date) = @_;
|
||||
|
||||
my $formatted = "";
|
||||
defined($profile) and $formatted .= "Profile: $profile\n";
|
||||
defined($operation) and $formatted .= "Operation: $operation\n";
|
||||
defined($name) and $formatted .= "Name: $name\n";
|
||||
defined($denied) and $formatted .= "Denied: $denied\n";
|
||||
defined($family) and defined ($sock_type) and $formatted .= "Family: $family\nSocket type: $sock_type\n";
|
||||
$formatted .= "Logfile: $logfile\n";
|
||||
if (defined($prefs{message_body})) {
|
||||
$formatted .= $prefs{message_body};
|
||||
} else {
|
||||
defined($profile) and $formatted .= "Profile: $profile\n";
|
||||
defined($operation) and $formatted .= "Operation: $operation\n";
|
||||
defined($name) and $formatted .= "Name: $name\n";
|
||||
defined($denied) and $formatted .= "Denied: $denied\n";
|
||||
defined($family) and defined ($sock_type) and $formatted .= "Family: $family\nSocket type: $sock_type\n";
|
||||
$formatted .= "Logfile: $logfile\n";
|
||||
}
|
||||
|
||||
return $formatted;
|
||||
}
|
||||
|
@ -386,7 +390,7 @@ sub do_notify {
|
|||
}
|
||||
|
||||
my $count = 0;
|
||||
my $footer = "For more information, please see:\n$url";
|
||||
my $footer = exists $prefs{message_footer} ? $prefs{message_footer} : "For more information, please see:\n$url";
|
||||
my $first_run = 1;
|
||||
my $since = $now;
|
||||
if ($opt_s and int($opt_s) > 0) {
|
||||
|
|
Loading…
Add table
Reference in a new issue