~ubuntu-branches/ubuntu/precise/apparmor/precise-security

« back to all changes in this revision

Viewing changes to debian/patches/0011-apparmor-lp872446.patch

  • Committer: Package Import Robot
  • Author(s): Steve Beattie, Jamie Strandboge, Serge Hallyn, Steve Beattie
  • Date: 2012-04-12 06:17:42 UTC
  • Revision ID: package-import@ubuntu.com-20120412061742-9v75hjko2mjtbewv
Tags: 2.7.102-0ubuntu3
[ Jamie Strandboge ]
* debian/patches/0007-ubuntu-manpage-updates.patch: update apparmor(5)
  to describe Ubuntu's two-stage policy load and how to add utilize it
  when developing policy (LP: #974089)

[ Serge Hallyn ]
* debian/apparmor.init: do nothing in a container.  This can be
  removed once stacked profiles are supported and used by lxc.
  (LP: #978297)

[ Steve Beattie ]
* debian/patches/0008-apparmor-lp963756.patch: Fix permission mapping
  for change_profile onexec (LP: #963756)
* debian/patches/0009-apparmor-lp959560-part1.patch,
  debian/patches/0010-apparmor-lp959560-part2.patch: Update the parser
  to support the 'in' keyword for value lists, and make mount
  operations aware of 'in' keyword so they can affect the flags build
  list (LP: #959560)
* debian/patches/0011-apparmor-lp872446.patch: fix logprof missing
  exec events in complain mode (LP: #872446)
* debian/patches/0012-apparmor-lp978584.patch: allow inet6 access in
  dovecot imap-login profile (LP: #978584)
* debian/patches/0013-apparmor-lp800826.patch: fix libapparmor
  log parsing library from dropping apparmor network events that
  contain ip addresses or ports in them (LP: #800826)
* debian/patches/0014-apparmor-lp979095.patch: document new mount rule
  syntax and usage in apparmor.d(5) manpage (LP: #979095)
* debian/patches/0015-apparmor-lp963756.patch: Fix change_onexec
  for profiles without attachment specification (LP: #963756,
  LP: #978038)
* debian/patches/0016-apparmor-lp968956.patch: Fix protocol error when
  loading policy to kernels without compat patches (LP: #968956)
* debian/patches/0017-apparmor-lp979135.patch: Fix change_profile to
  grant access to /proc/attr api (LP: #979135)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Origin: upstream, lp:apparmor
 
2
Subject: aa-logprof - fix handling of 'exec' events (LP: #872446)
 
3
revno: 2016
 
4
fixes bug: https://launchpad.net/bugs/872446
 
5
committer: Steve Beattie <sbeattie@ubuntu.com>
 
6
branch nick: apparmor
 
7
timestamp: Tue 2012-03-27 17:15:50 -0700
 
8
message:
 
9
  Subject: aa-logprof - fix handling of 'exec' events (LP: #872446)
 
10
  
 
11
  Bug: https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/872446
 
12
  
 
13
  Due to logging changes for 'exec' events, 'exec' events in aa-logprof
 
14
  were being skipped when a profile is in enforcing mode. This patch
 
15
  addresses the issue.
 
16
 
 
17
and
 
18
 
 
19
revno: 2018
 
20
committer: Steve Beattie <sbeattie@ubuntu.com>
 
21
branch nick: apparmor
 
22
timestamp: Tue 2012-03-27 17:18:44 -0700
 
23
message:
 
24
  Subject: fix autodep profile construction
 
25
  
 
26
  This patch fixes a couple of issue with autodep:
 
27
  
 
28
    1) The initial profile construction had not been adjusted to include
 
29
       the 'allow' or 'deny' hash prefixing the path elements. This
 
30
       fixes it by eliminating the path portion entirely and pushing
 
31
       the path based accesses to the later analysis section of code.
 
32
  
 
33
    2) the mode of the original binary was accidentally getting reset
 
34
       to 0, when it was intended to initialize the audit field to 0.
 
35
 
 
36
---
 
37
 utils/Immunix/AppArmor.pm |   43 +++++++++++++++++++++++++------------------
 
38
 1 file changed, 25 insertions(+), 18 deletions(-)
 
39
 
 
40
Index: b/utils/Immunix/AppArmor.pm
 
41
===================================================================
 
42
--- a/utils/Immunix/AppArmor.pm
 
43
+++ b/utils/Immunix/AppArmor.pm
 
44
@@ -748,22 +748,12 @@ sub create_new_profile($) {
 
45
     my $fqdbin = shift;
 
46
 
 
47
     my $profile;
 
48
-    if ($fqdbin =~ /^\// ) {
 
49
-       $profile = {
 
50
-           $fqdbin => {
 
51
-               flags   => "complain",
 
52
-               include => { "abstractions/base" => 1    },
 
53
-               path    => { $fqdbin => { mode => str_to_mode("mr") } },
 
54
-           }
 
55
-       };
 
56
-    } else {
 
57
-       $profile = {
 
58
-           $fqdbin => {
 
59
-               flags   => "complain",
 
60
-               include => { "abstractions/base" => 1    },
 
61
-           }
 
62
-       };
 
63
-    }
 
64
+    $profile = {
 
65
+       $fqdbin => {
 
66
+           flags   => "complain",
 
67
+           include => { "abstractions/base" => 1    },
 
68
+       }
 
69
+    };
 
70
 
 
71
     # if the executable exists on this system, pull in extra dependencies
 
72
     if (-f $fqdbin) {
 
73
@@ -771,7 +761,7 @@ sub create_new_profile($) {
 
74
         if ($hashbang && $hashbang =~ /^#!\s*(\S+)/) {
 
75
             my $interpreter = get_full_path($1);
 
76
             $profile->{$fqdbin}{allow}{path}->{$fqdbin}{mode} |= str_to_mode("r");
 
77
-            $profile->{$fqdbin}{allow}{path}->{$fqdbin}{mode} |= 0;
 
78
+            $profile->{$fqdbin}{allow}{path}->{$fqdbin}{audit} |= 0;
 
79
             $profile->{$fqdbin}{allow}{path}->{$interpreter}{mode} |= str_to_mode("ix");
 
80
             $profile->{$fqdbin}{allow}{path}->{$interpreter}{audit} |= 0;
 
81
             if ($interpreter =~ /perl/) {
 
82
@@ -785,6 +775,8 @@ sub create_new_profile($) {
 
83
             }
 
84
             handle_binfmt($profile->{$fqdbin}, $interpreter);
 
85
         } else {
 
86
+          $profile->{$fqdbin}{allow}{path}->{$fqdbin}{mode} |= str_to_mode("mr");
 
87
+          $profile->{$fqdbin}{allow}{path}->{$fqdbin}{audit} |= 0;
 
88
           handle_binfmt($profile->{$fqdbin}, $fqdbin);
 
89
         }
 
90
     }
 
91
@@ -798,6 +790,7 @@ sub create_new_profile($) {
 
92
         }
 
93
     }
 
94
     push @created, $fqdbin;
 
95
+    $DEBUGGING && debug( Data::Dumper->Dump([$profile], [qw(*profile)]));
 
96
     return { $fqdbin => $profile };
 
97
 }
 
98
 
 
99
@@ -2850,7 +2843,21 @@ sub add_event_to_tree ($) {
 
100
                           $e->{name},
 
101
                          ""
 
102
                         );
 
103
-        }
 
104
+        } elsif (defined $e->{name}) {
 
105
+            add_to_tree( $e->{pid},
 
106
+                        $e->{parent},
 
107
+                          "exec",
 
108
+                          $profile,
 
109
+                          $hat,
 
110
+                          $prog,
 
111
+                          $sdmode,
 
112
+                          $e->{denied_mask},
 
113
+                          $e->{name},
 
114
+                         ""
 
115
+                        );
 
116
+        } else {
 
117
+            $DEBUGGING && debug "add_event_to_tree: dropped exec event in $e->{profile}";
 
118
+       }
 
119
     } elsif ($e->{operation} =~ m/file_/) {
 
120
         add_to_tree( $e->{pid},
 
121
                     $e->{parent},