1 00:00:04,540 --> 00:00:09,240 You're all here to see why I even call their putting a title like this on the screen. 2 00:00:10,360 --> 00:00:11,080 The other mic? 3 00:00:14,380 --> 00:00:15,300 This one, brother? 4 00:00:15,540 --> 00:00:16,260 Oh, yeah. 5 00:00:16,980 --> 00:00:17,720 There we go. 6 00:00:20,080 --> 00:00:24,860 Now I have this bad habit of wandering around and pointing at things, so remind me to talk into this. 7 00:00:25,520 --> 00:00:26,000 Okay. 8 00:00:26,000 --> 00:00:31,180 My name is Matthew Marsh, Chief Scientist at Nebraska CERT, President of Factonics, all sorts of weird shit like that. 9 00:00:31,560 --> 00:00:37,860 Basically, what I'm going to tell you about today is SNMPv3 and why I've been playing with SNMP itself since the late 80s. 10 00:00:38,780 --> 00:00:44,720 Basically, we're going to go through what SNMP is, if my PowerPoint on Linux works. 11 00:00:45,180 --> 00:00:45,760 Oh, great. 12 00:00:45,920 --> 00:00:46,540 This will be fun. 13 00:00:46,720 --> 00:00:47,320 There we go. 14 00:00:48,460 --> 00:00:52,460 We'll go over a very quick overview and history of SNMP, what it is, why, do you care. 15 00:00:52,980 --> 00:00:55,320 I'll give you a couple of quick definitions and terminologies. 16 00:00:55,320 --> 00:00:57,360 When I start tossing them out, you won't get too lost. 17 00:00:58,500 --> 00:01:07,100 The presentation that is on the CD is actually all full of information, references, RFC pointers, things like that. 18 00:01:07,780 --> 00:01:14,400 In the interest of showing you actual code running and how we play with it, I scrapped most of that, left it on the CD. 19 00:01:14,740 --> 00:01:21,120 This version of the presentation will also be available on the website, probably NebraskaCERT.org at least. 20 00:01:22,520 --> 00:01:25,160 Hopefully, I'll get a link out to DEF CON. 21 00:01:25,320 --> 00:01:27,220 I'll be able to tell them where all that is. 22 00:01:27,760 --> 00:01:29,220 The source code is available. 23 00:01:29,400 --> 00:01:32,640 I use NetSNMP for most of my stuff anymore because I can. 24 00:01:33,280 --> 00:01:34,680 We'll go into that a little bit. 25 00:01:34,900 --> 00:01:50,900 First, we're going to go through some of the highlights of v3, some of the NetSNMP extensions that we're talking about, what a MIB is and why I wrote the MIB I did, some of the source code, and then why did I even pick tripwire to pick on. 26 00:01:51,980 --> 00:01:53,040 Do you have an NMS? 27 00:01:53,220 --> 00:01:54,340 Don't you have an NMS? 28 00:01:54,500 --> 00:01:55,240 What do you want to do? 29 00:01:55,320 --> 00:02:00,520 I'll give you a demo of how this works in a lot of different details. 30 00:02:01,040 --> 00:02:05,240 The real summary of the whole thing is that SNMP is a message-passing protocol. 31 00:02:05,680 --> 00:02:08,040 That's pure and simple what it's designed for. 32 00:02:08,200 --> 00:02:11,360 It's designed for data transfers between managed devices. 33 00:02:12,780 --> 00:02:14,720 It's defined by a whole bunch of features. 34 00:02:14,960 --> 00:02:16,560 I'm sure you can read as well as I can. 35 00:02:16,660 --> 00:02:19,660 This slide is actually on the one on the CD as well. 36 00:02:19,900 --> 00:02:23,960 The things you really want to understand is that SNMP v1 has been bashed a lot. 37 00:02:26,120 --> 00:02:35,440 Given when it was invented in the late 80s, it's amazing that it lasted until the late 90s in any format whatsoever, and that it's even still in use. 38 00:02:36,680 --> 00:02:42,820 Contrary to popular belief, SNMP v1 did allow for authentication, authorization, and privacy. 39 00:02:43,400 --> 00:02:49,960 Those were never installed into it, and nothing was ever really done about that because, after all, you have a simple community. 40 00:02:50,180 --> 00:02:54,160 It's kind of like telling that you have a password, it's safe and secure, you're fine. 41 00:02:54,360 --> 00:02:55,160 Not a problem. 42 00:02:56,220 --> 00:03:02,460 The base at large for SNMP v1, and including all the way through v3, is read, write, and track. 43 00:03:02,560 --> 00:03:09,000 Track is a way for a managed agent to send a message back. 44 00:03:09,200 --> 00:03:12,580 Read and write are something that a manager does to an agent. 45 00:03:12,820 --> 00:03:15,340 So there's really two forces at work here. 46 00:03:15,720 --> 00:03:20,620 There's a manager piece, which is the piece that's doing the asking and the telling. 47 00:03:21,000 --> 00:03:24,520 And then there's an agent, which is the piece that's doing the, yeah, I got an answer, here you go. 48 00:03:24,660 --> 00:03:25,140 And let me know. 49 00:03:25,160 --> 00:03:25,800 Let me deal with it. 50 00:03:27,140 --> 00:03:32,400 It's first designed for UDP, as a lot of protocol transports were back then. 51 00:03:32,900 --> 00:03:40,160 V3 allows you to do TCP, and the extensions that we'll get into include just about any protocol you would like to run it over, 52 00:03:40,640 --> 00:03:43,220 including one of my personal favorites, IPX. 53 00:03:44,460 --> 00:03:49,860 SNMP v2 came with a bunch of different things, but there was a massive battle over as to whose was best, 54 00:03:49,980 --> 00:03:52,920 and who had the extensions that worked, and so on. 55 00:03:53,080 --> 00:03:55,080 And the ones that actually worked the best were all people. 56 00:03:55,160 --> 00:03:55,580 They were proprietary. 57 00:03:55,820 --> 00:03:56,520 Go figure. 58 00:03:58,580 --> 00:03:59,020 Definitions. 59 00:03:59,980 --> 00:04:04,080 Abstract syntax notation 1, which a lot of you have probably run into, ASN1. 60 00:04:04,280 --> 00:04:05,180 It's an ISO standard. 61 00:04:05,540 --> 00:04:09,120 It's a real cute way of using dotted numbers to say a bunch of things. 62 00:04:09,380 --> 00:04:14,940 If you're playing with LDAP, you're playing with SNMP, you're playing with a lot of other query engines, 63 00:04:15,120 --> 00:04:17,040 then you're going to run into ASN1. 64 00:04:17,380 --> 00:04:25,040 The real thing you need to care about is that it actually specifies where a location of a data point that you're interested in, 65 00:04:25,040 --> 00:04:25,400 is. 66 00:04:25,840 --> 00:04:31,100 In other words, if I give you a number like 136-141-9248-111, 67 00:04:31,260 --> 00:04:36,900 it actually specifies a data point that I have defined within the MIB structure that belongs to me. 68 00:04:37,140 --> 00:04:38,660 You can get your own MIB structure. 69 00:04:38,820 --> 00:04:43,760 In fact, I strongly suggest that if you want to, make sure you're at least on some list at IANA, 70 00:04:43,860 --> 00:04:47,620 that you go sign up for your own private MIB group. 71 00:04:49,460 --> 00:04:53,360 Realistically speaking, you don't need to know what a lot of these are. 72 00:04:53,420 --> 00:04:55,000 MIB 2 takes care of that. 73 00:04:55,040 --> 00:04:58,880 It takes care of about nine-tenths of everything you're going to want to do if you really want to manage a system. 74 00:04:59,060 --> 00:05:02,780 If you want to do private extensions, if you want to do some of the Cisco stuff they're talking about, 75 00:05:02,860 --> 00:05:05,980 if you want to do anything with a Wellfleet or whatever they call those routers now, 76 00:05:06,160 --> 00:05:08,040 or some of the other devices on the market, 77 00:05:08,120 --> 00:05:10,940 you have to go get their private MIBs if they've defined any. 78 00:05:11,320 --> 00:05:16,120 Private MIBs allow you to do things like change processor clock speeds on certain switches. 79 00:05:17,000 --> 00:05:19,620 And yes, those functions are embedded in there. 80 00:05:20,240 --> 00:05:22,660 In fact, you can do really weird things, 81 00:05:22,660 --> 00:05:29,080 like go out to network servers and change file times if you know which MIBs to do that with. 82 00:05:29,460 --> 00:05:32,580 There's a lot of that functionality built into these structures. 83 00:05:32,800 --> 00:05:34,920 You just have to go read the data and find out. 84 00:05:36,340 --> 00:05:40,560 The parts that would get kind of interesting is a MIB is a management information base. 85 00:05:40,660 --> 00:05:44,480 If you know what it is already, then I'm going to boil tears out of you 86 00:05:44,480 --> 00:05:50,400 by stating that it's a way to manage the data structure of what you're looking for. 87 00:05:50,600 --> 00:05:52,240 In other words, if I tell you I have a MIB, 88 00:05:52,240 --> 00:05:55,680 and you read it, you know what the data looks like or should look like. 89 00:05:55,960 --> 00:06:00,200 Now, recent extensions to the MIBs do allow you to do what's usually called a bulk 90 00:06:00,200 --> 00:06:05,520 or a blob in database circles where you have just a bunch of stuff you don't know what it is 91 00:06:05,520 --> 00:06:06,640 and you want to ram it down the pipe. 92 00:06:06,820 --> 00:06:08,200 You can now specify that. 93 00:06:08,940 --> 00:06:12,220 Historically, traditionally, and in the interest of portability, 94 00:06:12,360 --> 00:06:17,260 you want to limit your MIBs to integers, strings, things that are kind of normal. 95 00:06:17,480 --> 00:06:18,780 We're going to stay within that, 96 00:06:18,900 --> 00:06:22,160 and I'm actually going to show you at the end of this evening, 97 00:06:22,240 --> 00:06:26,980 a MIB definition file that you can import into your own Tivoli or your Unicenter 98 00:06:26,980 --> 00:06:29,820 or any network management you want, 99 00:06:30,060 --> 00:06:33,040 and it'll actually let you get all the hashes of any file in the system 100 00:06:33,040 --> 00:06:35,200 that you want to specify you want the hash of 101 00:06:35,920 --> 00:06:38,380 at the point that you specify it. 102 00:06:38,440 --> 00:06:40,560 You click go, it gives you the hash. 103 00:06:42,240 --> 00:06:43,820 Authorization and authentication. 104 00:06:45,160 --> 00:06:47,840 Obviously, most people confuse them a lot. 105 00:06:47,960 --> 00:06:50,420 For our purposes, we're going to confuse them even further 106 00:06:50,420 --> 00:06:51,880 because I'm going to give them the same thing. 107 00:06:52,240 --> 00:06:55,180 Basically, you're authorized if you authenticate. 108 00:06:56,920 --> 00:07:00,820 Now, there are things in SNPv3 that will extend that 109 00:07:00,820 --> 00:07:02,820 and split the functions out for right now. 110 00:07:03,940 --> 00:07:08,160 Just bear in mind that they actually have a way to encrypt using MD5 or SHA 111 00:07:08,160 --> 00:07:11,840 or your favorite hash the actual authentication structure. 112 00:07:12,780 --> 00:07:17,000 The tracks have changed between v1 and v3. 113 00:07:17,080 --> 00:07:21,820 I actually browsed through the CD that they have here, 114 00:07:22,240 --> 00:07:24,680 and the network management best practices PDF on there 115 00:07:25,220 --> 00:07:27,300 explains a lot of this in really good detail. 116 00:07:27,500 --> 00:07:30,740 Yes, it's Cisco-centric, so there's a few things you've got to take and go, 117 00:07:30,800 --> 00:07:34,260 yeah, nice marketing dribble, flick, but most of it is good data. 118 00:07:34,580 --> 00:07:37,400 It'll tell you a lot about how this stuff works. 119 00:07:38,040 --> 00:07:39,800 Version 3, the important parts. 120 00:07:39,980 --> 00:07:45,340 There's actual real authentication built into the structure now. 121 00:07:45,480 --> 00:07:47,580 You can have passphrases. 122 00:07:47,800 --> 00:07:49,140 They can include spaces. 123 00:07:49,560 --> 00:07:51,300 They must be longer than eight characters. 124 00:07:51,300 --> 00:07:52,400 Yada, yada, yada. 125 00:07:52,560 --> 00:07:54,240 There's a buttload of MIBs to read. 126 00:07:54,400 --> 00:07:57,400 There's a buttload of RFCs to read if you really want to know how this works. 127 00:07:57,680 --> 00:07:58,800 There's also privacy. 128 00:08:00,300 --> 00:08:02,700 Privacy equals encryption in this case. 129 00:08:02,880 --> 00:08:07,640 Basically, you can say, okay, I want to make sure that even though I'm getting data, 130 00:08:07,800 --> 00:08:09,740 I don't want you to read it if you're sniffing the wire. 131 00:08:09,900 --> 00:08:12,400 I can use a key to encrypt it. 132 00:08:12,740 --> 00:08:15,500 Right now, it's DES by default. 133 00:08:15,620 --> 00:08:19,120 But in the future, you can use any encryption you want. 134 00:08:19,240 --> 00:08:21,280 In fact, the spec of this, 135 00:08:21,300 --> 00:08:30,380 the code itself currently states that all different types of privacy encryption can be used 136 00:08:30,380 --> 00:08:33,920 by telling the system what to use and what key structure. 137 00:08:34,360 --> 00:08:35,500 It's all in there. 138 00:08:35,540 --> 00:08:39,580 You just tell the system, hey, I want to use AES-128. 139 00:08:39,680 --> 00:08:41,520 I want to use whatever. 140 00:08:41,880 --> 00:08:43,520 You name it, you can use it. 141 00:08:44,420 --> 00:08:45,900 The old-style traps. 142 00:08:46,400 --> 00:08:50,380 Most traps in the original systems were throw and play. 143 00:08:51,300 --> 00:08:52,320 We were using UDP. 144 00:08:52,740 --> 00:08:56,820 If we weren't reading and writing data, we said, okay, agent, 145 00:08:56,900 --> 00:08:59,520 you can tell me that there's a big problem right now. 146 00:08:59,600 --> 00:08:59,960 Wow. 147 00:09:00,720 --> 00:09:01,580 Almost stereo. 148 00:09:01,920 --> 00:09:03,080 At least one different side. 149 00:09:04,180 --> 00:09:04,660 Cool. 150 00:09:08,820 --> 00:09:09,660 All right. 151 00:09:10,040 --> 00:09:12,880 Now the other people don't have to feel shortchanged. 152 00:09:13,740 --> 00:09:14,220 Okay. 153 00:09:14,480 --> 00:09:15,260 Informed traps. 154 00:09:15,540 --> 00:09:19,080 The old-style traps, as I was starting to say, basically, we threw them and played. 155 00:09:19,340 --> 00:09:20,460 If I was an agent, 156 00:09:20,460 --> 00:09:23,500 and I needed to tell my manager that something's really badly wrong, 157 00:09:23,740 --> 00:09:27,140 I threw this trap out over UDP, and I prayed that it got there. 158 00:09:27,600 --> 00:09:30,520 Most of the time, eh, didn't get there. 159 00:09:30,900 --> 00:09:32,060 New-style traps. 160 00:09:32,260 --> 00:09:33,540 First of all, we can now do TCP. 161 00:09:33,940 --> 00:09:38,000 So I can send out a trap, and I can do it over TCP, and I can basically say, okay, 162 00:09:38,160 --> 00:09:40,060 I'm going to open a connection before I do the trap. 163 00:09:40,520 --> 00:09:41,440 Yes, there's overhead. 164 00:09:42,100 --> 00:09:45,000 Realistically, if you can get away with UDP, do it. 165 00:09:45,440 --> 00:09:49,620 You can actually specify per trap what you want to send. 166 00:09:49,620 --> 00:09:50,700 Even better. 167 00:09:50,860 --> 00:09:55,740 There's a trap style now called inform, which means I'm going to send you this trap over TCP, 168 00:09:56,060 --> 00:09:57,120 and I'm going to block. 169 00:09:57,280 --> 00:09:59,820 I'm going to wait until I receive a response from you, 170 00:09:59,920 --> 00:10:02,600 and I'm going to keep bugging you until you tell me you got it. 171 00:10:03,760 --> 00:10:06,440 Granted, if there's a network failure, SOL. 172 00:10:07,340 --> 00:10:11,040 But in a lot of those cases, you can guarantee most of the time, 173 00:10:11,160 --> 00:10:14,100 in the absence of a network failure, that the trap will get through. 174 00:10:14,580 --> 00:10:18,960 When you're talking about a trap that says, you know, I just lost all of my connectivity, 175 00:10:18,960 --> 00:10:22,500 to the rest of the world, and the user's going to be screaming a second, 176 00:10:22,600 --> 00:10:23,380 that's kind of important. 177 00:10:24,420 --> 00:10:25,300 Security structures. 178 00:10:25,560 --> 00:10:30,340 All user scope and ACL structures may have independent authentication 179 00:10:30,340 --> 00:10:31,600 and privilege structures. 180 00:10:32,060 --> 00:10:35,200 In other words, I can use a bunch of different users for a bunch of different purposes. 181 00:10:37,000 --> 00:10:38,060 General usage notes. 182 00:10:38,140 --> 00:10:41,760 If you don't play with this stuff, and by the way, Cisco's had it for quite a while now. 183 00:10:41,860 --> 00:10:46,260 I think 1999, they actually had an almost usable version, 184 00:10:46,520 --> 00:10:48,940 and by 2001, it worked well. 185 00:10:48,960 --> 00:10:55,340 It does require that you use the American version of the software 186 00:10:55,340 --> 00:10:57,300 if you want to do the real encryption, 187 00:10:57,920 --> 00:11:02,200 but you can apparently on the export version at least use the authentication structures. 188 00:11:03,120 --> 00:11:08,980 And by the way, the side note to that is if you have a version of IOS or CADOS 189 00:11:08,980 --> 00:11:13,800 that supports SMMPv3, it also supports SSH as well, 190 00:11:13,820 --> 00:11:15,060 because it's the same encryption engine. 191 00:11:16,220 --> 00:11:18,940 You always want to use one of these. 192 00:11:18,960 --> 00:11:22,080 Get user, because this is based on a quote unquote user, 193 00:11:22,800 --> 00:11:24,060 for each action. 194 00:11:24,260 --> 00:11:26,540 A get user, a set user, a trap user. 195 00:11:26,980 --> 00:11:30,820 You also want to use different authentication consequences for all of those people. 196 00:11:31,080 --> 00:11:32,060 Don't use the same one. 197 00:11:32,580 --> 00:11:36,440 Now, public and private, those died a long time ago, we hope. 198 00:11:36,720 --> 00:11:37,640 Well, it depends. 199 00:11:37,820 --> 00:11:39,540 If you're trying to get into something, you hope it didn't die. 200 00:11:40,600 --> 00:11:42,180 Okay, always use privacy. 201 00:11:43,340 --> 00:11:45,460 Authpriv is the way you specify it. 202 00:11:45,580 --> 00:11:47,880 One of the things that's interesting about this is 203 00:11:47,880 --> 00:11:50,920 you can't use privacy without using authentication. 204 00:11:52,360 --> 00:11:56,280 And it sounds like, oh gee, well, you know, I'd like to be able to use either or, 205 00:11:56,360 --> 00:11:58,600 but then when you think about it, it kind of makes a little more sense. 206 00:11:58,680 --> 00:12:02,320 Why are you going to bother encrypting it if you can't verify that you're the one asking the question? 207 00:12:03,400 --> 00:12:06,120 So usually, when you use privacy, you use authpriv. 208 00:12:06,300 --> 00:12:11,400 Now, privacy defaults to using the same passphrase that the authentication uses. 209 00:12:11,840 --> 00:12:13,360 It doesn't have to be so. 210 00:12:13,460 --> 00:12:16,900 In fact, in the spec, it even says you really should not do that. 211 00:12:17,880 --> 00:12:21,300 But it will default that way in case you only want to use one passphrase. 212 00:12:22,660 --> 00:12:23,900 All custom applications. 213 00:12:24,260 --> 00:12:26,880 If you're using your own custom applications, as I was saying earlier, 214 00:12:26,920 --> 00:12:30,540 the actual structure for SMPv3 allows you to use anything you want. 215 00:12:30,680 --> 00:12:33,180 You can say, hey, I want to use this kind of encryption. 216 00:12:33,260 --> 00:12:34,700 I want to use this kind of authentication. 217 00:12:34,900 --> 00:12:37,580 You don't have to use MB5 or SHA or DES. 218 00:12:37,740 --> 00:12:41,380 You just have to make sure the manager and the agent both understand that. 219 00:12:42,160 --> 00:12:44,920 Recently, and I'll get into this when I get into NetSMP a bit, 220 00:12:44,920 --> 00:12:48,700 Wes Hartiger, who's the lead programmer of that project, 221 00:12:48,900 --> 00:12:51,600 sent out this really cryptic message to net coders 222 00:12:51,600 --> 00:12:57,840 that basically showed an AES-128, I think it was, encryption structure 223 00:12:57,840 --> 00:13:01,280 working flawlessly under the NetSMP thing, 224 00:13:02,540 --> 00:13:06,080 which is kind of nice because if you're using just DES, 225 00:13:06,260 --> 00:13:08,340 which is what everybody defaults to now, 226 00:13:08,520 --> 00:13:10,420 you know how old the name of that is. 227 00:13:11,260 --> 00:13:12,300 The extensions. 228 00:13:12,840 --> 00:13:14,680 The extensions I play with here, 229 00:13:14,920 --> 00:13:18,260 actually I use the MHash libraries to do the hashing. 230 00:13:18,380 --> 00:13:18,780 Why? 231 00:13:19,480 --> 00:13:23,020 Because I can cut and paste that code easier than I could write my own. 232 00:13:24,200 --> 00:13:26,160 Realistically, what it does also allow me to do 233 00:13:26,160 --> 00:13:28,300 is use any other hashing function in the library 234 00:13:28,700 --> 00:13:31,720 simply by changing the way I define the function that's calling it. 235 00:13:31,980 --> 00:13:34,360 In fact, you could, and I haven't yet, 236 00:13:34,500 --> 00:13:38,040 but set up a mid that says, here's the function I want to use. 237 00:13:38,420 --> 00:13:40,640 Now I will switch to it and use it. 238 00:13:40,900 --> 00:13:42,660 Bear in mind, it's not just for authentication, 239 00:13:43,000 --> 00:13:44,900 but for the hashing structure of it. 240 00:13:44,920 --> 00:13:47,120 It's for the files themselves that we're going to look at. 241 00:13:48,080 --> 00:13:50,600 And you can easily extend that to use Encrypt, 242 00:13:50,660 --> 00:13:51,780 any library you want. 243 00:13:51,880 --> 00:13:53,800 You can even put in a static function. 244 00:13:53,900 --> 00:13:56,400 If you have your own super cool encryption algorithm 245 00:13:56,400 --> 00:13:59,360 that no one else uses, you know, on XOR 13 or something, 246 00:13:59,620 --> 00:14:00,800 hey, go for it. 247 00:14:00,840 --> 00:14:01,720 You can put it in there. 248 00:14:01,880 --> 00:14:05,440 The nice part about that is that if you define both sides of it, 249 00:14:05,560 --> 00:14:08,840 it makes it that much harder to figure out what's going on. 250 00:14:10,060 --> 00:14:12,640 Realistically, you always want to set up your initial security 251 00:14:12,640 --> 00:14:14,740 for all of this in a secure environment. 252 00:14:14,920 --> 00:14:17,040 You don't want to go throwing these things out there 253 00:14:17,040 --> 00:14:18,800 and then configuring them. 254 00:14:20,200 --> 00:14:22,780 Well, you could, but you probably don't want to. 255 00:14:23,640 --> 00:14:26,840 The reason I harp on SNMP as a message passing protocol 256 00:14:26,840 --> 00:14:29,760 is that's actually what I'm going to use it as in the rest of this talk. 257 00:14:30,000 --> 00:14:32,040 I'm going to use it in all of these demonstrations 258 00:14:32,760 --> 00:14:34,120 and all of the stuff following 259 00:14:34,120 --> 00:14:38,740 as a way to get a secure statement out to an agent 260 00:14:38,740 --> 00:14:42,380 and as a way to get the hash securely back to me. 261 00:14:42,740 --> 00:14:43,740 And as you'll see, 262 00:14:43,740 --> 00:14:46,280 when I go into a source code a bit, I can get anything I want. 263 00:14:46,440 --> 00:14:47,560 You want the listing of the disk? 264 00:14:47,760 --> 00:14:49,180 You want the processor utilization? 265 00:14:49,780 --> 00:14:50,740 What would you like? 266 00:14:50,740 --> 00:14:51,940 You can put it in there. 267 00:14:54,020 --> 00:14:54,820 Net SNMP. 268 00:14:54,940 --> 00:14:56,120 This is what I actually use. 269 00:14:56,780 --> 00:14:58,420 It's had V3 since 1998. 270 00:14:58,660 --> 00:15:03,800 It used to be the UC database, the UCD SNMP platform. 271 00:15:04,380 --> 00:15:06,300 There was a CMU and UCD. 272 00:15:06,980 --> 00:15:10,720 UCD kind of was continuously developed and continuously developed. 273 00:15:11,740 --> 00:15:13,440 CMU kind of fell by the wayside. 274 00:15:14,320 --> 00:15:18,220 Wes Hartaker actually came from UCD and continued it. 275 00:15:18,320 --> 00:15:20,940 And recently they renamed the project Net SNMP. 276 00:15:22,560 --> 00:15:25,960 You know, sadly to say, I don't really know the licensing. 277 00:15:26,160 --> 00:15:27,040 I think it's BSD. 278 00:15:27,500 --> 00:15:29,220 I know it's not GPL. 279 00:15:29,720 --> 00:15:33,040 I GPL my stuff and I know that's a different license than they use. 280 00:15:33,180 --> 00:15:37,640 I think it's BSD because I'm fairly certain parts of it are in W2K. 281 00:15:39,400 --> 00:15:41,720 It's originally based on those implementations. 282 00:15:41,740 --> 00:15:43,500 It's actually gone a lot further than that. 283 00:15:43,740 --> 00:15:45,920 It includes all the tools you could possibly want. 284 00:15:46,080 --> 00:15:49,920 You can have the agent, which is the part that actually runs and serves up data. 285 00:15:50,040 --> 00:15:52,460 It has all the tools to query and get information. 286 00:15:52,780 --> 00:15:57,040 The only thing it doesn't really have is a full NMS, which is basically a nice cute 287 00:15:57,040 --> 00:16:00,640 GUI or something similar that says, oh, let me click here and find out the data. 288 00:16:01,180 --> 00:16:04,580 Although they supposedly have a couple of projects that are related to them that can 289 00:16:04,580 --> 00:16:04,940 do that. 290 00:16:05,760 --> 00:16:10,860 The neat thing about Net SNMP, one of the things that made me start really playing with 291 00:16:10,860 --> 00:16:13,240 the new 5X code, which was released about a year ago. 292 00:16:13,240 --> 00:16:19,700 Is that it now divorced the transport, in other words the protocol, from the actual 293 00:16:20,860 --> 00:16:22,200 data structures themselves. 294 00:16:22,640 --> 00:16:26,600 In other words, if you've ever played with Nobel stuff way back when, you realize that 295 00:16:26,600 --> 00:16:28,340 they could do SNMP over IPX. 296 00:16:28,860 --> 00:16:30,640 And when you think about it, it makes perfect sense. 297 00:16:30,760 --> 00:16:34,840 Because SNMP does not say anything really and truly in any of the RFCs about IP. 298 00:16:35,160 --> 00:16:37,680 It just says, hey, here's the way I form a packet. 299 00:16:37,800 --> 00:16:38,460 Here's what I do. 300 00:16:38,580 --> 00:16:39,620 Here's how I talk to stuff. 301 00:16:40,500 --> 00:16:43,220 The nicest thing about this is it'll let you use all sorts of things. 302 00:16:43,220 --> 00:16:45,320 Including IPX on Linux. 303 00:16:46,540 --> 00:16:50,940 Being as my entire network is Linux, well, except for my network server, which is still 304 00:16:50,940 --> 00:16:51,320 running. 305 00:16:51,420 --> 00:16:53,300 I don't want to turn it off because it has my data on it. 306 00:16:53,920 --> 00:16:55,760 And it backs itself up, so I don't care. 307 00:16:56,740 --> 00:17:02,120 The IPX is very nice because now I can run a management structure across my entire network, 308 00:17:02,220 --> 00:17:04,500 including my internet connected parts. 309 00:17:05,380 --> 00:17:08,080 And you can't see it if you're coming in from the internet. 310 00:17:08,280 --> 00:17:09,120 It just ain't there. 311 00:17:09,720 --> 00:17:13,100 I can run an AOL5, which is kind of fun. 312 00:17:13,100 --> 00:17:13,240 It's very funky. 313 00:17:14,020 --> 00:17:16,900 Somebody apparently did get it to work over DECnet. 314 00:17:17,380 --> 00:17:17,880 Why? 315 00:17:18,080 --> 00:17:21,290 I don't know, but hey, if that's your thing, cool. 316 00:17:22,820 --> 00:17:28,160 The interesting part is if you go look in the NetSNMP code, all the transports are broken 317 00:17:28,160 --> 00:17:28,680 out now. 318 00:17:29,180 --> 00:17:37,220 IPv6 TCP, IPv6 UDP, regular TCP, regular UDP, IPX, AOL5, blah, blah, blah. 319 00:17:37,480 --> 00:17:41,260 And they even have one that's called sample.protocol. 320 00:17:42,060 --> 00:17:43,080 Guess what that is? 321 00:17:43,080 --> 00:17:44,700 You want to write your own protocol? 322 00:17:44,820 --> 00:17:46,400 You want to use a protocol that they don't have? 323 00:17:46,740 --> 00:17:47,540 Go for it. 324 00:17:48,140 --> 00:17:48,720 Do it. 325 00:17:49,800 --> 00:17:54,800 I haven't bothered because I've got bigger things to try, but it's there, and if someone 326 00:17:54,800 --> 00:17:58,060 wants to write it for some of those more obscure protocols, that would be a really 327 00:17:58,060 --> 00:17:58,640 good contribution. 328 00:18:00,300 --> 00:18:00,700 Okay. 329 00:18:01,460 --> 00:18:05,560 The real reason you're kind of sitting here and wondering why I'm doing some of this. 330 00:18:05,620 --> 00:18:08,660 First, let's go over the MIB and stuff, and then I'll discuss why I'm picking on poor 331 00:18:08,660 --> 00:18:09,120 tripwire. 332 00:18:09,760 --> 00:18:10,780 This is the MIB. 333 00:18:11,100 --> 00:18:13,060 This is actually pretty much the same thing as the MIB. 334 00:18:13,060 --> 00:18:13,140 I'm going to mark it as the MIB, but I'm going to define it as a package. 335 00:18:13,140 --> 00:18:15,640 You're going to have to make sure that, gosh, with the exception of some whitespace and 336 00:18:15,640 --> 00:18:20,060 some additional padding that you have to put in there, the entire MIB that we're going 337 00:18:20,060 --> 00:18:21,320 to use for all these definitions. 338 00:18:22,160 --> 00:18:23,600 First, we define our enterprise. 339 00:18:24,220 --> 00:18:27,360 Now, realistically, 9240 belongs to Packtronic systems. 340 00:18:27,740 --> 00:18:31,400 But, hey, I can make it belong to anybody I want if I define it in the MIB. 341 00:18:31,780 --> 00:18:34,000 As long as the agent leds it, what do I care? 342 00:18:34,000 --> 00:18:40,000 So for the purposes of this, and for the purposes of software on the CD, I defined it to pacdef.x. 343 00:18:40,520 --> 00:18:47,140 The pacdc is an OID that says this is an object identifier underneath that global reference. 344 00:18:48,080 --> 00:18:51,900 And under that, I'm going to have set files. This is where we're going to play games. 345 00:18:52,640 --> 00:18:58,740 There's two things under set files. The test file string, which is an actual string size 0 to 1024, 346 00:18:59,020 --> 00:19:02,000 and you can make it whatever you want. You can also change the types. 347 00:19:02,000 --> 00:19:06,460 But this makes it easy, and it'll load it into any mid-compiler out there. 348 00:19:06,780 --> 00:19:12,940 And it's a publicly-setable string. Basically, you set this string, and then you call pac test file hash. 349 00:19:13,160 --> 00:19:20,100 And what that does is it goes out, takes your string, and says, give me an md5 sum of this file on the agent system. 350 00:19:20,740 --> 00:19:26,140 I'm going to demo it on one box. The reality is, this is running manager and agent. 351 00:19:26,360 --> 00:19:31,800 The agent part could be running on anything I want, anywhere in my enterprise that I can get to, 352 00:19:32,000 --> 00:19:37,680 over the protocol that I'm using. In other words, when I set this string on a remote machine, 353 00:19:38,060 --> 00:19:43,020 I'm actually telling it, go look at this file on that machine over there, and give me that hash. 354 00:19:44,340 --> 00:19:48,600 The source code. There's a source code in there that's provided as a patch against NetSMMP. 355 00:19:48,800 --> 00:19:52,180 We'll take a quick look at the C file, because I want to show you the main functions. 356 00:19:53,220 --> 00:19:57,180 It's tested on all versions up to 502, as of a couple of days ago or so. 357 00:19:57,380 --> 00:20:01,740 The 502 pre-1 source code for NetSMMP is, I included on the CD, 358 00:20:02,000 --> 00:20:07,420 I also included mhash 0810, which is what I actually wrote the hash routine against, to make it a lot easier. 359 00:20:07,540 --> 00:20:11,080 So everything's there if you want to play with it. It'll compile on all major unices. 360 00:20:11,300 --> 00:20:14,660 Oh, and by the way, NetSMMP apparently will compile on Windows platforms. 361 00:20:15,420 --> 00:20:18,240 Don't ask me. I don't run them. I have no clue. 362 00:20:18,520 --> 00:20:21,600 If someone wants to tell me, I'll be more than happy to put the information out there. 363 00:20:21,880 --> 00:20:26,420 Don't do it myself. If you do apply the patch against 502, there's two rejects, 364 00:20:26,420 --> 00:20:31,980 because we changed the way some of the protections are done. 365 00:20:31,980 --> 00:20:36,240 In the TCP and UDP files, but you can ignore them. 366 00:20:36,660 --> 00:20:39,820 And then there's a configure file I put in there on purpose, 367 00:20:39,940 --> 00:20:43,340 because there's a whole bunch of options which wouldn't be real familiar. 368 00:20:43,680 --> 00:20:46,820 This configure file at least gets you up and running and lets you compile it 369 00:20:46,820 --> 00:20:49,920 so that you can run this code and see this code in operation. 370 00:20:50,940 --> 00:20:53,960 Edit it, look at it, figure out how everything works. 371 00:20:54,480 --> 00:20:58,900 If anything else fails, you can email me at whatever address you find for me that works. 372 00:20:59,740 --> 00:21:01,260 And then make install. 373 00:21:01,980 --> 00:21:04,680 You can run it from there if you set the LD library path appropriately. 374 00:21:04,940 --> 00:21:08,060 You can make it statically. It's not a big deal. 375 00:21:08,340 --> 00:21:12,680 And there are people out there who have made strip binaries for this for the purpose of embedded systems. 376 00:21:12,940 --> 00:21:15,180 They are really tiny and work really well. 377 00:21:16,100 --> 00:21:18,120 Don't have them with me, but they are out there. 378 00:21:18,260 --> 00:21:21,140 And then, of course, the most fun part is once it's installed, go ahead and play. 379 00:21:23,600 --> 00:21:25,060 Why did I pick on tripwire? 380 00:21:27,000 --> 00:21:27,840 Made you look. 381 00:21:29,940 --> 00:21:33,140 Reality is it was fairly simple, and it was one of those things. 382 00:21:33,280 --> 00:21:35,860 I've had this hashing thing for about a year now. 383 00:21:36,060 --> 00:21:37,340 Been kind of playing with it. 384 00:21:37,620 --> 00:21:39,640 Someone was talking to me one day, and I was telling him, 385 00:21:39,720 --> 00:21:44,580 oh, no, that's just a list of the hashes of the important files in one of my servers over at the ISP. 386 00:21:44,880 --> 00:21:46,220 And they went, oh, really? 387 00:21:46,680 --> 00:21:49,180 Are you running tripwire over SSH? 388 00:21:50,000 --> 00:21:52,500 I'm like, huh, no, I never thought of it that way. 389 00:21:52,580 --> 00:21:55,560 But, no, I'm running it over SNMPv3. 390 00:21:56,540 --> 00:21:56,920 Basically, 391 00:21:57,840 --> 00:22:01,740 when you look at something like tripwire or any kind of integrity program like that, 392 00:22:01,880 --> 00:22:03,980 you need to ensure the file integrity. 393 00:22:04,400 --> 00:22:05,300 What does that really mean? 394 00:22:05,480 --> 00:22:06,620 It means, did the file change? 395 00:22:07,000 --> 00:22:12,540 And if it changed, do you have an idea of when or how or where or why? 396 00:22:13,480 --> 00:22:17,160 Most common file integrity programs to do this, they use a hash and a database. 397 00:22:17,480 --> 00:22:18,320 Here's the file name. 398 00:22:18,360 --> 00:22:18,940 Here's the hash. 399 00:22:19,480 --> 00:22:20,180 Real difficult. 400 00:22:21,040 --> 00:22:25,160 Management systems, on the other hand, are these incredibly expensive, huge things, 401 00:22:25,260 --> 00:22:27,440 although OpenNMS is getting pretty good. 402 00:22:27,840 --> 00:22:30,400 Scotty is still a strong contender, and they're free. 403 00:22:31,160 --> 00:22:34,880 They're basically big databases with correlation engines attached to them. 404 00:22:35,000 --> 00:22:37,440 They do all sorts of neat things with graphical mode. 405 00:22:38,220 --> 00:22:40,320 They have extensive automation capabilities. 406 00:22:40,540 --> 00:22:41,820 If you've ever worked in a large enterprise, 407 00:22:41,860 --> 00:22:46,240 you'll see the network management people with the big displays of all of these routers 408 00:22:46,240 --> 00:22:49,920 and hubs and switches and servers and crap all over the place, 409 00:22:49,960 --> 00:22:53,000 and they can click on it and tell you exactly what's going on with pretty graphs 410 00:22:53,000 --> 00:22:54,500 that really impress management. 411 00:22:55,060 --> 00:22:56,380 That's an NMS system. 412 00:22:56,380 --> 00:23:02,340 Those things are designed to be extensible, automated, and to let you plug stuff into them. 413 00:23:02,500 --> 00:23:03,880 And what are we trying to do here? 414 00:23:04,040 --> 00:23:05,740 We're going to want to tell one of those things, 415 00:23:05,820 --> 00:23:11,280 hey, go check that server over there, read the hash of the following files, and store it. 416 00:23:11,760 --> 00:23:16,580 And do that every five minutes, or one minute, or ten minutes, 417 00:23:16,660 --> 00:23:18,780 or what timeframe works for you. 418 00:23:19,080 --> 00:23:21,100 And they can all be independent queries. 419 00:23:21,380 --> 00:23:26,360 The point is that you can then have literally a tracking record of the hashed stuff. 420 00:23:26,380 --> 00:23:27,160 You can structure those files. 421 00:23:27,380 --> 00:23:33,580 It's as though you're continuously running Tripwire or something similar on that system remotely all the time. 422 00:23:33,980 --> 00:23:37,920 And the nice part about that is most NMSs have these really neat automation capabilities 423 00:23:37,920 --> 00:23:43,140 that allow you to do alert structures and, oh, hey, something changed. 424 00:23:43,240 --> 00:23:45,820 Better page the tech on duty. 425 00:23:46,740 --> 00:23:47,400 Keeper time. 426 00:23:48,140 --> 00:23:49,620 Or you send out an email. 427 00:23:49,780 --> 00:23:50,220 Or do this. 428 00:23:50,340 --> 00:23:54,340 Or even better, one of the tricks I use with my own personal systems is I say, 429 00:23:54,420 --> 00:23:56,360 if that hash ever changes, 430 00:23:56,380 --> 00:23:57,820 you check it every five minutes, 431 00:23:57,900 --> 00:23:58,820 if that hash ever changes, 432 00:23:58,940 --> 00:24:04,780 you immediately do a diff using a different nib of that file and give me the difference. 433 00:24:05,700 --> 00:24:11,400 Because I have a nib that actually knows what the file should be as of the last hash read. 434 00:24:11,780 --> 00:24:13,740 And it'll do a diff for me and send me the diff. 435 00:24:14,320 --> 00:24:16,280 All over SMBv3. 436 00:24:16,420 --> 00:24:17,000 All security. 437 00:24:17,280 --> 00:24:18,680 Over IPX if I want to. 438 00:24:19,040 --> 00:24:21,240 The point is that with that kind of automation, 439 00:24:21,540 --> 00:24:23,000 you can set up all of these structures, 440 00:24:23,180 --> 00:24:24,700 and then you can import the nib, 441 00:24:24,700 --> 00:24:25,640 you can make it extensible, 442 00:24:25,640 --> 00:24:27,080 set up your escalation, 443 00:24:27,140 --> 00:24:27,780 set up your alarms. 444 00:24:27,940 --> 00:24:31,680 Basically, you can integrate a tripwire-type capability 445 00:24:31,680 --> 00:24:35,480 into the systems you already have managing the networks you have. 446 00:24:38,260 --> 00:24:39,880 Okay, so you don't have an NMS, 447 00:24:40,020 --> 00:24:41,360 because you don't have, what, 448 00:24:41,920 --> 00:24:44,800 35 grand or so to toss around for kicks. 449 00:24:45,000 --> 00:24:47,200 I mean, I probably wouldn't buy an NMS with that, 450 00:24:47,300 --> 00:24:50,760 which is why I usually end up consulting for companies that have that kind of money 451 00:24:50,760 --> 00:24:52,180 and don't mind wasting it that way. 452 00:24:53,720 --> 00:24:55,060 You can do all sorts of things. 453 00:24:55,060 --> 00:24:55,760 You can script it. 454 00:24:55,780 --> 00:24:56,700 You can use Scottie. 455 00:24:56,700 --> 00:24:58,880 You can use a bunch of other applications out there. 456 00:24:58,940 --> 00:24:59,900 My personal favorite, 457 00:25:00,160 --> 00:25:01,960 although I'll be the first to tell you, 458 00:25:02,020 --> 00:25:03,580 I'm not a very good coder. 459 00:25:03,660 --> 00:25:05,760 In fact, my favorite form of coding is 460 00:25:05,760 --> 00:25:07,220 find something that's kind of close, 461 00:25:07,300 --> 00:25:07,900 cut and paste, 462 00:25:08,040 --> 00:25:09,400 and then mangle to fit 463 00:25:09,400 --> 00:25:11,040 using a debugger massively. 464 00:25:12,060 --> 00:25:14,440 So, okay, you understand the way I go. 465 00:25:15,620 --> 00:25:18,900 What most of SMMP gives you is it has a full library API. 466 00:25:19,460 --> 00:25:21,420 It also has binaries that come with it 467 00:25:21,420 --> 00:25:23,300 that'll do all sorts of ridiculous stuff. 468 00:25:23,380 --> 00:25:24,360 Set, get, rock. 469 00:25:24,360 --> 00:25:25,560 The whole nine words. 470 00:25:26,100 --> 00:25:27,760 Here's a little simple shell script, 471 00:25:27,900 --> 00:25:30,260 and this is actually one I have installed here, 472 00:25:30,340 --> 00:25:31,560 and I'll show you how this all works. 473 00:25:32,260 --> 00:25:33,820 What we do is we first go ahead 474 00:25:33,820 --> 00:25:37,560 and we have a file there, cat file list. 475 00:25:37,920 --> 00:25:40,040 And in that file list, we have a whole bunch of paths, 476 00:25:40,200 --> 00:25:41,480 and I'll show you all of this running. 477 00:25:41,720 --> 00:25:44,980 We then do an SMMP set of the line 478 00:25:44,980 --> 00:25:46,600 that we're talking about right then. 479 00:25:46,740 --> 00:25:48,480 So it could be, like, say, etsy password. 480 00:25:49,040 --> 00:25:53,360 So I'm going to set etsy password into 13614192481. 481 00:25:54,360 --> 00:25:58,220 That's 1110, which is the path file locator. 482 00:25:58,440 --> 00:25:59,820 Then I'm going to echo that 483 00:26:00,260 --> 00:26:02,640 without a line feed to a output file, 484 00:26:02,840 --> 00:26:07,860 and I'm going to go get the 1120 location, 485 00:26:08,200 --> 00:26:10,920 which is actually the hash of that file. 486 00:26:11,720 --> 00:26:12,600 And then I'm done. 487 00:26:12,720 --> 00:26:13,960 I'm going to loop through this file 488 00:26:13,960 --> 00:26:17,320 and end up with a list of file names and their hashes. 489 00:26:18,100 --> 00:26:19,740 And it's going to take a real long time. 490 00:26:19,800 --> 00:26:22,200 It takes almost, like, 10 seconds or so to run. 491 00:26:23,300 --> 00:26:25,060 And this assumes, of course, 492 00:26:25,080 --> 00:26:27,440 that you have the appropriate entries in your file dot list, 493 00:26:27,520 --> 00:26:28,200 and we looked at that. 494 00:26:30,340 --> 00:26:31,140 Additional scripting. 495 00:26:31,480 --> 00:26:31,880 Perl. 496 00:26:32,180 --> 00:26:35,360 One of the nice things they did recently in the 502 series, 497 00:26:35,420 --> 00:26:40,500 they actually incorporated Perl into the NetSMP agent itself, 498 00:26:40,940 --> 00:26:42,100 which is kind of wild. 499 00:26:42,200 --> 00:26:43,780 Before, they always had a Perl interface 500 00:26:43,780 --> 00:26:45,560 that you could query the libraries with, 501 00:26:45,720 --> 00:26:48,100 which is what you would do if you were writing a script for this. 502 00:26:49,060 --> 00:26:52,180 What's nice is that now you can actually write Perl 503 00:26:52,200 --> 00:26:54,360 code in the configuration file 504 00:26:54,360 --> 00:26:56,600 or in additional included files 505 00:26:56,600 --> 00:26:58,600 for the agent itself to execute. 506 00:26:58,860 --> 00:27:00,940 So if you have a Perl script that already gets you data you like, 507 00:27:01,100 --> 00:27:02,760 have the agent execute it. 508 00:27:03,460 --> 00:27:05,440 C programs are obviously the fastest, 509 00:27:05,500 --> 00:27:06,780 so if you want to do a whole bunch of stuff 510 00:27:06,780 --> 00:27:07,940 and a lot of multiple hosts, 511 00:27:08,100 --> 00:27:10,140 the C program goes against the same library. 512 00:27:10,540 --> 00:27:12,140 They both use the library calls. 513 00:27:12,720 --> 00:27:14,320 And if you take a look at the source, 514 00:27:14,500 --> 00:27:15,320 which we'll do in a second, 515 00:27:15,480 --> 00:27:17,640 you'll see that extending the code is ridiculously simple. 516 00:27:18,500 --> 00:27:20,780 Most of this is fairly simple. 517 00:27:20,940 --> 00:27:21,820 I'm going to call the library, 518 00:27:21,820 --> 00:27:22,620 get the hash function, 519 00:27:22,940 --> 00:27:24,380 hand it a file name and say, 520 00:27:24,440 --> 00:27:25,420 go hash this, okay? 521 00:27:25,640 --> 00:27:27,100 And then hand me back the result 522 00:27:27,100 --> 00:27:27,840 and we're out of here. 523 00:27:28,940 --> 00:27:30,600 The code runs on the system, 524 00:27:30,720 --> 00:27:31,980 on the marriage system, the agent. 525 00:27:32,220 --> 00:27:34,700 So this is the actual machine you're playing with. 526 00:27:35,160 --> 00:27:37,780 It's basically a wonderful messaging protocol. 527 00:27:38,100 --> 00:27:40,300 What do you want to do with it? 528 00:27:40,460 --> 00:27:43,380 So we'll go through this part in a second 529 00:27:43,380 --> 00:27:46,160 because what we really want to do is 530 00:27:46,160 --> 00:27:47,040 we'll play. 531 00:27:48,900 --> 00:27:50,780 If I can figure out what happened on the mouse. 532 00:27:57,140 --> 00:27:59,260 Actually, oh, thank you. 533 00:28:00,440 --> 00:28:01,620 This is so much fun. 534 00:28:01,800 --> 00:28:04,740 You can tell I use X a whole lot, can't you? 535 00:28:06,160 --> 00:28:10,400 In fact, let's do this and see if it still displays. 536 00:28:10,700 --> 00:28:12,220 If it doesn't, I'll have lots of fun. 537 00:28:14,180 --> 00:28:16,100 Is there anything up there at all that's readable? 538 00:28:16,440 --> 00:28:17,460 Nope, okay. 539 00:28:17,540 --> 00:28:18,700 Well, we'll do it for next then. 540 00:28:21,940 --> 00:28:24,140 You know how it is with these highfalutin systems. 541 00:28:24,800 --> 00:28:26,520 Okay, now let's see. 542 00:28:27,160 --> 00:28:28,420 Open up one of these 543 00:28:29,520 --> 00:28:31,600 and I think this is the command. 544 00:28:32,000 --> 00:28:32,280 Yep. 545 00:28:37,020 --> 00:28:39,360 And you can tell I have real informative names 546 00:28:39,360 --> 00:28:40,160 for my computers. 547 00:28:42,960 --> 00:28:43,480 Okay. 548 00:28:46,940 --> 00:28:48,040 Is that displaying? 549 00:28:48,480 --> 00:28:48,700 Good. 550 00:28:49,700 --> 00:28:50,220 Now, 551 00:28:52,020 --> 00:28:53,780 if you take a look in here 552 00:28:53,780 --> 00:28:56,200 and ignore all of the FooBard 553 00:28:56,200 --> 00:28:58,020 and other things while I was playing with my PowerPoint 554 00:28:58,020 --> 00:28:59,040 trying to get it to work, 555 00:29:00,320 --> 00:29:02,820 you'll notice that there's a C file 556 00:29:02,820 --> 00:29:04,880 and the H file, the header file, 557 00:29:04,940 --> 00:29:06,540 which does a few defines for you. 558 00:29:07,120 --> 00:29:09,320 There's also a Perl file 559 00:29:09,880 --> 00:29:13,480 that does just a quick get using the API 560 00:29:13,480 --> 00:29:14,800 just to show you how things work. 561 00:29:14,960 --> 00:29:16,120 And then two script files. 562 00:29:16,340 --> 00:29:17,840 All of this stuff I will upload 563 00:29:18,360 --> 00:29:20,100 to wherever I put the final presentation. 564 00:29:20,660 --> 00:29:22,220 So you can go play with it. 565 00:29:22,440 --> 00:29:24,460 But let's take a look real quick first 566 00:29:28,420 --> 00:29:29,880 at this script file. 567 00:29:30,080 --> 00:29:31,480 This is the same one I just had 568 00:29:31,480 --> 00:29:34,640 in that particular example on the slide. 569 00:29:35,900 --> 00:29:39,120 If you want to see what exactly file list looks like, 570 00:29:41,540 --> 00:29:42,980 basically I'm giving it full pass. 571 00:29:43,200 --> 00:29:46,300 Now, this file would reside on the manager. 572 00:29:46,880 --> 00:29:49,560 It's not on the agent or the managed system. 573 00:29:49,560 --> 00:29:50,700 It is on the manager, 574 00:29:50,820 --> 00:29:53,380 and it's going to tell the agent what to go look for. 575 00:29:53,540 --> 00:29:56,320 So if someone were actually on the agent system, 576 00:29:56,580 --> 00:29:58,420 they would know what files you're looking at 577 00:29:58,420 --> 00:30:01,320 or asking for because they can't see that. 578 00:30:01,460 --> 00:30:04,040 In fact, there is a way to lock down the agent 579 00:30:04,040 --> 00:30:06,760 in such a way that the agent machine itself 580 00:30:06,760 --> 00:30:10,260 cannot talk to the agent demon that's running. 581 00:30:10,500 --> 00:30:12,620 In other words, you can't find out information 582 00:30:12,620 --> 00:30:14,000 about the machine you're on. 583 00:30:14,120 --> 00:30:15,280 This particular one, 584 00:30:15,400 --> 00:30:18,260 all queries from the local host to local host 585 00:30:18,260 --> 00:30:18,880 are fully allowed. 586 00:30:18,880 --> 00:30:20,900 So what we'll do is we'll just, 587 00:30:20,920 --> 00:30:24,520 real quick, just try it out 588 00:30:24,520 --> 00:30:26,000 and take a look at the output. 589 00:30:28,080 --> 00:30:30,600 What it's going to do is it's telling me 590 00:30:30,600 --> 00:30:33,280 which file it's on at any particular instance. 591 00:30:33,860 --> 00:30:34,220 Whoops. 592 00:30:34,720 --> 00:30:35,880 What the heck? 593 00:30:38,500 --> 00:30:39,840 Where did I lose this time? 594 00:30:40,440 --> 00:30:41,460 Is it still up there? 595 00:30:41,580 --> 00:30:42,100 Okay, good. 596 00:30:42,560 --> 00:30:43,860 I lost this one. 597 00:30:43,900 --> 00:30:45,200 I can't see what the heck I'm doing. 598 00:30:46,280 --> 00:30:47,020 Let's try that. 599 00:30:47,500 --> 00:30:47,820 There. 600 00:30:47,960 --> 00:30:48,800 Now we can both see. 601 00:30:48,880 --> 00:30:49,320 That's good. 602 00:30:51,400 --> 00:30:53,740 Oh, good idea. 603 00:30:53,900 --> 00:30:54,360 Thank you. 604 00:30:57,660 --> 00:30:59,580 Okay, that'll make it a heck of a lot easier 605 00:30:59,580 --> 00:31:00,960 because then I can type with both hands. 606 00:31:02,640 --> 00:31:03,820 If we take a look now, 607 00:31:03,880 --> 00:31:05,320 we'll just take a look at the output file. 608 00:31:06,160 --> 00:31:07,120 There's all our hashes. 609 00:31:08,220 --> 00:31:09,400 Pretty simple, pretty easy. 610 00:31:09,720 --> 00:31:11,520 Now, if you take a look at the top one, 611 00:31:11,600 --> 00:31:13,300 what we'll do is we'll just real quickly 612 00:31:14,140 --> 00:31:15,540 copy this one to... 613 00:31:18,140 --> 00:31:18,620 that. 614 00:31:19,080 --> 00:31:23,260 And then I put in this change.me file on purpose. 615 00:31:23,420 --> 00:31:24,280 Gee, I wonder why. 616 00:31:25,300 --> 00:31:27,700 What we'll do is we'll just do something 617 00:31:27,700 --> 00:31:29,860 really, really interesting to it. 618 00:31:30,460 --> 00:31:32,760 We'll add a period to the end of it. 619 00:31:33,740 --> 00:31:36,320 I'm really modifying this file heavily right now, 620 00:31:36,340 --> 00:31:36,920 as you can tell. 621 00:31:37,600 --> 00:31:40,160 And then we'll just go ahead and rerun that script. 622 00:31:41,440 --> 00:31:43,380 Basically, what it'll do is it'll go out 623 00:31:43,380 --> 00:31:44,940 and when I run this script, 624 00:31:45,060 --> 00:31:46,500 each one of these files is written 625 00:31:46,500 --> 00:31:48,900 into the MIB and then the hash is read. 626 00:31:49,500 --> 00:31:51,420 Now, one thing you do have to bear in mind 627 00:31:51,420 --> 00:31:53,940 is I've made it so easy that essentially 628 00:31:53,940 --> 00:31:55,640 if you took a look at the MIB right now, 629 00:31:55,800 --> 00:31:58,960 what it is set to right now is sbinfdesk 630 00:31:58,960 --> 00:32:00,920 because that's the last thing that was written to it. 631 00:32:01,060 --> 00:32:03,220 You can save it to write to a config file, 632 00:32:03,320 --> 00:32:04,300 read from a config file, 633 00:32:04,480 --> 00:32:05,860 do whatever you would like. 634 00:32:07,440 --> 00:32:09,100 If you take a look at output now, 635 00:32:09,640 --> 00:32:10,920 the hash has changed. 636 00:32:11,340 --> 00:32:12,840 Real simple, real easy. 637 00:32:13,620 --> 00:32:15,260 So, how do I really do this? 638 00:32:19,300 --> 00:32:20,880 Let's take a look at the C file 639 00:32:20,880 --> 00:32:22,040 because that's the important one. 640 00:32:22,160 --> 00:32:23,880 The H file just has the definitions 641 00:32:24,330 --> 00:32:26,920 for NetSMP's purposes to make it easier to compile. 642 00:32:27,860 --> 00:32:30,260 A whole bunch of includes, blah, blah, blah, 643 00:32:30,360 --> 00:32:31,680 all sorts of wonderful stuff. 644 00:32:32,060 --> 00:32:34,220 We define where we're actually putting 645 00:32:34,220 --> 00:32:35,200 all of our variables 646 00:32:36,180 --> 00:32:39,040 and then we go ahead and we actually initialize this. 647 00:32:39,100 --> 00:32:40,780 We basically tell it, hey, look, I've got a MIB. 648 00:32:40,880 --> 00:32:41,860 Here's where I am. 649 00:32:41,980 --> 00:32:42,820 Here's what I'm doing. 650 00:32:42,980 --> 00:32:44,640 Go read it in if you're interested. 651 00:32:45,360 --> 00:32:47,940 And now we get to the fun part. 652 00:32:48,160 --> 00:32:52,000 We get to the actual routine to generate the sum. 653 00:32:52,680 --> 00:32:53,940 And it's fairly simple. 654 00:32:54,020 --> 00:32:55,800 If you actually went and checked mhash, 655 00:32:55,840 --> 00:32:57,660 you'd find this example about C program 656 00:32:57,660 --> 00:32:59,520 and you'd be really surprised 657 00:32:59,520 --> 00:33:02,100 at how closely it resembles this function. 658 00:33:03,020 --> 00:33:04,660 But the reality is, basically, 659 00:33:04,660 --> 00:33:06,400 I'm taking the cat of this file, 660 00:33:06,480 --> 00:33:08,340 which I've set into my MIB now. 661 00:33:08,540 --> 00:33:10,080 I'm reading it back and saying, 662 00:33:10,140 --> 00:33:12,440 okay, this is the file I'm interested in. 663 00:33:12,580 --> 00:33:14,620 And then I'm going through and I'm hashing it. 664 00:33:14,640 --> 00:33:17,120 There's debug messages that are there. 665 00:33:17,200 --> 00:33:18,300 If you actually want to, 666 00:33:18,340 --> 00:33:22,000 you can launch the agent with a dpacdefconx 667 00:33:22,000 --> 00:33:24,300 and watch the looping function build 668 00:33:25,360 --> 00:33:26,780 iteratively the hash function. 669 00:33:27,140 --> 00:33:28,220 It does slow it down a bit, 670 00:33:28,280 --> 00:33:29,500 but if you're actually trying to figure out 671 00:33:29,500 --> 00:33:30,240 why it doesn't work, 672 00:33:30,440 --> 00:33:31,860 it's a real good way to do it. 673 00:33:32,960 --> 00:33:34,520 And essentially, we take that, 674 00:33:34,680 --> 00:33:35,820 we send it back, 675 00:33:36,020 --> 00:33:37,700 and we send it into the actual structure 676 00:33:38,560 --> 00:33:41,560 that mhsmp uses to read and write all of these things. 677 00:33:41,780 --> 00:33:43,560 So you have this unsigned care bar, 678 00:33:43,560 --> 00:33:45,000 our dpacdefconx variable. 679 00:33:45,280 --> 00:33:50,580 This is a standard nsmp set get variable structure. 680 00:33:51,540 --> 00:33:54,260 And essentially, all it does is it says, 681 00:33:54,360 --> 00:33:56,700 okay, first I'm going to check my headers, 682 00:33:56,760 --> 00:33:59,240 make sure that the packet coming in is tolerable. 683 00:33:59,320 --> 00:34:01,300 This is all in the nsmp docs. 684 00:34:02,080 --> 00:34:04,000 And then I'm going to actually go down 685 00:34:04,000 --> 00:34:04,900 and do the value assignments. 686 00:34:05,220 --> 00:34:08,260 So in the case where we get the pacfile name in, 687 00:34:08,440 --> 00:34:10,440 which is that 1110, 688 00:34:11,300 --> 00:34:13,260 first I have a write method that I define. 689 00:34:13,560 --> 00:34:14,460 Which basically says, 690 00:34:14,660 --> 00:34:15,920 oh, I got a value. 691 00:34:16,180 --> 00:34:16,880 Copy it. 692 00:34:17,660 --> 00:34:20,080 And then I do a var len on it 693 00:34:20,080 --> 00:34:21,400 because I must return a length 694 00:34:21,400 --> 00:34:22,740 as part of the specification. 695 00:34:23,480 --> 00:34:26,220 And then I return pacfile name, 696 00:34:26,280 --> 00:34:28,120 which is that hash function you saw earlier. 697 00:34:28,220 --> 00:34:29,200 I basically call that, 698 00:34:29,440 --> 00:34:30,260 do the hash, 699 00:34:30,400 --> 00:34:31,700 and return the whole structure. 700 00:34:33,920 --> 00:34:35,960 If we want to just get the hash, 701 00:34:36,200 --> 00:34:38,160 we can call pack hash directly. 702 00:34:39,440 --> 00:34:40,500 And then of course, 703 00:34:40,560 --> 00:34:41,900 if we have an error, 704 00:34:42,080 --> 00:34:43,280 we spit out an error, 705 00:34:43,280 --> 00:34:44,440 and away we go. 706 00:34:45,740 --> 00:34:49,900 Here's the actual part that does the writing. 707 00:34:49,960 --> 00:34:50,760 Takes the value, 708 00:34:50,860 --> 00:34:51,500 writes it in. 709 00:34:52,380 --> 00:34:53,180 Real complicated. 710 00:34:53,640 --> 00:34:57,120 If it comes in and it's not the type you expected, 711 00:34:57,480 --> 00:34:58,240 throw it out. 712 00:34:58,380 --> 00:34:59,360 If it's too big, 713 00:34:59,640 --> 00:35:00,560 throw it out. 714 00:35:01,320 --> 00:35:02,780 Otherwise, it's just right, 715 00:35:02,920 --> 00:35:04,320 and all we do is we say, 716 00:35:04,340 --> 00:35:04,820 okay, cool, 717 00:35:04,940 --> 00:35:06,300 we copy it into pacfile name, 718 00:35:06,420 --> 00:35:07,360 stuff it into memory, 719 00:35:07,500 --> 00:35:08,000 we're done. 720 00:35:08,700 --> 00:35:09,880 This is all in memory. 721 00:35:10,020 --> 00:35:11,480 If you actually want to write it out, 722 00:35:11,580 --> 00:35:13,160 you have to do more things with the mir. 723 00:35:15,300 --> 00:35:18,000 We'll take a quick look at the curl file 724 00:35:18,000 --> 00:35:20,880 just to show you that that in and of itself, 725 00:35:22,720 --> 00:35:24,220 essentially you just use snmp, 726 00:35:24,360 --> 00:35:26,020 which comes with net snmp. 727 00:35:26,180 --> 00:35:27,860 You compile it as part of the package, 728 00:35:27,940 --> 00:35:28,540 install it. 729 00:35:28,680 --> 00:35:31,420 It allows you to define a session. 730 00:35:31,500 --> 00:35:31,940 If you notice, 731 00:35:31,960 --> 00:35:34,220 I've defined this session to localhost, 732 00:35:34,280 --> 00:35:34,900 version three, 733 00:35:34,980 --> 00:35:35,260 off, 734 00:35:35,360 --> 00:35:35,580 print. 735 00:35:35,760 --> 00:35:37,360 Now I do have the passwords 736 00:35:37,360 --> 00:35:39,820 and the privileged passwords in here. 737 00:35:39,980 --> 00:35:42,640 That is one of the current few drawbacks 738 00:35:42,640 --> 00:35:44,940 to using v3 is that the manager 739 00:35:44,940 --> 00:35:46,600 must know the passwords to everything. 740 00:35:46,960 --> 00:35:48,160 Has to know the authentication 741 00:35:48,160 --> 00:35:49,500 and the encryption password, 742 00:35:49,740 --> 00:35:50,520 passphrases. 743 00:35:51,340 --> 00:35:53,620 There is talk about trying to do 744 00:35:53,620 --> 00:35:55,120 some kind of escrow structure 745 00:35:55,120 --> 00:35:57,820 or certificate structure to extend these. 746 00:35:58,060 --> 00:36:00,040 I'm sure it'll be done at some point in time. 747 00:36:00,260 --> 00:36:00,780 Realistically, 748 00:36:00,920 --> 00:36:03,020 if your manager has been hacked, 749 00:36:03,200 --> 00:36:03,820 you're toast, 750 00:36:04,240 --> 00:36:06,300 because that thing usually has set rights 751 00:36:06,300 --> 00:36:07,780 to some serious equipment. 752 00:36:09,480 --> 00:36:10,260 Of course, 753 00:36:10,280 --> 00:36:11,880 it's a very nice thing to attack, too, 754 00:36:11,880 --> 00:36:13,440 so you can figure out which one's the manager. 755 00:36:14,040 --> 00:36:15,560 A lot of times, 756 00:36:15,560 --> 00:36:17,780 especially if they're running something like OpenView 757 00:36:17,780 --> 00:36:19,120 or NetView 758 00:36:19,800 --> 00:36:20,700 or Tivoli 759 00:36:20,700 --> 00:36:22,420 or Unicenter, 760 00:36:22,620 --> 00:36:25,880 they're fairly easy to crack Unix boxes, 761 00:36:26,120 --> 00:36:28,220 because last time I looked, 762 00:36:28,220 --> 00:36:28,860 for example, 763 00:36:29,060 --> 00:36:31,380 you're running NetView on AIX, 764 00:36:31,560 --> 00:36:33,860 you had to have Telnet available 765 00:36:34,580 --> 00:36:35,920 for certain things. 766 00:36:36,580 --> 00:36:38,600 Last time I looked at Unicenter, 767 00:36:38,740 --> 00:36:39,920 for one function, 768 00:36:40,040 --> 00:36:41,780 they needed arsh opened up. 769 00:36:42,980 --> 00:36:43,700 Not fun. 770 00:36:44,260 --> 00:36:44,700 Hopefully, 771 00:36:44,840 --> 00:36:45,620 they'll get wiser 772 00:36:45,620 --> 00:36:47,200 and they'll start locking those suckers down, 773 00:36:47,340 --> 00:36:47,600 because, 774 00:36:47,740 --> 00:36:49,440 as I just showed you with this, 775 00:36:49,540 --> 00:36:50,580 if you're on the manager 776 00:36:50,580 --> 00:36:52,700 and you're basically on that network 777 00:36:52,700 --> 00:36:55,000 and you can do anything you want to it 778 00:36:55,000 --> 00:36:56,080 at any point in time. 779 00:36:57,100 --> 00:36:57,540 Anyway, 780 00:36:58,840 --> 00:36:59,720 questions, commentary? 781 00:37:03,040 --> 00:37:04,300 I think you have a problem. 782 00:37:04,820 --> 00:37:05,260 Huh? 783 00:37:05,480 --> 00:37:06,500 I think you have a problem. 784 00:37:06,880 --> 00:37:07,520 Problem with? 785 00:37:12,460 --> 00:37:14,680 Since every five minutes or so, 786 00:37:14,840 --> 00:37:17,240 this thing is going to return with a full, 787 00:37:17,400 --> 00:37:18,340 you know, 788 00:37:18,340 --> 00:37:19,660 sheet worth of hashes, 789 00:37:19,760 --> 00:37:21,660 how often does the key rotate? 790 00:37:22,200 --> 00:37:24,500 Or can I just take a whole bunch of these messages, 791 00:37:24,720 --> 00:37:26,220 push them into a little stack, 792 00:37:26,360 --> 00:37:27,740 and pop out your passwords there? 793 00:37:28,400 --> 00:37:28,920 Yeah, 794 00:37:29,060 --> 00:37:32,620 that actually is something that is built in. 795 00:37:32,700 --> 00:37:35,040 The reason that specification for V3 796 00:37:35,040 --> 00:37:36,940 originally built in the mechanisms 797 00:37:36,940 --> 00:37:40,000 for not only defining alternate encryptions 798 00:37:40,000 --> 00:37:41,340 and authentication mechanisms, 799 00:37:41,340 --> 00:37:44,080 they also built in methods of stating 800 00:37:44,080 --> 00:37:46,160 when one had changed an ability 801 00:37:46,160 --> 00:37:49,440 using a VACM or a USEM construction 802 00:37:49,440 --> 00:37:51,580 to change that on agents. 803 00:37:51,940 --> 00:37:54,800 So you can actually change it every so often 804 00:37:54,800 --> 00:37:55,900 if you want to. 805 00:37:56,600 --> 00:37:57,160 Realistically, 806 00:37:57,400 --> 00:37:59,060 you would depend on other methods 807 00:37:59,060 --> 00:38:01,900 to determine whether someone was doing 808 00:38:01,900 --> 00:38:03,260 that kind of a construct against you. 809 00:38:03,340 --> 00:38:06,400 Yes, it is open to gathering a whole bunch of them 810 00:38:06,400 --> 00:38:07,880 and beating on it like crazy. 811 00:38:08,140 --> 00:38:08,700 Yes. 812 00:38:09,080 --> 00:38:11,160 And that is one of the reasons 813 00:38:11,340 --> 00:38:12,200 that they put in the extensions 814 00:38:12,200 --> 00:38:13,460 and that there's a lot of work 815 00:38:13,460 --> 00:38:15,080 on trying to do the certificate structures 816 00:38:15,080 --> 00:38:17,260 and also the alternate structures. 817 00:38:17,440 --> 00:38:18,420 Because right now, today, 818 00:38:18,660 --> 00:38:20,660 that's a very valid attack against it. 819 00:38:20,840 --> 00:38:22,960 One of the things that they did put in 820 00:38:22,960 --> 00:38:23,920 from the get-go 821 00:38:23,920 --> 00:38:25,280 is the concept of an engine ID. 822 00:38:25,560 --> 00:38:27,840 So I can actually use additional functionality 823 00:38:28,420 --> 00:38:30,300 based on unique engine IDs 824 00:38:30,300 --> 00:38:31,820 for each of my agents and managers 825 00:38:32,320 --> 00:38:33,860 that would give me some protection 826 00:38:33,860 --> 00:38:35,000 against that kind of attack 827 00:38:35,000 --> 00:38:36,620 because it will use the engine ID 828 00:38:36,620 --> 00:38:40,280 to slightly change the way it does 829 00:38:40,280 --> 00:38:41,920 the encryption each time, 830 00:38:42,080 --> 00:38:43,300 as a salt, basically, 831 00:38:43,480 --> 00:38:44,680 and to rotate it through. 832 00:38:45,460 --> 00:38:47,020 To turn all that stuff on, 833 00:38:47,080 --> 00:38:49,180 you have to have some good CPU horsepower, though. 834 00:38:49,500 --> 00:38:51,480 So there are the drawbacks there. 835 00:38:52,260 --> 00:38:53,680 Additionally, the engine ID 836 00:38:53,680 --> 00:38:55,220 does prevent replay attacks 837 00:38:55,220 --> 00:38:58,640 as long as you do have the structure 838 00:38:58,640 --> 00:39:00,820 in full off-priv mode. 839 00:39:01,920 --> 00:39:03,340 A lot of that is covered 840 00:39:03,340 --> 00:39:05,160 in some of the late draft RFCs 841 00:39:05,160 --> 00:39:07,620 that are now starting to be specified for V3 842 00:39:08,200 --> 00:39:10,200 because those are similar 843 00:39:10,280 --> 00:39:10,640 to the ones that are in V3. 844 00:39:10,640 --> 00:39:12,540 no matter which message passing protocol 845 00:39:12,540 --> 00:39:13,400 you're looking at. 846 00:39:15,840 --> 00:39:17,000 Any other questions? 847 00:39:18,780 --> 00:39:19,940 I'll be wandering around, 848 00:39:20,040 --> 00:39:21,220 so feel free to ask me. 849 00:39:21,300 --> 00:39:22,000 Like I said, 850 00:39:22,060 --> 00:39:23,180 most of the source code's available, 851 00:39:24,080 --> 00:39:26,660 and probably more extensive stuff as well 852 00:39:26,660 --> 00:39:28,700 as I start playing with it a little more. 853 00:39:29,460 --> 00:39:31,240 Check out the NetSMMP project 854 00:39:31,240 --> 00:39:33,140 because they have a lot of interesting information 855 00:39:33,140 --> 00:39:35,880 and source that you can play with yourself today. 856 00:39:36,580 --> 00:39:38,040 Otherwise, have a good one. 857 00:39:40,280 --> 00:39:44,660 Subtitles by the Amara.org community