1 00:00:00,000 --> 00:00:02,900 Good afternoon, I'm Crispin. I'm here to talk to you about AppArmor. 2 00:00:03,640 --> 00:00:06,500 I'm going to make sure it ends on time so you all can get to the awards ceremony. 3 00:00:09,780 --> 00:00:11,160 So what is this AppArmor thing? 4 00:00:13,740 --> 00:00:15,080 This is my talk overview. 5 00:00:16,340 --> 00:00:20,300 I'll zoom in a little and iteratively describe AppArmor in more and more detail. 6 00:00:20,860 --> 00:00:23,940 Some deployment scenarios, a demo, 7 00:00:26,240 --> 00:00:29,220 and how it compares to other products. 8 00:00:30,000 --> 00:00:33,000 So the security problem that AppArmor is attacking is 9 00:00:33,880 --> 00:00:35,640 the problem is imperfect software. 10 00:00:36,860 --> 00:00:39,460 Reliable software does what it's supposed to do. 11 00:00:40,660 --> 00:00:44,680 Secure software does what it's supposed to do and nothing else. 12 00:00:45,060 --> 00:00:49,040 And it's the funny something else's that allow the attackers to come and tickle your software 13 00:00:49,040 --> 00:00:51,420 and make it do something peculiar and that's where they get you. 14 00:00:51,800 --> 00:00:54,120 So the solution is only use perfect software. 15 00:00:55,640 --> 00:00:57,540 Yeah, slight supply problem. 16 00:00:58,640 --> 00:00:59,880 The AppArmor solution, 17 00:01:00,000 --> 00:01:04,740 is enforce that applications only get to do what they're supposed to do 18 00:01:04,740 --> 00:01:07,340 and the something else's are not permitted. 19 00:01:08,340 --> 00:01:10,700 So what does do mean? 20 00:01:11,920 --> 00:01:15,500 At the ultimate detail of what this program should be doing is the code itself, 21 00:01:16,100 --> 00:01:18,540 which specifies it in every last little bit of detail. 22 00:01:18,800 --> 00:01:21,940 Unfortunately, we already know we can't get that right. 23 00:01:22,020 --> 00:01:23,680 It's too detailed and therefore wrong. 24 00:01:24,820 --> 00:01:27,640 To make it correct most of the time, it must be simple. 25 00:01:29,040 --> 00:01:29,980 What AppArmor does, 26 00:01:29,980 --> 00:01:31,820 what AppArmor attacks is operating system resources. 27 00:01:32,100 --> 00:01:34,940 It's an OS-based host security system, 28 00:01:35,080 --> 00:01:39,080 so it can mediate what the application can do with the operating system resources. 29 00:01:39,360 --> 00:01:40,080 So that's what we're doing. 30 00:01:41,760 --> 00:01:43,360 So what would you do with that? 31 00:01:45,100 --> 00:01:48,240 You could make machine be network secure. 32 00:01:48,880 --> 00:01:52,680 You confine all of the programs that are listening to network ports. 33 00:01:53,600 --> 00:01:57,300 And if all the ports lead to AppArmor confinement policies, 34 00:01:57,580 --> 00:01:59,960 then there's no way for anybody on the network, 35 00:01:59,960 --> 00:02:03,260 to get at the machine, unless it's going through a policy somehow. 36 00:02:04,500 --> 00:02:08,340 So this reduces the scope of securing your machine a lot. 37 00:02:08,620 --> 00:02:10,920 It's down from every program on your machine, 38 00:02:11,020 --> 00:02:13,280 to only these ones that you have confined by policy, 39 00:02:13,380 --> 00:02:16,360 and only within the range of what the policy permits. 40 00:02:16,740 --> 00:02:19,880 So it's still your fault if you get the policy wrong, but it's much easier. 41 00:02:23,160 --> 00:02:24,540 So is that really secure? 42 00:02:25,340 --> 00:02:26,720 Well, that's hard to say. 43 00:02:27,720 --> 00:02:29,680 Security is what you call semi-decidable. 44 00:02:29,960 --> 00:02:32,640 When it's insecure, you can demonstrate that. 45 00:02:32,800 --> 00:02:33,980 Hi, root shell. 46 00:02:35,260 --> 00:02:38,160 But when it's not, to show that it is secure, 47 00:02:38,380 --> 00:02:39,960 you have to show the absence of hacks. 48 00:02:40,100 --> 00:02:43,340 And that is like, well, show it to lots of smart people and wait. 49 00:02:43,440 --> 00:02:45,880 And when they stop coming, then it's probably pretty okay. 50 00:02:47,540 --> 00:02:49,920 Hence all the DEF CON talks about breaking things, 51 00:02:50,040 --> 00:02:51,760 and relatively few about securing things, 52 00:02:51,940 --> 00:02:53,880 because showing that it's secure is hard. 53 00:02:55,240 --> 00:02:57,300 So we put it to a practical test. 54 00:02:57,460 --> 00:02:58,660 Let's show it to some smart people. 55 00:03:00,160 --> 00:03:03,880 DEF CON 2002, we took AppArmor into the CTF games. 56 00:03:05,420 --> 00:03:08,200 There's going to be a few slides here describing CTF. 57 00:03:08,300 --> 00:03:09,620 Sorry if you already know this stuff. 58 00:03:10,420 --> 00:03:14,860 The idea was to put an AppArmor machine in the line of fire 59 00:03:14,860 --> 00:03:16,060 and let attackers hack on it. 60 00:03:17,640 --> 00:03:19,200 This is how CTF works. 61 00:03:19,520 --> 00:03:21,820 Every team has a server, 62 00:03:21,940 --> 00:03:25,460 and in the center of the network is a score machine 63 00:03:25,460 --> 00:03:29,940 that comes along, and it has network sex with your server. 64 00:03:30,680 --> 00:03:32,500 And if the sex is satisfying, 65 00:03:32,760 --> 00:03:36,740 then it awards a point to whoever's flag is on that machine. 66 00:03:38,640 --> 00:03:41,060 And of course, the attackers are trying to change that flag. 67 00:03:41,500 --> 00:03:43,200 They're also trying to mess with your services 68 00:03:43,200 --> 00:03:45,040 so that they don't work, and so forth. 69 00:03:47,320 --> 00:03:49,520 A little more on CTF in a minute. 70 00:03:50,480 --> 00:03:52,540 So zooming in a bit on AppArmor, 71 00:03:52,600 --> 00:03:55,060 this is the requisite boxes and arrows diagram. 72 00:03:56,240 --> 00:03:59,580 The most important feature here is Linux 2.6. 73 00:03:59,960 --> 00:04:03,200 Which has a feature in it called Linux Security Modules 74 00:04:03,200 --> 00:04:07,380 that allows you to create mandatory access control policy engines 75 00:04:07,380 --> 00:04:08,680 and insert them into the kernel. 76 00:04:09,100 --> 00:04:10,960 So that it has kernel's authority, 77 00:04:11,580 --> 00:04:14,760 but you don't have to ask Linus or ask your user 78 00:04:14,760 --> 00:04:16,940 to patch the kernel every time you want to use it. 79 00:04:16,960 --> 00:04:17,780 You can just insert it. 80 00:04:17,980 --> 00:04:21,420 And above that is the AppArmor user level management software. 81 00:04:22,000 --> 00:04:24,360 Over here would be your stuff, your applications, 82 00:04:24,540 --> 00:04:27,680 each one of which would be wrapped in an AppArmor policy 83 00:04:27,680 --> 00:04:29,540 describing what this thing is allowed to do. 84 00:04:31,640 --> 00:04:34,540 So, some critical issues of doing this kind of design. 85 00:04:34,760 --> 00:04:36,680 Number one is complete mediation. 86 00:04:37,160 --> 00:04:39,240 If you build a fence three quarters of the way 87 00:04:39,240 --> 00:04:40,760 around your house, your dog will run away. 88 00:04:41,500 --> 00:04:44,200 Three quarters done is not done in the security context 89 00:04:44,200 --> 00:04:45,960 because the attackers are smart people. 90 00:04:46,100 --> 00:04:48,140 They're what's called intelligent adversaries. 91 00:04:48,580 --> 00:04:51,480 They look for the hole in the fence and go for it. 92 00:04:51,540 --> 00:04:53,760 So even if you're 99% done, you're not done. 93 00:04:54,860 --> 00:04:57,120 And the only way to do that is to be in the kernel. 94 00:04:57,980 --> 00:04:59,660 There are, there were, 95 00:04:59,960 --> 00:05:02,120 some products that tried to do security mediation 96 00:05:02,610 --> 00:05:03,560 at the library layer, 97 00:05:03,740 --> 00:05:05,640 and that has the appearance of looking secure. 98 00:05:05,800 --> 00:05:08,760 The application apparently can't do anything you told it not to. 99 00:05:08,960 --> 00:05:12,280 But the attacker who injects malcode into the application 100 00:05:12,280 --> 00:05:14,240 can bypass the library and head to the kernel. 101 00:05:14,880 --> 00:05:18,280 That's not the case if you put your security in the kernel. 102 00:05:20,420 --> 00:05:22,920 The other critical issue is the security model. 103 00:05:23,780 --> 00:05:26,560 You have to live with this thing, so it has to be tolerable. 104 00:05:27,900 --> 00:05:29,940 At a high level, there's two critical issues. 105 00:05:29,960 --> 00:05:31,100 Two kinds of security policies, 106 00:05:31,360 --> 00:05:33,420 misuse prevention and anomaly prevention. 107 00:05:34,360 --> 00:05:37,240 Misuse prevention is what you're accustomed to in antivirus products. 108 00:05:38,220 --> 00:05:41,160 Can't run this program, or this one, or this one, or this one. 109 00:05:41,340 --> 00:05:43,900 You make up a black list of bad things that are not permitted. 110 00:05:44,080 --> 00:05:47,560 This one, this one, this one, and 75,000 signatures later, 111 00:05:47,640 --> 00:05:49,880 they're not done because there's always another way to write a virus, 112 00:05:50,040 --> 00:05:52,020 or malicious code, or whatever. 113 00:05:52,200 --> 00:05:54,480 This is the signature-based business. 114 00:05:54,600 --> 00:05:57,000 It ends up being an arms race of continuous updates, 115 00:05:57,200 --> 00:05:58,440 because there's always another one. 116 00:05:59,960 --> 00:06:01,140 The other way is anomaly prevention, 117 00:06:01,440 --> 00:06:06,540 where you specify a white list of what's permitted and everything else is denied. 118 00:06:07,020 --> 00:06:11,200 That's highly secure, because the bad guys can't just go and invent another one to bypass you. 119 00:06:12,060 --> 00:06:14,000 But it's hard to live with, 120 00:06:14,100 --> 00:06:18,140 because if you don't specify every last thing that your application needs, 121 00:06:18,400 --> 00:06:20,080 then you're going to trip over your own shoelaces. 122 00:06:20,120 --> 00:06:25,340 The security system causes your production application to die in the middle of running payroll, 123 00:06:25,500 --> 00:06:27,340 and your manager wants to know what the fuck you're doing. 124 00:06:28,880 --> 00:06:30,920 So, sort of rock-hard place. 125 00:06:31,880 --> 00:06:34,700 AppArmor tries to get in between those places with a hybrid model. 126 00:06:36,820 --> 00:06:41,620 It's a hybrid in that within a policy for a given application, such as Apache, 127 00:06:41,860 --> 00:06:42,860 we're using a white list. 128 00:06:43,180 --> 00:06:46,880 We specify everything that Apache is allowed to do, and everything else is denied. 129 00:06:47,040 --> 00:06:48,060 It can only do what we say. 130 00:06:48,760 --> 00:06:50,220 System-wide, it's a black list. 131 00:06:50,740 --> 00:06:56,840 We don't specify, we don't control any program that isn't explicitly told to confine. 132 00:06:57,340 --> 00:07:00,520 So, you can profile the applications that you care about, 133 00:07:00,680 --> 00:07:04,800 like the ones that have network ports, and nothing else, 134 00:07:04,940 --> 00:07:11,020 and be secure, because those things that the network can connect to are confined. 135 00:07:11,240 --> 00:07:14,980 What those applications that are confined can do is confined, 136 00:07:15,240 --> 00:07:21,480 and your administrative stuff, your CP command, your personal shell, your window manager, 137 00:07:21,640 --> 00:07:23,600 they are not confined, so you don't have to live with it. 138 00:07:24,320 --> 00:07:27,120 You can confine only the things that you care about. 139 00:07:27,340 --> 00:07:31,140 It's also focusing on applications instead of users. 140 00:07:31,580 --> 00:07:36,500 Back in the day, mandatory access control systems were designed for the mainframe, 141 00:07:36,640 --> 00:07:38,660 where all 400 of us shared a computer. 142 00:07:39,020 --> 00:07:42,140 And the security system was trying to solve the problem of 143 00:07:42,140 --> 00:07:46,160 allow the accounting, the marketing department, the engineering department, 144 00:07:46,160 --> 00:07:49,780 the accounting department to sort of cooperate, but not really get in each other's shorts, 145 00:07:49,940 --> 00:07:53,820 because it's really bad when the marketing people get hold of early engineering notes 146 00:07:53,820 --> 00:07:55,420 and start marketing it before it works. 147 00:07:56,620 --> 00:08:01,760 And the problem with that is that users are very big, hairy creatures with opinions, 148 00:08:01,920 --> 00:08:06,700 and they change their opinions, and so they want to know why they can't do this thing that they want to do, 149 00:08:06,760 --> 00:08:08,220 even though policy says they shouldn't. 150 00:08:08,720 --> 00:08:14,020 And so access control systems that can deal with that are very complicated. 151 00:08:15,980 --> 00:08:17,440 Applications are much more behaved. 152 00:08:17,880 --> 00:08:22,280 The web server mostly serves web pages, and the mail server mostly serves mail spools. 153 00:08:22,400 --> 00:08:24,280 They tend not to do each other's thing. 154 00:08:24,280 --> 00:08:30,880 So it's much easier to create a policy that says the web server can serve the web pages, 155 00:08:31,060 --> 00:08:34,680 and the mail server can serve the mail spools, and they don't get to touch each other. 156 00:08:36,140 --> 00:08:41,400 So this allows AppArmor to be a great deal simpler than legacy access control systems 157 00:08:41,400 --> 00:08:43,060 that were designed to solve a harder problem. 158 00:08:44,860 --> 00:08:45,720 Zooming in some. 159 00:08:45,960 --> 00:08:47,940 This is an actual AppArmor policy. 160 00:08:48,480 --> 00:08:52,280 The example I'm using is NTP, the Network Time Protocol daemon, 161 00:08:52,280 --> 00:08:53,000 that lets help. 162 00:08:53,000 --> 00:08:56,080 It keeps your clock synchronized with whatever clock you want, 163 00:08:56,140 --> 00:09:01,420 either your enterprise's clock or the NIST clock at NTPpool.org. 164 00:09:02,580 --> 00:09:04,500 And it has two interesting properties. 165 00:09:04,840 --> 00:09:08,820 One is that it needs root privilege because it's going to mess with your system time. 166 00:09:09,000 --> 00:09:12,280 And the other is it needs an open network port so that it can ask the time server, 167 00:09:12,380 --> 00:09:13,020 what time is it? 168 00:09:13,460 --> 00:09:18,440 This is exactly what all of the security guidelines and trainings tell you not to do. 169 00:09:18,520 --> 00:09:20,880 Don't have root privilege open network ports, 170 00:09:21,000 --> 00:09:22,440 because if there's a bug in it, 171 00:09:22,440 --> 00:09:25,740 someone can pop that daemon and they own your box, 172 00:09:25,840 --> 00:09:26,640 they Trojan your kernel, 173 00:09:26,740 --> 00:09:27,660 they do evil things to you. 174 00:09:28,700 --> 00:09:30,840 With this AppArmor profile in place, 175 00:09:31,620 --> 00:09:32,420 these here, 176 00:09:33,480 --> 00:09:37,500 these rules specify the five POSIX capabilities that NTP can have 177 00:09:37,500 --> 00:09:40,500 instead of all 32 that Linux has. 178 00:09:40,920 --> 00:09:42,200 Things like sys time. 179 00:09:42,420 --> 00:09:43,460 Oh yeah, it's going to need that. 180 00:09:44,020 --> 00:09:47,200 And these rules specify file access. 181 00:09:47,440 --> 00:09:51,220 These are absolute path names with embedded shell wildcards. 182 00:09:51,220 --> 00:09:53,220 So we've got a rule that says 183 00:09:53,220 --> 00:09:58,380 slash tmp slash ntp star and read and write. 184 00:10:00,580 --> 00:10:04,120 So the net impact of this is that never mind that it's root, 185 00:10:04,340 --> 00:10:06,500 it can only have these five POSIX capabilities. 186 00:10:06,640 --> 00:10:11,620 And even though root nominally has access to the entire file system to do whatever it wants, 187 00:10:12,240 --> 00:10:15,080 this NTP instance can only access these files. 188 00:10:15,240 --> 00:10:18,940 And so what could a bad guy do if he popped my NTP daemon? 189 00:10:18,940 --> 00:10:22,240 Well, basically he can change my time. 190 00:10:22,820 --> 00:10:24,120 Which is what it's supposed to do. 191 00:10:24,600 --> 00:10:25,720 That's not a great thing. 192 00:10:25,800 --> 00:10:27,820 You don't want bad guys changing your time on you. 193 00:10:27,920 --> 00:10:30,220 But that's a heck of a lot better than having a Trojan kernel. 194 00:10:30,540 --> 00:10:31,780 Much easier to clean up. 195 00:10:33,720 --> 00:10:35,660 So how would you create such policies? 196 00:10:36,700 --> 00:10:37,780 This is the workflow. 197 00:10:38,160 --> 00:10:40,700 It starts with the machine analyzer. 198 00:10:41,160 --> 00:10:44,260 What it does is scan your machine for open network ports, 199 00:10:44,480 --> 00:10:47,180 find the programs listening to the open network ports, 200 00:10:47,180 --> 00:10:50,820 and report the AppArmor profiles wrapped around those programs. 201 00:10:52,700 --> 00:10:57,340 Your goal is to get the machine to the point where all the open network ports lead to profiles, 202 00:10:57,640 --> 00:10:59,380 and that keeps you safe from network attack. 203 00:11:00,460 --> 00:11:02,180 So that tells you where you should start. 204 00:11:02,240 --> 00:11:04,100 Pick one of these unconfined programs and get going. 205 00:11:04,860 --> 00:11:06,220 There's a template generator. 206 00:11:06,540 --> 00:11:09,580 It's a crappy static analyzer that takes a look at your program, 207 00:11:09,680 --> 00:11:12,300 decides whether it's an x86 or a shell script or whatever, 208 00:11:12,520 --> 00:11:15,940 and spits out a half-assed guess about what the profile should look like. 209 00:11:15,940 --> 00:11:17,360 This is just to get you going. 210 00:11:17,660 --> 00:11:19,620 It then puts it into learning mode, 211 00:11:20,160 --> 00:11:23,680 where the rules are not enforced but violations are logged. 212 00:11:24,420 --> 00:11:26,100 You then go and run your program, 213 00:11:26,280 --> 00:11:30,940 and you accumulate a log full of events of what your program should be doing. 214 00:11:31,320 --> 00:11:35,220 And then you talk to the optimizer that scans the log, 215 00:11:35,360 --> 00:11:39,420 turns thousands of log events into dozens of rules by asking you questions about, 216 00:11:39,580 --> 00:11:42,300 well, oh look, he asked s slash temp slash something. 217 00:11:42,420 --> 00:11:43,120 What should I do with that? 218 00:11:43,320 --> 00:11:45,140 Oh, let's generalize it. 219 00:11:45,140 --> 00:11:47,160 Throw a wild card so that he can just have s slash temp. 220 00:11:47,680 --> 00:11:50,700 And finally, there's a colorized vim syntax. 221 00:11:51,320 --> 00:11:56,020 And what it's doing is highlighting in different colors the significant elements of the policy. 222 00:11:56,360 --> 00:11:58,560 So green is pointing to other profiles. 223 00:11:58,740 --> 00:12:01,920 That says that this program gets to execute some other programs, 224 00:12:02,100 --> 00:12:03,420 and they may have a policy of their own. 225 00:12:04,000 --> 00:12:05,620 Yellow means kind of dangerous. 226 00:12:05,840 --> 00:12:07,900 So all the writable files are in yellow. 227 00:12:08,040 --> 00:12:10,600 So if you want to know what the hacker left on your machine, 228 00:12:10,900 --> 00:12:12,140 you look at the yellow lines. 229 00:12:12,220 --> 00:12:12,980 That's what they could touch. 230 00:12:13,660 --> 00:12:15,120 And red means very dangerous. 231 00:12:15,140 --> 00:12:19,940 And so it's highlighting in red any POSIX capability and so forth. 232 00:12:23,220 --> 00:12:24,280 I just did that. 233 00:12:26,600 --> 00:12:27,360 There we go. 234 00:12:27,540 --> 00:12:29,100 Stuff to notice about the language. 235 00:12:29,540 --> 00:12:32,440 The first is that it's an overlay on top of Unix security. 236 00:12:33,100 --> 00:12:37,460 You have to pass all of the usual chmod grep access mode bits 237 00:12:37,980 --> 00:12:42,120 before LSM will even ask AppArmor the question of what's going on. 238 00:12:42,220 --> 00:12:42,860 Is this allowed? 239 00:12:42,860 --> 00:12:45,940 The second thing is no new jargon. 240 00:12:46,900 --> 00:12:53,820 The access rules, the path names are exactly shell syntax wildcards for absolute path names. 241 00:12:54,420 --> 00:12:56,460 So star means what you think it means. 242 00:12:56,700 --> 00:12:58,440 Square bracket means what you think it means. 243 00:12:58,560 --> 00:13:00,240 Squiggly bracket means what you think it means. 244 00:13:00,460 --> 00:13:03,320 The only slight variation is double star. 245 00:13:04,040 --> 00:13:07,380 A single star matches up to a slash character just like a shell does. 246 00:13:07,520 --> 00:13:09,280 Double star will eat the slash character. 247 00:13:09,460 --> 00:13:12,500 So if you say double star, it means recursively give me the whole tree. 248 00:13:12,860 --> 00:13:15,300 And you can compose that with dot suffixes. 249 00:13:15,380 --> 00:13:18,700 So you can say give me public HTML star star dot HTML 250 00:13:18,700 --> 00:13:21,720 if you only want to export the HTML pages 251 00:13:21,720 --> 00:13:24,400 and please do not be exporting the Perl source code. 252 00:13:24,520 --> 00:13:24,880 Thank you. 253 00:13:27,100 --> 00:13:29,640 So if you know how to use bash, chmod, and grep, 254 00:13:29,680 --> 00:13:33,200 you already understand AppArmor and you can probably reverse engineer the policy by yourself. 255 00:13:35,400 --> 00:13:39,200 It includes pound include, which means exactly what you think it means. 256 00:13:39,520 --> 00:13:41,960 We use that to make abstractions. 257 00:13:41,960 --> 00:13:44,540 So there's like a pound include for name service 258 00:13:44,540 --> 00:13:48,440 that gives you all the rules necessary for doing DNS and UID lookups. 259 00:13:48,780 --> 00:13:50,580 There's another one for console, 260 00:13:50,740 --> 00:13:55,220 which gives you all the TTY stuff for talking to the keyboard and so forth. 261 00:13:55,440 --> 00:13:56,700 And these aren't special. 262 00:13:56,820 --> 00:13:59,580 You can make up your own if you were running an oil company 263 00:13:59,580 --> 00:14:03,320 and you want to have pound include seismic for all of your seismic modeling apps. 264 00:14:04,000 --> 00:14:07,420 AppArmor will just treat them the same as it treats the ones that we predefined. 265 00:14:09,060 --> 00:14:10,580 We ship a bunch of policies. 266 00:14:10,580 --> 00:14:12,920 Some of them are on by default and some are not. 267 00:14:13,920 --> 00:14:17,660 Netstat, ping, traceroute, those are pretty well behaved programs. 268 00:14:17,840 --> 00:14:19,860 We're sure that the profile we provided is good enough. 269 00:14:21,600 --> 00:14:24,660 On the other hand, things like Apache, 270 00:14:24,860 --> 00:14:26,840 we don't enable that profile by default 271 00:14:28,540 --> 00:14:31,660 because I've never met a web admin who has the decency 272 00:14:31,660 --> 00:14:34,100 to put the web documents in the same place as anybody else. 273 00:14:35,240 --> 00:14:39,540 It's always on slash nfs2 slash that machine over there 274 00:14:39,540 --> 00:14:41,640 that belonged to Bob, but Bob doesn't work here anymore. 275 00:14:43,780 --> 00:14:46,900 AppArmor had no chance of knowing where Bob's machine is, 276 00:14:47,500 --> 00:14:49,040 so we disabled it by default. 277 00:14:50,000 --> 00:14:52,580 And if you want the web server to work, 278 00:14:52,640 --> 00:14:56,400 then you put it in learning mode, let it serve some pages, 279 00:14:56,480 --> 00:14:59,140 and it will very quickly figure out that that's where the web docs are 280 00:14:59,140 --> 00:15:00,140 and should just allow that. 281 00:15:01,200 --> 00:15:03,480 We could have shipped it in learning mode, 282 00:15:03,680 --> 00:15:06,300 but then it would appear to be confined but isn't, 283 00:15:06,320 --> 00:15:07,140 and that would be dangerous. 284 00:15:07,140 --> 00:15:10,560 We could have shipped it on in forced mode by default, 285 00:15:10,640 --> 00:15:12,260 and then your first user experience would be 286 00:15:12,260 --> 00:15:13,600 AppArmor broke my web server. 287 00:15:13,900 --> 00:15:15,120 That's not too cool either. 288 00:15:15,380 --> 00:15:18,080 So it's something that you can go and get and turn on if you want. 289 00:15:20,560 --> 00:15:21,440 The demo. 290 00:15:22,180 --> 00:15:23,220 I'm going to hack myself. 291 00:15:26,380 --> 00:15:29,020 So here I am serving a website. 292 00:15:31,700 --> 00:15:35,200 Works a lot better when I start the web server. 293 00:15:45,200 --> 00:15:45,920 There we go. 294 00:15:47,240 --> 00:15:49,000 And it has a web app on it. 295 00:15:51,340 --> 00:15:53,020 Anyone remember PHF? 296 00:15:54,740 --> 00:15:56,020 Ancient Vulnerable Web App. 297 00:15:57,820 --> 00:16:00,720 And to this day, we're still vulnerable to this kind of attack. 298 00:16:00,880 --> 00:16:01,840 It's called command injection, 299 00:16:03,740 --> 00:16:06,220 where the stupid web app will run shell commands 300 00:16:06,220 --> 00:16:08,860 if you put them on the URL with unfortunate consequences. 301 00:16:11,300 --> 00:16:13,500 So now I'm putting it back with the soon to be patented 302 00:16:13,500 --> 00:16:15,580 unhack button that uses the same vulnerability 303 00:16:15,580 --> 00:16:16,720 to publish a web fix. 304 00:16:17,460 --> 00:16:19,340 I think it's sad that that's the easiest way 305 00:16:19,340 --> 00:16:20,220 to publish a web fix. 306 00:16:21,520 --> 00:16:23,360 So now let's fix this problem with AppArmor. 307 00:16:23,700 --> 00:16:26,480 We're going to build a policy for Apache 308 00:16:26,480 --> 00:16:28,360 and that web app while you wait. 309 00:16:36,540 --> 00:16:38,180 GenProf is the wizard for, 310 00:16:38,260 --> 00:16:39,820 please build me a profile for this thing. 311 00:16:40,360 --> 00:16:42,140 And then you just give it a path to a program. 312 00:16:42,660 --> 00:16:43,300 That's Apache. 313 00:16:45,120 --> 00:16:46,620 Okay, and it says, great. 314 00:16:46,740 --> 00:16:51,320 I've already run the static analyzer. 315 00:16:51,400 --> 00:16:52,320 I've put it in learning mode. 316 00:16:52,500 --> 00:16:54,640 Go run your program and I'll figure out what the hell. 317 00:16:59,720 --> 00:17:01,100 I do a restart on Apache. 318 00:17:02,700 --> 00:17:04,860 And down here you see the events of, 319 00:17:04,860 --> 00:17:07,120 this is what Apache has to do when it starts up. 320 00:17:08,720 --> 00:17:10,180 You visit the home page 321 00:17:11,560 --> 00:17:14,140 and you see the events for showing pages. 322 00:17:14,620 --> 00:17:15,880 You run the web app 323 00:17:17,180 --> 00:17:18,980 and you see the events for running the web app. 324 00:17:19,380 --> 00:17:20,560 Don't run the hack attack 325 00:17:21,960 --> 00:17:23,760 and don't smoke in front of your kids 326 00:17:23,760 --> 00:17:24,680 for the same reason. 327 00:17:29,900 --> 00:17:32,360 Do another restart so that AppArmor gets to see 328 00:17:32,360 --> 00:17:33,340 what a stop looks like. 329 00:17:33,380 --> 00:17:33,860 We need that. 330 00:17:34,860 --> 00:17:37,060 So now we have a log file full of events. 331 00:17:37,640 --> 00:17:40,260 And if you had too much unstructured time, 332 00:17:40,340 --> 00:17:41,840 you could manually turn that into policy, 333 00:17:41,980 --> 00:17:43,440 but the software is much better at it. 334 00:17:43,740 --> 00:17:45,220 So let's scan the log, 335 00:17:45,760 --> 00:17:46,840 turn it into policy. 336 00:17:47,940 --> 00:17:49,360 The first question is, 337 00:17:49,480 --> 00:17:53,060 AppArmor saw Apache execute this PHF child 338 00:17:53,060 --> 00:17:55,240 and it wants to know whether the child should be 339 00:17:55,240 --> 00:17:57,440 either included as part of Apache's profile 340 00:17:57,440 --> 00:17:59,800 or out there with its own discrete profile. 341 00:18:00,840 --> 00:18:03,920 Giving it its own profile is the secure answer, 342 00:18:03,920 --> 00:18:07,560 saying inherit for be within Apache is the easy answer. 343 00:18:08,180 --> 00:18:10,700 So if you go home and start using AppArmor, 344 00:18:10,780 --> 00:18:12,960 choose inherit mostly until you know what you're doing. 345 00:18:13,600 --> 00:18:16,120 I'm going to choose profile because I can. 346 00:18:17,200 --> 00:18:19,560 It wants to know whether to cleanse the environment variables 347 00:18:19,560 --> 00:18:22,580 for the same reason that setUID does. 348 00:18:24,920 --> 00:18:27,580 Then it asks about the POSIX capabilities 349 00:18:27,580 --> 00:18:30,960 that Apache uses and just give them all 350 00:18:30,960 --> 00:18:32,520 because there's no reason not to. 351 00:18:32,520 --> 00:18:33,940 You know, your app needs this, 352 00:18:34,000 --> 00:18:35,540 and denying it could cause bad things. 353 00:18:36,500 --> 00:18:37,840 AppArmor's putting square brackets 354 00:18:37,840 --> 00:18:39,360 around the default answer, 355 00:18:39,520 --> 00:18:41,480 so if you don't feel really alert today, 356 00:18:41,560 --> 00:18:43,300 just hit enter and it'll do the default thing. 357 00:18:44,360 --> 00:18:45,580 Now the file access. 358 00:18:45,920 --> 00:18:49,220 Apache wants to access Etsy to Apache ConfD. 359 00:18:49,400 --> 00:18:50,320 Okay, right. 360 00:18:51,320 --> 00:18:52,260 That's reasonable. 361 00:18:52,360 --> 00:18:54,600 And it wants deep into Apache ConfD. 362 00:18:54,940 --> 00:18:57,280 And no way have I covered Apache. 363 00:18:57,520 --> 00:18:59,280 I've not gone anywhere near touching 364 00:18:59,280 --> 00:19:00,740 all of the configurations for Apache. 365 00:19:00,740 --> 00:19:03,820 So I hit the glob button a couple of times, 366 00:19:03,940 --> 00:19:05,940 and now this proposed rule is saying that Apache 367 00:19:05,940 --> 00:19:09,340 gets to access slash Etsy slash Apache two star star. 368 00:19:09,440 --> 00:19:10,480 It can read the whole tree, 369 00:19:10,620 --> 00:19:11,980 which is what you want anyway, 370 00:19:12,140 --> 00:19:14,080 and you don't have to specify all those niggly rules. 371 00:19:16,000 --> 00:19:18,660 Some MIME types, some PHP stuff. 372 00:19:19,060 --> 00:19:21,840 Oh, look, a pound include for be a PHP server, 373 00:19:22,000 --> 00:19:23,080 so I don't have to think about it. 374 00:19:23,420 --> 00:19:25,540 There's a pound include for serve web data 375 00:19:25,540 --> 00:19:28,300 if you put the web pages in the SUSE place 376 00:19:28,300 --> 00:19:29,380 for putting the web pages. 377 00:19:29,380 --> 00:19:32,380 Or you could explicitly learn them yourself, 378 00:19:33,060 --> 00:19:34,320 but I'm going to go with the pound include. 379 00:19:35,640 --> 00:19:37,640 If you hit glob with extension, 380 00:19:37,940 --> 00:19:41,480 it wildcards the mod CGI here and leaves the .so. 381 00:19:41,660 --> 00:19:43,240 So this is an easy way to say, 382 00:19:43,340 --> 00:19:44,560 give me all the .so files. 383 00:19:48,520 --> 00:19:50,680 Let Apache have some logging capabilities. 384 00:19:51,140 --> 00:19:55,020 It's PID file, name service, done. 385 00:19:56,020 --> 00:19:58,260 So you don't even need to restart Apache, 386 00:19:58,260 --> 00:20:00,300 because you can change an app armor policy 387 00:20:00,300 --> 00:20:01,580 out from under a running process. 388 00:20:03,200 --> 00:20:04,040 Here's the website. 389 00:20:05,500 --> 00:20:06,440 Here's the web app. 390 00:20:07,780 --> 00:20:08,720 Here's the hack attack. 391 00:20:11,340 --> 00:20:12,720 And nothing happened. 392 00:20:13,600 --> 00:20:15,340 There's your intrusion rejection message 393 00:20:16,040 --> 00:20:17,500 that if you're not in the front row, 394 00:20:17,620 --> 00:20:19,380 this says that that PHF application 395 00:20:19,920 --> 00:20:21,600 does not get to execute bash. 396 00:20:22,580 --> 00:20:24,180 If it had been a bash script, 397 00:20:24,360 --> 00:20:26,260 it would be executing bash now, wouldn't it? 398 00:20:26,900 --> 00:20:30,220 But it wouldn't have write permission to index.html. 399 00:20:30,400 --> 00:20:32,360 That's the security value of the whitelist. 400 00:20:32,440 --> 00:20:34,460 I don't care what the bug is in PHF. 401 00:20:34,560 --> 00:20:36,280 I will tell it what it's allowed to do, 402 00:20:36,340 --> 00:20:38,200 and it doesn't include corrupting my home pages. 403 00:20:40,060 --> 00:20:44,040 So the simple point here is that I stopped the attack 404 00:20:44,040 --> 00:20:45,300 that I knew about ahead of time. 405 00:20:45,360 --> 00:20:46,040 Well, boring. 406 00:20:47,480 --> 00:20:50,640 The powerful thing here is that I was able to build 407 00:20:50,640 --> 00:20:53,060 a policy, a workable policy, 408 00:20:53,280 --> 00:20:55,500 for something as large and sophisticated 409 00:20:55,500 --> 00:20:57,040 as Apache while you wait. 410 00:20:58,120 --> 00:21:03,380 And the value to you is that you can use AppArmor 411 00:21:03,380 --> 00:21:06,780 to secure whatever software, custom, local, obscure, 412 00:21:06,940 --> 00:21:09,600 that you have to be hosting very quickly. 413 00:21:09,800 --> 00:21:13,160 It's not about how secure does SUSE ship an operating system. 414 00:21:13,360 --> 00:21:15,360 It's about how you can secure the stuff 415 00:21:15,360 --> 00:21:17,160 that you have to run that we didn't ship you. 416 00:21:20,020 --> 00:21:24,280 This is cartoons for the demo I just gave. 417 00:21:28,620 --> 00:21:31,960 So if you get a copy of the slides, 418 00:21:32,060 --> 00:21:34,280 that's what all that cartoony stuff is, 419 00:21:34,320 --> 00:21:36,180 is a lamer version of the demo I just did. 420 00:21:40,140 --> 00:21:42,220 AppArmor on SUSE Linux has this cool 421 00:21:42,220 --> 00:21:43,820 interface for clicky buttons, 422 00:21:43,900 --> 00:21:46,360 so if you don't like shells, you can use them. 423 00:21:48,220 --> 00:21:52,040 AppArmor has this feature for sub-process confinement, 424 00:21:53,740 --> 00:21:54,900 which sounds complicated, 425 00:21:55,000 --> 00:21:55,480 but if you think about it, 426 00:21:55,500 --> 00:21:56,400 think about ModPerl. 427 00:21:56,740 --> 00:21:57,940 Way back in the day, 428 00:21:58,060 --> 00:22:00,440 if you wanted to run your web applications 429 00:22:00,440 --> 00:22:01,140 as Perl scripts, 430 00:22:01,400 --> 00:22:03,160 then the web server would exec Perl 431 00:22:03,160 --> 00:22:03,940 and run your script. 432 00:22:04,260 --> 00:22:05,140 Well, that's cute, 433 00:22:05,300 --> 00:22:07,740 but Perl is a multi-megabyte executable image, 434 00:22:07,880 --> 00:22:10,900 and that's not happening transactions per second. 435 00:22:11,680 --> 00:22:14,120 So Apache came up with this module facility 436 00:22:14,120 --> 00:22:15,840 so that you could load interpreters 437 00:22:15,840 --> 00:22:16,880 right into the web server. 438 00:22:17,000 --> 00:22:19,160 So you put on ModPerl or ModPHP. 439 00:22:19,580 --> 00:22:22,300 Now when you want to run a Perl or a PHP script, 440 00:22:22,380 --> 00:22:23,740 it just opens the 100-line script, 441 00:22:23,900 --> 00:22:25,160 sucks it in, and runs it in place. 442 00:22:25,160 --> 00:22:27,680 So now that can happen transactions per second. 443 00:22:27,900 --> 00:22:30,340 That's great for performance and crappy for security 444 00:22:30,340 --> 00:22:32,380 because now you're running all of your web apps 445 00:22:32,380 --> 00:22:34,500 in the same security domain, 446 00:22:34,600 --> 00:22:35,660 in the same address space. 447 00:22:36,240 --> 00:22:38,340 So if there's a bug in any web app, 448 00:22:38,400 --> 00:22:39,560 the attacker owns your website. 449 00:22:39,960 --> 00:22:40,440 Wonderful. 450 00:22:42,660 --> 00:22:44,940 AppArmor has an API called ChangeHat, 451 00:22:45,060 --> 00:22:47,380 Fireman's Hat, Policeman's Hat, Mayor's Hat, 452 00:22:48,340 --> 00:22:51,560 so that software can declare to AppArmor, 453 00:22:51,640 --> 00:22:53,280 hey, I'm going to change what I'm doing right now 454 00:22:53,280 --> 00:22:54,100 to some other domain. 455 00:22:54,100 --> 00:22:58,220 And then we added a module to Apache, ModAppArmor, 456 00:22:58,340 --> 00:23:00,000 that throws a ChangeHat call 457 00:23:00,000 --> 00:23:01,480 every time you try and run a script. 458 00:23:01,720 --> 00:23:02,940 And it makes up the name 459 00:23:02,940 --> 00:23:04,160 by looking at the name of the script. 460 00:23:04,480 --> 00:23:08,260 So the net of this is that you can have a policy 461 00:23:08,260 --> 00:23:09,880 that looks a lot like an AppArmor policy 462 00:23:09,880 --> 00:23:13,820 for a program for something as little as a PHP page 463 00:23:13,820 --> 00:23:16,260 that never ever appeared in the kernel process table. 464 00:23:19,300 --> 00:23:20,460 Yes, shiny buttons, 465 00:23:21,560 --> 00:23:23,480 but it's all fundamentally command-driven 466 00:23:23,480 --> 00:23:25,200 for those of us who are allergic to mice, 467 00:23:25,340 --> 00:23:26,520 or more practically, 468 00:23:26,680 --> 00:23:28,540 for those of us who are trying to administer a machine 469 00:23:28,540 --> 00:23:29,740 on top of a telephone pole 470 00:23:29,740 --> 00:23:32,060 on the other end of a 2400 baud modem to Malaysia. 471 00:23:35,860 --> 00:23:37,300 It's not just about servers. 472 00:23:38,140 --> 00:23:40,440 You can profile desktop apps, too. 473 00:23:40,560 --> 00:23:43,800 I love game, or Pidgin as it's now called. 474 00:23:43,940 --> 00:23:46,480 It lets me do Yahoo IM with my wife 475 00:23:47,440 --> 00:23:50,120 and IRC with my development engineers 476 00:23:51,300 --> 00:23:53,460 and Novell GroupWise with my coworkers. 477 00:23:53,480 --> 00:23:55,260 Corporate peers, all in the same app. 478 00:23:55,440 --> 00:23:57,640 But this is undergoing what you might call 479 00:23:57,640 --> 00:23:58,760 rapid internet development. 480 00:23:59,140 --> 00:24:00,600 It gets frequent bugs. 481 00:24:01,360 --> 00:24:03,340 And if some stranger you're talking to 482 00:24:03,340 --> 00:24:04,820 knows a buffer overflow, 483 00:24:05,080 --> 00:24:07,460 they own your IM client, then they own you. 484 00:24:09,020 --> 00:24:11,140 With an AppArmor profile around it, 485 00:24:11,220 --> 00:24:13,420 then an attacker who owned my game client 486 00:24:13,420 --> 00:24:15,520 would discover mostly my game files, 487 00:24:15,760 --> 00:24:18,300 and they might learn that I love my wife 488 00:24:18,300 --> 00:24:20,760 and respect my peers and not the other way around. 489 00:24:22,260 --> 00:24:22,800 Um... 490 00:24:22,800 --> 00:24:24,140 But they don't own my desktop. 491 00:24:24,400 --> 00:24:25,580 They don't own my mailbox. 492 00:24:25,680 --> 00:24:28,360 They don't own my SSH or GPG keys. 493 00:24:31,060 --> 00:24:33,360 This is a view of the shell command 494 00:24:33,360 --> 00:24:34,760 and network secure system. 495 00:24:35,160 --> 00:24:36,200 Scanning my laptop. 496 00:24:36,280 --> 00:24:38,380 This was my laptop a month ago. 497 00:24:42,260 --> 00:24:42,800 And... 498 00:24:58,780 --> 00:25:00,140 This is my laptop now. 499 00:25:01,600 --> 00:25:02,940 I did that Thursday night 500 00:25:02,940 --> 00:25:04,140 because it occurred to me that, 501 00:25:04,180 --> 00:25:05,680 hey, I'm taking my machine into DEF CON. 502 00:25:05,780 --> 00:25:06,480 I better secure it. 503 00:25:06,560 --> 00:25:07,500 It took me about an hour. 504 00:25:13,540 --> 00:25:15,100 So to network secure a system, 505 00:25:15,220 --> 00:25:19,100 you use that list, pick a program, secure it, move on, 506 00:25:19,240 --> 00:25:20,960 run the unconfined command again 507 00:25:20,960 --> 00:25:22,440 until you have all the network ports. 508 00:25:22,440 --> 00:25:25,240 That are open, secured with a policy. 509 00:25:27,840 --> 00:25:29,560 Best uses for AppArmor. 510 00:25:29,620 --> 00:25:30,780 The corporate speak is 511 00:25:31,440 --> 00:25:32,700 companies whose network servers 512 00:25:32,700 --> 00:25:34,420 are running mission-critical applications. 513 00:25:35,160 --> 00:25:37,860 You have a high cost associated with compromise, 514 00:25:38,880 --> 00:25:41,700 regulatory compliance, all that Wall Street stuff. 515 00:25:42,300 --> 00:25:43,660 My point of view is 516 00:25:43,660 --> 00:25:46,240 if it's a Linux application and exposed to attack, 517 00:25:46,440 --> 00:25:47,840 then AppArmor is good for it. 518 00:25:48,420 --> 00:25:50,300 But if it's not on Linux, 519 00:25:50,360 --> 00:25:51,440 you're gonna need a different solution. 520 00:25:51,440 --> 00:25:52,920 And if it's not important, 521 00:25:53,040 --> 00:25:53,980 then I don't care either. 522 00:25:57,580 --> 00:25:58,660 Really that means 523 00:25:58,660 --> 00:26:01,460 the obvious application is network servers. 524 00:26:01,640 --> 00:26:03,760 You know, web servers, mail servers, DNS servers. 525 00:26:05,040 --> 00:26:06,080 Business applications, 526 00:26:06,500 --> 00:26:09,220 those are just big bulky versions of network services. 527 00:26:09,340 --> 00:26:12,040 You know, like your CRM system or whatever. 528 00:26:12,160 --> 00:26:13,520 Those things should be AppArmor-ed 529 00:26:13,520 --> 00:26:14,780 because they're exposed. 530 00:26:16,380 --> 00:26:17,180 Corporate desktop. 531 00:26:17,500 --> 00:26:18,560 Like I said with game, 532 00:26:18,760 --> 00:26:21,420 it's nice to have profiles around your critical network. 533 00:26:21,440 --> 00:26:22,000 You can network clients 534 00:26:22,000 --> 00:26:25,660 so that if someone sends your workers malware, 535 00:26:26,000 --> 00:26:27,100 it doesn't own the client. 536 00:26:27,480 --> 00:26:29,360 You know, Firefox and Thunderbird are wonderful, 537 00:26:29,460 --> 00:26:30,260 but they are not perfect. 538 00:26:31,660 --> 00:26:33,160 Put profiles around them 539 00:26:33,160 --> 00:26:35,340 so that the next time there's a buffer overflow 540 00:26:35,340 --> 00:26:36,700 in a JPEG handler, 541 00:26:36,780 --> 00:26:39,920 that a malicious website doesn't own your users. 542 00:26:41,140 --> 00:26:42,260 Point of sale terminal. 543 00:26:42,460 --> 00:26:44,220 If you wanted to build a kiosk 544 00:26:44,220 --> 00:26:45,440 that you're gonna lay out in public 545 00:26:45,440 --> 00:26:47,400 and let fun people like you play with, 546 00:26:48,880 --> 00:26:52,080 then you want to treat the keyboard and the mouse 547 00:26:52,080 --> 00:26:54,120 as being just as malicious as the network. 548 00:26:54,420 --> 00:26:56,580 So you profile everything that touches 549 00:26:56,580 --> 00:26:57,640 the keyboard and the mouse, 550 00:26:58,180 --> 00:27:00,240 which is not that difficult to do. 551 00:27:00,340 --> 00:27:02,740 What you do is you tell AppArmor to profile X 552 00:27:02,740 --> 00:27:03,620 and then start it. 553 00:27:03,820 --> 00:27:06,220 And AppArmor will create profiles, 554 00:27:06,460 --> 00:27:07,320 if you tell it to, 555 00:27:07,400 --> 00:27:09,740 for every single application that X starts. 556 00:27:09,980 --> 00:27:11,180 Just hit that P button 557 00:27:11,180 --> 00:27:13,900 and you'll get profiles for all of them. 558 00:27:14,460 --> 00:27:16,320 Now, for an engineering workstation, 559 00:27:16,320 --> 00:27:17,700 that would be a lot of programs. 560 00:27:17,840 --> 00:27:19,920 That would be an annoyingly large number of profiles. 561 00:27:20,200 --> 00:27:22,640 But for an airport kiosk? 562 00:27:22,680 --> 00:27:23,660 No, it's not. 563 00:27:23,840 --> 00:27:26,000 It's like dozens of programs at most 564 00:27:26,000 --> 00:27:27,780 so that the web server has helpers 565 00:27:27,780 --> 00:27:28,920 that can play Flash videos. 566 00:27:31,140 --> 00:27:35,180 So this is the range of applicability for AppArmor. 567 00:27:36,020 --> 00:27:37,900 So what happened at CTF? 568 00:27:40,300 --> 00:27:43,160 2002, the ghetto hackers handed out a reference system 569 00:27:43,160 --> 00:27:45,260 that was a deliberately vulnerable 570 00:27:45,260 --> 00:27:46,300 and stale version 571 00:27:46,320 --> 00:27:47,220 of Red Hat Linux. 572 00:27:49,580 --> 00:27:52,080 Our team, I was the captain. 573 00:27:52,180 --> 00:27:52,940 This was my mistake. 574 00:27:53,140 --> 00:27:55,040 We were too focused on demoing the technology 575 00:27:55,040 --> 00:27:56,660 and not enough on winning the game. 576 00:27:56,840 --> 00:27:58,500 So instead of launching the vulnerable server 577 00:27:58,500 --> 00:27:59,680 and trying to score some points, 578 00:27:59,800 --> 00:28:03,100 we kept it down until we had it all ported onto Immunix, 579 00:28:03,180 --> 00:28:04,900 which took the first 12 hours of play. 580 00:28:05,120 --> 00:28:07,120 And that cost us enough points to lose. 581 00:28:07,260 --> 00:28:08,180 So we only placed second. 582 00:28:09,780 --> 00:28:12,620 Next year, the target system was OpenBSD. 583 00:28:13,300 --> 00:28:15,300 Oh, well, we learned something 584 00:28:15,300 --> 00:28:16,940 and we launched the OBSD system anyway. 585 00:28:17,240 --> 00:28:20,060 And we eventually got everything ported to AppArmor 586 00:28:20,060 --> 00:28:21,140 and that was nice, 587 00:28:21,300 --> 00:28:22,780 but there was a lot of work in porting. 588 00:28:24,760 --> 00:28:26,460 2004, the target is Windows. 589 00:28:27,100 --> 00:28:27,860 Oh, yuck. 590 00:28:28,260 --> 00:28:29,880 Now, they were trying to be nice 591 00:28:29,880 --> 00:28:31,780 because all the apps that they demanded that you host 592 00:28:31,780 --> 00:28:34,460 were largely Perl or PHP or Python or something, 593 00:28:34,620 --> 00:28:38,000 but they had a whole bunch of nasty dependencies 594 00:28:38,000 --> 00:28:39,120 and library issues. 595 00:28:39,180 --> 00:28:41,100 And it turns out that it takes more than a weekend 596 00:28:41,100 --> 00:28:44,380 to port five applications over from Windows to Linux. 597 00:28:45,680 --> 00:28:47,000 This trend isn't good. 598 00:28:47,640 --> 00:28:49,740 2005, Kenshodo takes over. 599 00:28:49,960 --> 00:28:52,840 And Kenshodo changes the focus of the game 600 00:28:52,840 --> 00:28:55,220 where now the server to be defended 601 00:28:55,220 --> 00:28:57,080 is a virtual machine that they own 602 00:28:57,080 --> 00:28:58,760 and they hand you a network cable saying, 603 00:28:58,860 --> 00:29:00,100 this is your machine, defend it. 604 00:29:00,240 --> 00:29:02,160 You don't get to change the operating system, 605 00:29:02,300 --> 00:29:03,740 you only get to change the applications. 606 00:29:04,720 --> 00:29:07,240 And so this is effectively a new game. 607 00:29:07,380 --> 00:29:10,800 It changed the focus from both attack and defense 608 00:29:10,800 --> 00:29:12,380 to mostly just attack. 609 00:29:13,140 --> 00:29:15,220 It's tightly focused on reverse engineering, 610 00:29:15,300 --> 00:29:17,440 and code auditing applications, 611 00:29:17,780 --> 00:29:20,980 and defenses are not really permitted. 612 00:29:21,320 --> 00:29:22,840 I'm told this year's game, 613 00:29:23,540 --> 00:29:25,880 they've enhanced the ability to defend 614 00:29:25,880 --> 00:29:29,680 because they're looping the network path 615 00:29:29,680 --> 00:29:33,100 from the other guys to your server through your table. 616 00:29:33,340 --> 00:29:36,160 So now you can deploy network defenses. 617 00:29:36,560 --> 00:29:38,060 You still can't deploy host defenses 618 00:29:38,060 --> 00:29:39,840 because Kenshodo still owns the machine. 619 00:29:40,800 --> 00:29:42,320 So it's a game. 620 00:29:42,440 --> 00:29:43,240 It's a valid game. 621 00:29:43,320 --> 00:29:44,840 It's not a game that AppArmor can play. 622 00:29:47,380 --> 00:29:47,860 Comparisons. 623 00:29:49,400 --> 00:29:51,920 The other major system that you'll run into 624 00:29:51,920 --> 00:29:53,520 in the Linux space is SELinux. 625 00:29:54,480 --> 00:29:56,640 And it uses a system called type enforcement 626 00:29:57,920 --> 00:30:00,920 where you assign users and programs 627 00:30:00,920 --> 00:30:02,100 to what's called a domain, 628 00:30:02,320 --> 00:30:05,760 and you assign files to what's called a type, 629 00:30:05,940 --> 00:30:07,420 and then you write a policy that say 630 00:30:07,420 --> 00:30:09,480 which domains can access which types. 631 00:30:10,780 --> 00:30:11,860 AppArmor, in contrast, 632 00:30:11,940 --> 00:30:13,860 is using explicit path names for everything. 633 00:30:14,060 --> 00:30:15,280 The name of a program to be configured 634 00:30:15,300 --> 00:30:16,380 you can find has a path name. 635 00:30:16,600 --> 00:30:19,500 The names of the resources it can access have path names, 636 00:30:20,180 --> 00:30:22,260 and you generalize it with wildcards. 637 00:30:24,340 --> 00:30:26,320 So you can think of SELinux 638 00:30:26,900 --> 00:30:28,320 as the Post-it note security model. 639 00:30:28,840 --> 00:30:30,620 You put Post-it notes on everything, 640 00:30:30,780 --> 00:30:32,180 and then you write a policy that says 641 00:30:32,180 --> 00:30:34,180 that the blue ones can access the green ones 642 00:30:34,180 --> 00:30:35,700 and the yellow ones but not the purple ones. 643 00:30:36,860 --> 00:30:38,440 The label splitting problem 644 00:30:39,140 --> 00:30:41,100 is that a single label, 645 00:30:41,280 --> 00:30:42,280 you know, the purple sticker, 646 00:30:43,100 --> 00:30:44,620 describes an equivalence class 647 00:30:44,620 --> 00:30:46,600 of all the files that have purple stickers on them. 648 00:30:47,060 --> 00:30:48,080 And if you were correct 649 00:30:48,080 --> 00:30:50,300 when you made up that abstract class 650 00:30:50,300 --> 00:30:52,460 that says purple should all be treated the same, 651 00:30:52,520 --> 00:30:52,900 that's great, 652 00:30:53,060 --> 00:30:53,780 but if you ever discover 653 00:30:53,780 --> 00:30:55,920 that some of the files in the purple class 654 00:30:55,920 --> 00:30:57,820 need to be treated different than others, 655 00:30:58,000 --> 00:30:59,540 you need to split that label. 656 00:30:59,920 --> 00:31:01,200 Relabel all of those files, 657 00:31:01,440 --> 00:31:03,700 rewrite all the policy that uses those files, 658 00:31:04,580 --> 00:31:05,880 possibly with broad impact, 659 00:31:06,120 --> 00:31:07,840 and so you end up rewriting your security policy. 660 00:31:09,660 --> 00:31:11,620 AppArmor does ad hoc generalization. 661 00:31:12,580 --> 00:31:13,900 If you want to generalize to say 662 00:31:13,900 --> 00:31:15,180 treat all these files the same, 663 00:31:15,220 --> 00:31:16,460 you write it in a shell regapps. 664 00:31:16,680 --> 00:31:17,780 So you say 665 00:31:17,780 --> 00:31:20,760 slash SRV www.htdocs 666 00:31:20,760 --> 00:31:22,500 star star dot html. 667 00:31:22,840 --> 00:31:26,340 So my profile can treat this bunch of files 668 00:31:26,340 --> 00:31:27,300 as an equivalence class 669 00:31:27,300 --> 00:31:28,720 while yours is treating that bunch. 670 00:31:29,340 --> 00:31:30,420 They may overlap, 671 00:31:30,580 --> 00:31:31,900 but they don't have to be the same. 672 00:31:35,080 --> 00:31:35,920 Network storage. 673 00:31:37,720 --> 00:31:40,360 NFS doesn't carry labels. 674 00:31:41,020 --> 00:31:43,820 So you can't have SELinux nuanced labels 675 00:31:43,820 --> 00:31:45,520 on anything that's mounted over NFS. 676 00:31:46,860 --> 00:31:49,160 You get an all or nothing policy that says 677 00:31:49,160 --> 00:31:51,580 you can either have that entire NFS mount 678 00:31:51,580 --> 00:31:52,400 or you can't. 679 00:31:53,220 --> 00:31:54,180 AppArmor doesn't care. 680 00:31:54,360 --> 00:31:56,100 You can have all this regapps stuff 681 00:31:56,100 --> 00:31:58,060 digging down into NFS mounts all you want. 682 00:32:00,400 --> 00:32:03,040 This is a summary of the Red Hat webpage 683 00:32:03,040 --> 00:32:04,780 on how to create an SELinux profile. 684 00:32:05,420 --> 00:32:06,500 Shortened for your comfort 685 00:32:06,500 --> 00:32:07,720 because it's really seven pages. 686 00:32:08,620 --> 00:32:09,880 It's 16 steps, 687 00:32:10,080 --> 00:32:12,200 and the equivalent AppArmor steps 688 00:32:12,200 --> 00:32:13,440 are five steps, 689 00:32:13,440 --> 00:32:14,580 and that would be a cheap shot 690 00:32:14,580 --> 00:32:16,300 if the AppArmor steps were big, 691 00:32:16,920 --> 00:32:17,880 but they're not. 692 00:32:17,960 --> 00:32:19,480 They're actually smaller than these steps 693 00:32:19,480 --> 00:32:21,600 because the SELinux steps are things like 694 00:32:22,100 --> 00:32:23,660 edit the configuration file, 695 00:32:24,180 --> 00:32:25,740 debug it, lather, rinse, repeat. 696 00:32:26,060 --> 00:32:27,760 And the AppArmor steps are 697 00:32:27,760 --> 00:32:29,500 run the programs and answer the questions. 698 00:32:31,540 --> 00:32:32,780 Here's resulting policy. 699 00:32:33,480 --> 00:32:36,780 Thing one, they're similar policies for WooFTP. 700 00:32:37,100 --> 00:32:39,100 Thing one to notice is that the AppArmor profile 701 00:32:39,100 --> 00:32:40,200 is a quarter of the size. 702 00:32:40,680 --> 00:32:42,460 And thing two is when you zoom in 703 00:32:42,460 --> 00:32:43,540 and actually look at the policy, 704 00:32:44,300 --> 00:32:46,780 the SELinux policy is a programming language. 705 00:32:47,000 --> 00:32:49,100 It's an M4 scripting language 706 00:32:50,620 --> 00:32:52,120 with scary stuff in it. 707 00:32:52,260 --> 00:32:54,720 And the AppArmor policy is absolute path names, 708 00:32:55,300 --> 00:32:58,040 shell syntax wildcards, and RWX. 709 00:32:59,260 --> 00:33:00,320 There's an O'Reilly book 710 00:33:00,320 --> 00:33:01,780 on how to read SELinux policy, 711 00:33:02,040 --> 00:33:03,520 and I don't think you need a manual 712 00:33:03,520 --> 00:33:04,540 on how to read AppArmor. 713 00:33:06,820 --> 00:33:08,280 SELinux has added new GUI tools, 714 00:33:08,420 --> 00:33:09,900 and they are very nice GUI tools, 715 00:33:10,020 --> 00:33:10,860 and they're very powerful. 716 00:33:10,860 --> 00:33:13,460 And what they do is they enable you 717 00:33:13,460 --> 00:33:15,340 to very conveniently turn on and off 718 00:33:15,340 --> 00:33:18,240 already pre-authored security policy. 719 00:33:18,680 --> 00:33:21,380 They don't help with creating new policy, 720 00:33:21,520 --> 00:33:22,820 so if you're running any software 721 00:33:22,820 --> 00:33:24,000 that didn't come out of the box 722 00:33:24,000 --> 00:33:26,560 from your distro vendor, too bad. 723 00:33:26,660 --> 00:33:27,640 You're going to have to learn to deal 724 00:33:27,640 --> 00:33:28,700 with SELinux the hard way. 725 00:33:30,600 --> 00:33:32,580 AppArmor has GUI tools. 726 00:33:32,840 --> 00:33:34,560 They're not actually all that great. 727 00:33:34,920 --> 00:33:37,300 They're pretty primitive tools. 728 00:33:38,180 --> 00:33:40,200 It's the security model that makes it powerful. 729 00:33:43,820 --> 00:33:45,000 Near-term development. 730 00:33:45,300 --> 00:33:47,340 We're going to add network access controls. 731 00:33:47,640 --> 00:33:49,580 It's something that SELinux has and we don't. 732 00:33:49,580 --> 00:33:51,160 We will have it in the next release. 733 00:33:52,820 --> 00:33:55,000 Profile merge tool is an interesting thing 734 00:33:55,000 --> 00:33:57,820 that two AppArmor profiles can be merged 735 00:33:57,820 --> 00:34:00,400 so that the result satisfies 736 00:34:00,400 --> 00:34:03,100 all of the requirements of the two antecedents. 737 00:34:04,440 --> 00:34:06,840 This is a theorem that you can always do that. 738 00:34:07,000 --> 00:34:09,300 So if you have two concurrent people 739 00:34:09,300 --> 00:34:10,580 doing development on a profile, 740 00:34:10,860 --> 00:34:11,940 and they conflict, 741 00:34:12,240 --> 00:34:13,440 well, no, they don't conflict. 742 00:34:13,580 --> 00:34:15,720 You can just merge them and ship the result. 743 00:34:17,320 --> 00:34:19,560 There is a profile sharing portal 744 00:34:19,560 --> 00:34:22,860 that will be revealed for the first time 745 00:34:22,860 --> 00:34:23,900 in September in the UK 746 00:34:24,640 --> 00:34:27,420 that will automatically share your profiles 747 00:34:27,420 --> 00:34:29,220 with profiles that other people 748 00:34:29,220 --> 00:34:31,180 on the internet are using, optionally. 749 00:34:31,220 --> 00:34:34,920 It asks you if you want to use the shareable profile 750 00:34:34,920 --> 00:34:36,800 and it asks you if you want to publish yours. 751 00:34:37,060 --> 00:34:39,780 Or you can have your own internal profile sharing portal 752 00:34:39,780 --> 00:34:40,840 that is behind your profile 753 00:34:40,860 --> 00:34:41,060 on your firewall. 754 00:34:42,880 --> 00:34:46,240 In addition to ModPearl and ModPHP, 755 00:34:46,300 --> 00:34:47,840 we now have ChangeHat for Tomcat. 756 00:34:48,220 --> 00:34:50,580 So you can confine your Java servlets 757 00:34:50,580 --> 00:34:52,040 with little AppArmor profiles. 758 00:34:53,140 --> 00:34:54,480 There is a PAM module 759 00:34:54,480 --> 00:34:56,860 that lets you use ChangeHat for PAM 760 00:34:56,860 --> 00:34:59,040 so that you can do user-oriented confinement. 761 00:34:59,820 --> 00:35:02,340 And there is a growing collection of CIM providers 762 00:35:02,340 --> 00:35:03,980 who are doing that enterprise management stuff. 763 00:35:04,200 --> 00:35:04,540 Yes, sir? 764 00:35:04,740 --> 00:35:08,000 Is any of this stuff available on the openSUSE site now? 765 00:35:11,800 --> 00:35:14,660 Tomcat, PAM, and CIM are available. 766 00:35:17,800 --> 00:35:21,480 There is farther term development availability. 767 00:35:22,940 --> 00:35:25,120 AppArmor is included in every SUSE 10. 768 00:35:25,420 --> 00:35:26,020 Yeah? 769 00:35:26,820 --> 00:35:27,420 . 770 00:35:36,040 --> 00:35:37,340 That's an interesting idea 771 00:35:37,340 --> 00:35:38,520 and we should talk about it offline. 772 00:35:39,740 --> 00:35:41,620 The general theme... 773 00:35:41,620 --> 00:35:42,860 Sorry, for the audience, 774 00:35:42,940 --> 00:35:43,480 the question was, 775 00:35:43,540 --> 00:35:45,460 were there any plans to take the ChangeHat 776 00:35:45,460 --> 00:35:47,240 to other web authentication schemes? 777 00:35:48,100 --> 00:35:50,840 The general notion of ChangeHat 778 00:35:50,840 --> 00:35:54,840 is that you can embed it in an application, 779 00:35:55,120 --> 00:35:56,820 but AppArmor's design goal 780 00:35:56,820 --> 00:35:59,020 is to never have to change applications. 781 00:35:59,540 --> 00:36:02,040 You want to embed ChangeHat 782 00:36:02,040 --> 00:36:03,640 into application servers. 783 00:36:04,140 --> 00:36:06,360 So that's why ChangeHat 784 00:36:06,360 --> 00:36:08,480 is hacked into Tomcat and Apache 785 00:36:09,330 --> 00:36:11,940 as being an application server 786 00:36:11,940 --> 00:36:13,940 for ModPearl and ModPHP. 787 00:36:14,420 --> 00:36:16,520 PAM is an application server 788 00:36:16,520 --> 00:36:18,020 for login or for authentication. 789 00:36:19,200 --> 00:36:22,020 So if you have some kind of application server class 790 00:36:22,020 --> 00:36:26,440 where stuff with different security domains is appearing 791 00:36:26,440 --> 00:36:29,220 but it's not appearing with unique PIDs, 792 00:36:30,150 --> 00:36:32,360 then that's where you need ChangeHat 793 00:36:32,360 --> 00:36:33,800 to distinguish them. 794 00:36:37,040 --> 00:36:39,160 So AppArmor ships with every SUSE 10. 795 00:36:39,400 --> 00:36:42,360 I have a small number of open SUSE 10-2 disks here 796 00:36:42,360 --> 00:36:43,020 if someone wants some. 797 00:36:44,740 --> 00:36:46,360 AppArmor is fully GPLed. 798 00:36:47,240 --> 00:36:48,620 That's the community website 799 00:36:48,620 --> 00:36:49,580 if you want to get involved. 800 00:36:50,200 --> 00:36:52,040 We have all the usual mailing lists 801 00:36:52,040 --> 00:36:54,400 and an IRC channel, 802 00:36:55,380 --> 00:36:58,420 irc.oftc.net pound AppArmor. 803 00:37:00,580 --> 00:37:02,180 AppArmor is going into Ubuntu 804 00:37:03,700 --> 00:37:05,120 for Feisty Fawn. 805 00:37:06,360 --> 00:37:08,180 It is in Universe 806 00:37:08,180 --> 00:37:10,460 and for Gutsy Gibbon it will be in Maine. 807 00:37:13,600 --> 00:37:14,540 AppArmor for everyone. 808 00:37:16,020 --> 00:37:18,580 Matthew Snellum ported AppArmor to Gen 2, 809 00:37:19,160 --> 00:37:20,200 but I haven't heard from him lately. 810 00:37:21,780 --> 00:37:25,440 Debian, the Ubuntu Debs 811 00:37:25,440 --> 00:37:27,380 should work pretty well on Debian, 812 00:37:27,420 --> 00:37:29,680 but there is no Debian maintainer. 813 00:37:29,720 --> 00:37:31,820 If someone is a Debian committer 814 00:37:31,820 --> 00:37:33,540 and would like to maintain AppArmor, 815 00:37:33,580 --> 00:37:34,320 please talk to me. 816 00:37:37,600 --> 00:37:38,940 I just said all that. 817 00:37:40,640 --> 00:37:41,580 AppArmor for Red Hat. 818 00:37:42,300 --> 00:37:43,640 I had some of my engineers 819 00:37:43,640 --> 00:37:45,260 actually port AppArmor to Red Hat, 820 00:37:45,380 --> 00:37:47,120 but again there is no maintainer. 821 00:37:48,880 --> 00:37:50,500 The gotcha here is that 822 00:37:50,500 --> 00:37:52,220 AppArmor requires a kernel patch 823 00:37:52,220 --> 00:37:53,880 and that invalidates 824 00:37:53,880 --> 00:37:55,100 your Red Hat Enterprise support. 825 00:37:56,260 --> 00:37:58,020 So if someone, say, 826 00:37:58,160 --> 00:37:59,480 is a CentOS maintainer 827 00:37:59,480 --> 00:38:01,160 and would like to maintain AppArmor, 828 00:38:01,220 --> 00:38:01,700 that would be great. 829 00:38:01,760 --> 00:38:02,420 Please talk to me. 830 00:38:05,080 --> 00:38:05,520 Questions? 831 00:38:08,020 --> 00:38:08,520 Sir? 832 00:38:09,900 --> 00:38:11,480 It's obviously best to run 833 00:38:11,480 --> 00:38:14,760 the generating tool on a fresh machine, 834 00:38:14,900 --> 00:38:16,460 but if you're going in after the fact 835 00:38:16,460 --> 00:38:19,180 and trying to apply this to existing servers, 836 00:38:19,480 --> 00:38:23,840 can you use that thing that's generated 837 00:38:23,840 --> 00:38:26,600 sort of as a format auditing tool 838 00:38:26,600 --> 00:38:27,960 to be sure that what's in there 839 00:38:28,510 --> 00:38:29,340 should be in there? 840 00:38:29,520 --> 00:38:32,360 The question was whether you can use AppArmor 841 00:38:32,360 --> 00:38:33,980 on a non-fresh install. 842 00:38:34,740 --> 00:38:36,200 Yes, you can. 843 00:38:36,680 --> 00:38:38,420 You could install AppArmor 844 00:38:38,420 --> 00:38:39,700 on a machine that's been up for years. 845 00:38:40,500 --> 00:38:42,680 You would then have to train AppArmor 846 00:38:42,680 --> 00:38:43,640 on what your apps do, 847 00:38:43,800 --> 00:38:45,900 and it'll just learn it from your training cycles. 848 00:38:47,240 --> 00:38:49,660 Other things that you would want to know about 849 00:38:49,660 --> 00:38:52,180 is that you don't have to do 850 00:38:52,180 --> 00:38:54,280 the profile generation on the production machine. 851 00:38:54,580 --> 00:38:57,040 You can put the application in learning mode 852 00:38:57,040 --> 00:38:59,200 and then ship the profile collection 853 00:38:59,200 --> 00:39:00,740 that you started with and the log 854 00:39:00,740 --> 00:39:02,800 to a security analyst box 855 00:39:02,800 --> 00:39:03,960 on the other side of the country 856 00:39:03,980 --> 00:39:05,700 where he runs the learning tool 857 00:39:05,700 --> 00:39:06,600 to generate the policy. 858 00:39:07,060 --> 00:39:08,960 It doesn't even have to be on the same machine. 859 00:39:10,480 --> 00:39:12,960 You can put a program in learning mode 860 00:39:12,960 --> 00:39:14,200 and leave it there for a month, 861 00:39:15,060 --> 00:39:16,560 collect all the logs, 862 00:39:16,780 --> 00:39:18,440 feed them to the learning tool, 863 00:39:18,580 --> 00:39:21,000 and create a policy based on a great deal of experience. 864 00:39:21,840 --> 00:39:24,960 We took AppArmor into a large dot-com vendor 865 00:39:24,960 --> 00:39:29,560 where their QA cycle was run 30,000 real transactions 866 00:39:29,560 --> 00:39:31,120 from history through their website. 867 00:39:31,120 --> 00:39:34,340 And in an afternoon, 868 00:39:34,500 --> 00:39:36,300 it generated a quarter million log events. 869 00:39:37,100 --> 00:39:39,400 And in about an hour, 870 00:39:39,520 --> 00:39:41,760 AppArmor reduced that to 400 lines of rules. 871 00:39:44,400 --> 00:39:45,020 Sir? 872 00:39:57,890 --> 00:40:00,260 The question is whether you can use ChangeHat 873 00:40:00,260 --> 00:40:01,440 on user space threads. 874 00:40:02,180 --> 00:40:04,440 The significant feature is that 875 00:40:04,440 --> 00:40:05,700 you have to call ChangeHat 876 00:40:05,700 --> 00:40:07,180 every time you change threads. 877 00:40:07,860 --> 00:40:10,320 So if you can put ChangeHat in the scheduler, 878 00:40:10,360 --> 00:40:11,180 then yes. 879 00:40:13,720 --> 00:40:15,280 Otherwise, not so much. 880 00:40:16,920 --> 00:40:17,480 Sir? 881 00:40:25,600 --> 00:40:28,160 The question is whether AppArmor can stack 882 00:40:28,160 --> 00:40:29,680 with other LSM modules. 883 00:40:32,760 --> 00:40:35,400 Complex mandatory access control systems 884 00:40:35,400 --> 00:40:37,720 do not stack well with each other anyway. 885 00:40:40,360 --> 00:40:41,040 . 886 00:40:46,880 --> 00:40:48,140 Yep, yep. 887 00:40:48,640 --> 00:40:48,920 . 888 00:40:48,920 --> 00:40:51,760 They can be stacked with SELinux? 889 00:40:52,020 --> 00:40:52,340 . 890 00:40:53,180 --> 00:40:55,880 Which module can be stacked with SELinux? 891 00:40:56,020 --> 00:40:56,560 . 892 00:40:56,560 --> 00:40:57,320 Sorry? 893 00:40:57,540 --> 00:40:57,820 . 894 00:40:57,820 --> 00:40:59,700 Which module can be stacked with SELinux? 895 00:41:00,820 --> 00:41:01,600 . 896 00:41:17,320 --> 00:41:21,760 The LSM stacking model is not comfy. 897 00:41:22,520 --> 00:41:24,980 To stack any two modules together, 898 00:41:24,980 --> 00:41:26,620 at least one of them has to know about 899 00:41:26,620 --> 00:41:27,960 and cooperate with the stacking. 900 00:41:29,120 --> 00:41:32,820 I'm unaware of SELinux facilitating any stacking. 901 00:41:33,160 --> 00:41:36,000 So if some other module can stack with SELinux, 902 00:41:36,040 --> 00:41:38,080 it's because the other module was designed to do so. 903 00:41:39,820 --> 00:41:41,420 I'm unaware of any module 904 00:41:41,420 --> 00:41:43,160 that tries to stack with AppArmor. 905 00:41:44,440 --> 00:41:45,480 AppArmor incorporates 906 00:41:45,480 --> 00:41:48,780 the standard Linux capabilities module into it, 907 00:41:48,820 --> 00:41:51,920 so you throw out the original capabilities module 908 00:41:51,920 --> 00:41:52,980 and just use AppArmor. 909 00:41:54,020 --> 00:41:56,580 We are looking at other modules. 910 00:41:58,120 --> 00:41:59,840 Dezuko comes to mind. 911 00:42:00,420 --> 00:42:03,720 And I'm also interested in building an LSM module 912 00:42:03,720 --> 00:42:06,840 that incorporates some of the features from open-wall Linux 913 00:42:06,840 --> 00:42:07,960 from Solar Designer. 914 00:42:09,180 --> 00:42:11,320 But as far as I know, none of that exists. 915 00:42:12,560 --> 00:42:13,160 Sir? 916 00:42:13,500 --> 00:42:14,100 . 917 00:42:17,660 --> 00:42:18,960 The resource hit. 918 00:42:19,060 --> 00:42:21,320 The question is what resources does AppArmor consume? 919 00:42:21,320 --> 00:42:23,660 When we benchmark it, 920 00:42:23,720 --> 00:42:27,060 it shows a performance slowdown in the 2% range at most, 921 00:42:27,240 --> 00:42:28,540 usually a lot less than that. 922 00:42:29,180 --> 00:42:32,740 For memory, it's dependent on how many profiles you have. 923 00:42:34,260 --> 00:42:36,740 There's a small cost per process instance, 924 00:42:36,900 --> 00:42:38,860 but mostly they point to a reference profile, 925 00:42:39,060 --> 00:42:41,200 so the profiles aren't duplicated per process. 926 00:42:42,560 --> 00:42:44,900 So if you had a very large number of profiles 927 00:42:44,900 --> 00:42:46,520 or a very large number of rules, 928 00:42:46,660 --> 00:42:48,420 that would start consuming a bunch of kernel memory. 929 00:42:48,760 --> 00:42:49,240 . 930 00:42:49,880 --> 00:42:50,360 . 931 00:42:51,480 --> 00:42:52,360 . 932 00:42:56,420 --> 00:42:59,720 The largest deployment I was aware of, 933 00:42:59,780 --> 00:43:01,940 they had over 100,000 profiles loaded. 934 00:43:06,120 --> 00:43:06,560 Sir? 935 00:43:08,200 --> 00:43:08,640 . 936 00:43:14,260 --> 00:43:16,500 In recent work, 937 00:43:16,960 --> 00:43:19,820 we translated AppArmor from loading 938 00:43:19,820 --> 00:43:22,160 the text of the profiles into the kernel 939 00:43:22,160 --> 00:43:24,880 and doing regex matching on access requests, 940 00:43:25,260 --> 00:43:27,800 turned that into a DFA. 941 00:43:28,100 --> 00:43:31,240 The policies are now compiled into a state machine 942 00:43:31,240 --> 00:43:32,620 that is loaded into the kernel, 943 00:43:32,740 --> 00:43:35,700 and that is a pretty hot optimization 944 00:43:35,700 --> 00:43:37,020 for matching the rules. 945 00:43:38,800 --> 00:43:39,440 . 946 00:43:43,580 --> 00:43:44,220 Sir? 947 00:43:45,000 --> 00:43:45,640 . 948 00:43:45,640 --> 00:43:46,780 . 949 00:43:46,780 --> 00:43:47,240 . 950 00:43:48,540 --> 00:43:48,980 . 951 00:43:50,940 --> 00:43:51,380 . 952 00:43:51,380 --> 00:43:51,500 . 953 00:43:51,500 --> 00:43:53,300 The question is can you use the learning tool 954 00:43:53,300 --> 00:43:54,420 for monitoring exploration? 955 00:43:54,860 --> 00:43:54,980 . 956 00:43:55,780 --> 00:43:56,220 . 957 00:43:56,220 --> 00:43:56,440 . 958 00:43:56,440 --> 00:43:56,460 . 959 00:43:56,460 --> 00:43:56,620 . 960 00:43:56,620 --> 00:43:56,640 . 961 00:43:56,640 --> 00:43:57,220 . 962 00:43:57,220 --> 00:43:57,620 . 963 00:43:57,620 --> 00:43:57,720 . 964 00:43:57,720 --> 00:43:57,760 . 965 00:43:57,760 --> 00:43:57,780 . 966 00:43:57,780 --> 00:43:58,160 . 967 00:43:58,160 --> 00:43:58,180 . 968 00:43:58,180 --> 00:43:59,340 than one what-the-fuck moment. 969 00:44:00,460 --> 00:44:02,180 My favorite was when I discovered 970 00:44:02,180 --> 00:44:04,380 that game was running Wget on startup. 971 00:44:08,940 --> 00:44:10,920 So yeah, it's very good for understanding 972 00:44:10,920 --> 00:44:11,980 what your software is doing. 973 00:44:12,900 --> 00:44:15,520 The performance hit in learning mode is somewhat higher. 974 00:44:15,600 --> 00:44:17,140 That can be like 20% slowdown. 975 00:44:17,960 --> 00:44:21,580 And that's mostly because it's doing a lot of logging. 976 00:44:22,480 --> 00:44:25,280 The performance penalty for running in learning mode 977 00:44:25,280 --> 00:44:28,200 is a lot less if you give it a mostly done profile. 978 00:44:28,500 --> 00:44:30,700 And so you're just looking for the what-the-fuck moments 979 00:44:30,700 --> 00:44:31,620 and not the usual. 980 00:44:32,960 --> 00:44:35,720 We're working on an enhancement that we call log once, 981 00:44:36,360 --> 00:44:39,880 where instead of logging the same event over and over again, 982 00:44:40,140 --> 00:44:42,940 it'll just log it once for some value of recently 983 00:44:42,940 --> 00:44:44,800 because it would require infinite state 984 00:44:44,800 --> 00:44:46,860 to recall all the events that we've logged before. 985 00:44:54,080 --> 00:44:55,160 Well, thank you very much. 986 00:44:55,280 --> 00:44:56,060 I'm going to call it good. 987 00:44:56,260 --> 00:45:01,040 We have about 15 minutes for additional up-close questions here, 988 00:45:01,160 --> 00:45:02,560 and then it's time for DT.