1 00:00:00,000 --> 00:00:04,900 Good afternoon, everyone. It is now the top of the hour, 1 p.m. 2 00:00:05,300 --> 00:00:10,700 Thank you so much for being here with us today at the Packet Hacking Village. 3 00:00:11,560 --> 00:00:16,680 Feel free to move in. I know there's people who really want to be here for this talk. 4 00:00:20,280 --> 00:00:25,740 And our speaker, this speaker that we have now, 5 00:00:25,740 --> 00:00:30,200 right now, we are just so honored and so thrilled. 6 00:00:31,080 --> 00:00:35,500 When we put out the schedule of our speakers here for the speaker workshop, 7 00:00:36,660 --> 00:00:38,560 lots of people were blown away. 8 00:00:39,240 --> 00:00:45,120 They were like, oh, my God, we got Paul Vixie, who I taught, and here we are. 9 00:00:45,880 --> 00:00:52,920 It is now my pleasure to introduce to you, oh, what can I say? 10 00:00:53,420 --> 00:00:55,180 He's the CEO of... 11 00:00:55,180 --> 00:00:56,580 Is it Fireside Technologies? 12 00:00:56,840 --> 00:00:57,740 Fireside Security. 13 00:00:58,940 --> 00:01:04,460 And certainly a luminary in this field, especially with networking and Internet. 14 00:01:04,880 --> 00:01:08,560 Without much ado, ladies and gentlemen, Paul Vixie. 15 00:01:21,780 --> 00:01:22,380 Hello? 16 00:01:22,540 --> 00:01:22,760 Ah. 17 00:01:23,020 --> 00:01:24,800 So, for the record, that was a... 18 00:01:24,800 --> 00:01:25,160 That was a... 19 00:01:25,160 --> 00:01:25,740 That was a do. 20 00:01:27,600 --> 00:01:30,540 And it doesn't really matter what else I've done. 21 00:01:30,700 --> 00:01:33,020 Thank you for coming to hear me. 22 00:01:33,420 --> 00:01:35,660 I heard that you were talking about capturing packets, 23 00:01:35,880 --> 00:01:39,540 and since that's been a big part of my life in the last, ooh, six, seven years, 24 00:01:39,760 --> 00:01:42,240 I thought I would tell you how we've been doing it 25 00:01:42,240 --> 00:01:45,520 and how we're going to do it differently as far as DNS collection is concerned. 26 00:01:47,260 --> 00:01:47,820 All right. 27 00:01:47,860 --> 00:01:49,940 I've just been asked to project more, so... 28 00:01:52,360 --> 00:01:54,560 So we have an hour-long slot. 29 00:01:54,560 --> 00:01:57,240 That's more time than this material needs. 30 00:01:57,380 --> 00:01:58,260 I'm hoping for questions. 31 00:01:58,940 --> 00:02:01,360 I'm not sure how we're going to get questions over the music. 32 00:02:01,540 --> 00:02:03,500 Maybe there's a microphone we can pass. 33 00:02:04,000 --> 00:02:10,260 So, you measure DNS because everything that happens on the Internet, 34 00:02:10,440 --> 00:02:14,680 other than, of course, the peer-to-peer type applications, 35 00:02:14,860 --> 00:02:17,520 everything that you do on the Internet starts with a DNS transaction. 36 00:02:19,180 --> 00:02:22,000 That means that even bad people need good DNS, 37 00:02:22,260 --> 00:02:24,320 and that whatever crimes... 38 00:02:24,560 --> 00:02:29,320 or abuse are committed probably involve somebody registering something in the DNS 39 00:02:29,320 --> 00:02:32,220 that you might wish you had copies of. 40 00:02:33,520 --> 00:02:35,760 So this slide is a little out of date, 41 00:02:35,920 --> 00:02:41,100 but you can see here that in one of the real-time channels of the Security Information Exchange, 42 00:02:41,420 --> 00:02:45,460 we collected about 1.6 terabytes of data that day. 43 00:02:46,880 --> 00:02:49,240 That's not too far off of what we have now, 44 00:02:49,280 --> 00:02:51,180 although we have a lot more sources. 45 00:02:52,400 --> 00:02:54,120 We have a global... 46 00:02:54,560 --> 00:02:57,000 network of passive DNS sensors, 47 00:02:57,720 --> 00:03:00,940 and I'll explain what a passive DNS sensor is in a moment, 48 00:03:01,060 --> 00:03:04,040 but the point is we have 500 of them, or so, 49 00:03:04,220 --> 00:03:09,980 and they send an aggregate of 200,000 cash-missed transactions per second 50 00:03:10,520 --> 00:03:12,020 into our collection infrastructure. 51 00:03:12,940 --> 00:03:16,980 Now, obviously, I work for a commercial company, and we do sell this stuff, but 52 00:03:17,520 --> 00:03:21,420 one of the reasons I like coming here is because we make it available free of charge 53 00:03:21,420 --> 00:03:24,540 if you yourself are not paid for the work that you're doing with it. 54 00:03:24,540 --> 00:03:30,500 So if you have some research idea that you want to explore using our tools, 55 00:03:30,720 --> 00:03:31,940 contact me. 56 00:03:31,960 --> 00:03:34,760 Tell me what it's about, and we'll set you up. 57 00:03:36,580 --> 00:03:41,760 So 200,000 cash-misses per second translates to around, you know, 58 00:03:41,860 --> 00:03:46,480 maybe 100 million or 200 or 300 million cash hits per second, 59 00:03:46,580 --> 00:03:48,500 because in a DNS recursive name server, 60 00:03:49,280 --> 00:03:52,640 you are traditionally answering from cache most of the time, 61 00:03:52,660 --> 00:03:53,620 because most of the time, 62 00:03:54,540 --> 00:04:00,640 your stub resolvers will be asking a question that has just been asked not long ago, 63 00:04:00,780 --> 00:04:02,280 and the result will still be in the cache. 64 00:04:02,620 --> 00:04:08,180 For example, www.google.com, it tends to be hot in everybody's cache all the time, 65 00:04:08,300 --> 00:04:13,760 and maybe once every time-to-live period, it will expire and then quickly get refreshed back to cache. 66 00:04:14,040 --> 00:04:19,880 So what that recursive name server is doing is acting as kind of a de-duplicator. 67 00:04:20,300 --> 00:04:23,740 It's giving you a small upstream leak 68 00:04:23,740 --> 00:04:29,080 of cache-missed transactions that will tell maybe an outside observer like our sensor 69 00:04:29,080 --> 00:04:34,020 that somebody inside your network is interested in whatever it was that wasn't in cache. 70 00:04:34,420 --> 00:04:40,340 But there's a huge number of transactions below the recursive facing the actual users, 71 00:04:40,660 --> 00:04:46,380 and a relatively minor number of cache-missed transactions above that recursive. 72 00:04:48,100 --> 00:04:52,760 Since we began this project, Edward Snowden has made some disclosures. 73 00:04:52,760 --> 00:04:53,640 Perhaps you've heard those. 74 00:04:53,740 --> 00:05:00,640 And I want to say in fairness to him and his observations, we don't do surveillance. 75 00:05:00,940 --> 00:05:05,860 I'd never collect an end-user IP address, and although we do sell our stuff to law enforcement 76 00:05:05,860 --> 00:05:10,640 or even give it away in some cases, they can't really start an investigation using our tools 77 00:05:10,640 --> 00:05:12,240 because it's worthless for that. 78 00:05:12,400 --> 00:05:14,720 All you can do is enhance an existing investigation. 79 00:05:15,120 --> 00:05:19,200 And that reflects my personal belief that when people are using the Internet, 80 00:05:19,320 --> 00:05:21,080 they ought to have a certain amount of privacy. 81 00:05:22,320 --> 00:05:23,720 And so we're working on that. 82 00:05:23,740 --> 00:05:28,460 We're doing the best we can to stay on the side of the light there while still collecting 83 00:05:28,460 --> 00:05:38,720 enough information to find and investigate and hopefully kick in some doors or direct 84 00:05:38,720 --> 00:05:39,300 some lawsuits. 85 00:05:40,200 --> 00:05:41,620 And that's why we do this. 86 00:05:41,700 --> 00:05:43,460 That's why we have this big collection network. 87 00:05:45,880 --> 00:05:50,740 If you're looking for a mail server, you look for a certain record type in DNS called MX. 88 00:05:51,060 --> 00:05:53,720 If you're looking for a web server, you tend to look for an ARAM. 89 00:05:53,720 --> 00:05:57,900 If you're looking for an LTA record or a Quad A record, but the point is that every flow that you're going to see in NetFlow 90 00:05:57,900 --> 00:06:04,280 or every flow that you're actually going to witness in a packet trace will have begun with a DNS transaction. 91 00:06:05,620 --> 00:06:11,080 And so a lot of us are also collecting NetFlow on our networks, and we've got tools, 92 00:06:11,300 --> 00:06:17,040 some open source, some commercial tools that we use to process NetFlow and tell us what our users did 93 00:06:17,040 --> 00:06:21,380 or perhaps what criminals did to our users, but that only tells you what happened. 94 00:06:21,500 --> 00:06:23,640 And if you want to know how it happened or why it happened, 95 00:06:23,720 --> 00:06:27,820 you need to be collecting DNS. All of our tools for collecting 96 00:06:27,820 --> 00:06:31,040 DNS are open source. So to the extent that you want to start 97 00:06:31,040 --> 00:06:34,540 your own local collection empire, please take a look at 98 00:06:34,540 --> 00:06:38,360 our tools. We use the Apache open source license. We think 99 00:06:38,360 --> 00:06:42,400 our stuff is pretty good. I'll come back to that later. So 100 00:06:44,000 --> 00:06:47,180 historically, and some of you know that I worked on bind for a 101 00:06:47,180 --> 00:06:49,280 number of years and then I hired other people to work on 102 00:06:49,280 --> 00:06:52,100 bind for a number of years. So a lot of my experience is 103 00:06:52,100 --> 00:06:57,200 relative to bind. And in bind, if you want to collect a record 104 00:06:57,200 --> 00:07:01,260 of all the questions that you answered, that is a syslog 105 00:07:01,260 --> 00:07:04,940 activity. In other words, you turn on query logging and it 106 00:07:04,940 --> 00:07:09,260 will either send a message over to the syslog demon every time 107 00:07:09,260 --> 00:07:13,860 it answers a query or it might write a line of text into a new 108 00:07:13,860 --> 00:07:18,620 line delimited ASCII text file. Either one of those is way too 109 00:07:18,620 --> 00:07:22,080 slow. The maximum rate of time it takes to send a query is 110 00:07:22,080 --> 00:07:22,980 20,000 events per second. So the maximum rate at which you can 111 00:07:22,980 --> 00:07:26,600 do that kind of thing, like talk to syslog or talk to a text file 112 00:07:26,600 --> 00:07:29,900 tends to be on the order of 20,000 events per second. And 113 00:07:29,900 --> 00:07:33,600 that's in a fairly modern system with a reasonable kernel and 114 00:07:33,600 --> 00:07:37,360 enough disk cache and so forth. Whereas a lot of name servers 115 00:07:37,360 --> 00:07:41,720 are answering 10 or even 30 times that number of queries. So 116 00:07:41,720 --> 00:07:45,540 if you turn on query logging, then you either stop answering 117 00:07:45,540 --> 00:07:48,380 queries and you start dropping a lot of questions on the floor 118 00:07:48,380 --> 00:07:51,780 because your name server process was busy logging to disk the 119 00:07:52,080 --> 00:07:56,300 last transaction or you answer all the queries but you don't 120 00:07:56,300 --> 00:07:59,260 log them all. One way or another, you're not going to be 121 00:07:59,260 --> 00:08:03,400 able to do both at the top speed. And the bottleneck in 122 00:08:03,400 --> 00:08:07,660 speed is going to be your logging function. So in other 123 00:08:07,660 --> 00:08:10,740 words, the thing that bind does is a toy by today's standards 124 00:08:10,740 --> 00:08:14,240 and we don't use it. And I say that with affection. I still use 125 00:08:14,240 --> 00:08:17,340 bind myself. It's fine software and so forth. I just don't work 126 00:08:17,340 --> 00:08:22,000 on it anymore. So we're doing something else. Now, success in 127 00:08:22,000 --> 00:08:26,060 collection of DNS transactions therefore occurs asynchronously 128 00:08:27,220 --> 00:08:32,600 using the lib PCAP and the BPF interface or modern equivalents 129 00:08:32,600 --> 00:08:36,200 of those. Basically, you do what TCP dump does. You get 130 00:08:36,200 --> 00:08:40,480 yourself an ancillary copy of the packets that the kernel is 131 00:08:40,480 --> 00:08:43,060 delivering to your application or receiving from your 132 00:08:43,060 --> 00:08:47,000 application. And that process is asynchronous. If it can't keep 133 00:08:47,000 --> 00:08:51,980 up, you will lose logging data. I view that as the right thing. 134 00:08:52,000 --> 00:08:55,560 If you can't keep up, then you would like to answer all the 135 00:08:55,560 --> 00:09:00,160 questions and not seem slow or lossy as a name server and maybe 136 00:09:00,160 --> 00:09:02,660 your telemetry is where the suffering should occur if a 137 00:09:02,660 --> 00:09:07,100 tradeoff has to be made. So I personally developed a package 138 00:09:07,100 --> 00:09:14,240 called NCAP, analogous to PCAP back in 2006, which was meant, 139 00:09:14,520 --> 00:09:18,920 and I blew it on this. I screwed up big time. So the software is 140 00:09:18,920 --> 00:09:21,820 junk, but it looked pretty good at the time. I was trying to 141 00:09:22,000 --> 00:09:24,860 replace PCAP. I was trying to modernize PCAP, give it decent 142 00:09:24,860 --> 00:09:28,580 time stamps, give it maybe a higher level API and, you know, 143 00:09:28,620 --> 00:09:31,700 make it possible for people to do this type of work without 144 00:09:31,700 --> 00:09:36,760 having to get quite so far into the details as lib PCAP does. But 145 00:09:36,760 --> 00:09:40,760 I missed the boat. I ended up with something that was far too 146 00:09:40,760 --> 00:09:45,120 specific for the application I had and not really generalizable 147 00:09:45,120 --> 00:09:49,260 into other applications that other people might have. So what 148 00:09:49,260 --> 00:09:51,800 I mean to say is it was great for collecting DNS and pretty 149 00:09:51,800 --> 00:09:55,420 much useless for collecting anything else. So we blew that 150 00:09:55,420 --> 00:10:00,200 away in 2010. Hired younger people who know more about how 151 00:10:00,200 --> 00:10:03,340 the world works today and got them to write something called 152 00:10:03,340 --> 00:10:08,240 NMessage. And NMessage is not designed to replace PCAP. It is 153 00:10:08,240 --> 00:10:12,700 actually a purpose-built sort of container language where it's 154 00:10:12,700 --> 00:10:16,260 built on top of Google protocol buffers, which is a very fast 155 00:10:16,260 --> 00:10:21,240 way to serialize and deserialize data. So it's all binary. It's 156 00:10:21,240 --> 00:10:21,780 all really, really complex. And it's a very, really good 157 00:10:21,800 --> 00:10:24,120 tool. It's really fast and it's extensible. If you want to add 158 00:10:24,120 --> 00:10:26,740 some fields later, you can without violating the 159 00:10:26,740 --> 00:10:29,480 assumptions of older applications linked against older 160 00:10:29,480 --> 00:10:32,340 libraries and so forth. So we're very proud of NMessage. 161 00:10:32,500 --> 00:10:36,320 And that's what we've been using for about the last five years to 162 00:10:36,320 --> 00:10:40,420 collect this type of data. I mentioned earlier that there is 163 00:10:40,420 --> 00:10:43,660 a deduplication activity that happens in the DNS protocol 164 00:10:43,660 --> 00:10:47,840 stack. You with your smart phones and tablets and laptops 165 00:10:47,840 --> 00:10:51,560 and servers and virtual servers and so forth occupy the 166 00:10:51,560 --> 00:10:53,860 position normally of a stub resolver. You're asking 167 00:10:53,860 --> 00:10:57,940 questions and you don't really care where the answer might have 168 00:10:57,940 --> 00:11:00,640 to get fetched from. You're just asking the local server, the 169 00:11:00,640 --> 00:11:05,000 recursive server, please tell me what records go with this name 170 00:11:05,000 --> 00:11:09,720 and this type. Like www.google.com for type A would be 171 00:11:09,720 --> 00:11:12,560 an example of a question and a set of IP addresses would be an 172 00:11:12,560 --> 00:11:16,760 example of an answer. As you can see in the picture, there is a 173 00:11:16,760 --> 00:11:20,820 cache built into the recursive server. And that cache is 174 00:11:20,820 --> 00:11:25,420 of a configurable size. You could, if you want, make it 100 175 00:11:25,420 --> 00:11:31,060 megabytes or a gigabyte of heap space. Most name servers don't 176 00:11:31,060 --> 00:11:34,180 back up the cache when you restart them. So if you kill a 177 00:11:34,180 --> 00:11:37,000 name server, you're losing whatever was in the cache. And 178 00:11:37,000 --> 00:11:39,020 if you start it up again, you're going to start with an empty 179 00:11:39,020 --> 00:11:43,020 cache. And if you're a gigantic network, if you operate over a 180 00:11:43,020 --> 00:11:46,240 gigantic network, then that restart penalty is huge and you 181 00:11:46,240 --> 00:11:49,740 start to sort of schedule your reboots because you can't 182 00:11:50,820 --> 00:11:55,720 complete loss of one of these caches. And as I said earlier, we 183 00:11:55,720 --> 00:11:59,340 place our sensor above the recursive. In other words, when 184 00:11:59,340 --> 00:12:01,880 it doesn't find what it's looking for in the cache and it 185 00:12:01,880 --> 00:12:04,860 has to go fetch it from some authority server like VeriSign 186 00:12:04,860 --> 00:12:09,000 runs the servers for .com. I myself run one of the servers 187 00:12:09,000 --> 00:12:13,060 for the root zone which is above .com. You're probably running 188 00:12:13,060 --> 00:12:16,220 name servers or perhaps renting time on other people's name 189 00:12:16,220 --> 00:12:19,700 servers for your own vanity domain which likely ends in .com. 190 00:12:20,820 --> 00:12:23,940 But the point is that the authority servers is where actual 191 00:12:23,940 --> 00:12:27,480 content enters the DNS from outside of the DNS. Usually from 192 00:12:27,480 --> 00:12:32,540 a flat text file or a database or an application. And then gets 193 00:12:32,540 --> 00:12:36,080 into the DNS because recursive servers are told to send their 194 00:12:36,080 --> 00:12:38,780 questions to those authority servers. And it's that 195 00:12:38,780 --> 00:12:42,520 transaction that we look at. So the only IP addresses we have 196 00:12:42,520 --> 00:12:45,180 are the IP address of a recursive server that asked the 197 00:12:45,180 --> 00:12:47,720 question and the IP address of an authority server that 198 00:12:47,720 --> 00:12:50,800 answered it. And so, again, for the purpose of service, you're 199 00:12:50,820 --> 00:12:52,320 going to have to do a lot of surveillance. This is really low 200 00:12:52,320 --> 00:12:56,180 grade information. All you would know, let's say that you were 201 00:12:56,180 --> 00:12:59,900 tracking one of the four horsemen of the info apocalypse, 202 00:13:00,220 --> 00:13:02,720 which would be child pornography, and you knew that 203 00:13:02,720 --> 00:13:06,080 somebody had, you know, every look up for a certain domain 204 00:13:06,080 --> 00:13:10,100 name is because somebody somewhere is hurting a child. You 205 00:13:10,100 --> 00:13:13,360 might want to look at this data stream and you might say, hey, 206 00:13:13,400 --> 00:13:16,020 look, we got a look up from a recursive name server for a 207 00:13:16,020 --> 00:13:19,300 domain name that is just really, it's hurting children. We got to 208 00:13:19,300 --> 00:13:20,800 go after that. All you're going to do is look at the data 209 00:13:20,820 --> 00:13:22,620 stream and you're going to learn from us is that somebody in a 210 00:13:22,620 --> 00:13:24,960 certain city looked it up. You're never going to learn where 211 00:13:24,960 --> 00:13:27,700 they lived or what their IP address was or anything else. 212 00:13:27,860 --> 00:13:30,560 That doesn't mean that I'm in favor of hurting children. That 213 00:13:30,560 --> 00:13:33,320 means I'm in favor of protecting them through some method other 214 00:13:33,320 --> 00:13:37,840 than general surveillance. So I just want to emphasize, we are 215 00:13:37,840 --> 00:13:41,780 not the surveillers that you're worried about. So our sensors 216 00:13:41,780 --> 00:13:44,320 send the data to the Farsight security information exchange, 217 00:13:45,560 --> 00:13:49,580 which ultimately at its heart is just an Ethernet switch. People 218 00:13:49,580 --> 00:13:50,800 who want our data, we're going to send it to the Farsight security 219 00:13:50,800 --> 00:13:53,520 data, pretty much buy a port on the switch and plug their server 220 00:13:53,520 --> 00:13:57,420 into it and we start blasting traffic at them. We're using VLANs 221 00:13:57,420 --> 00:14:01,020 as though they were channels. And that just turned out to be the 222 00:14:01,020 --> 00:14:04,540 easiest way to get all that data replicated to all those 223 00:14:04,540 --> 00:14:07,300 different subscribers. And we have, as I mentioned, both 224 00:14:07,300 --> 00:14:11,500 academic and commercial and just hobby people looking at this. 225 00:14:11,640 --> 00:14:14,420 And if you're not paid for the work you do that requires this 226 00:14:14,420 --> 00:14:20,740 data, talk to me. I will put it in your hands. So we quickly 227 00:14:20,800 --> 00:14:23,860 create a thing called the Passive DNS Database, Farsight 228 00:14:23,860 --> 00:14:27,140 DNSDB, which is not the subject of this talk. I'm happy to talk 229 00:14:27,140 --> 00:14:30,340 about it afterward or during questions. But what I really 230 00:14:30,340 --> 00:14:34,180 want to focus on today is how we collect the data, what's wrong 231 00:14:34,180 --> 00:14:36,940 with the way we collect the data, and what we've been doing 232 00:14:36,940 --> 00:14:39,400 about it and what we're sort of in the process of releasing 233 00:14:39,400 --> 00:14:46,440 right now. So the biggest problem with a packet-based 234 00:14:46,440 --> 00:14:49,040 approach, and I realize we're here to capture the packet. 235 00:14:49,180 --> 00:14:50,780 That's the, that's the, the, the, the, the, the, the, the, the, 236 00:14:50,780 --> 00:14:54,900 the theme of this, this year. But if you're capturing packets, 237 00:14:55,180 --> 00:14:58,080 you're literally only seeing what's on the wire. And there 238 00:14:58,080 --> 00:15:00,480 are plenty of things that happen inside of a name server that 239 00:15:00,480 --> 00:15:04,820 don't make themselves known on the wire. You can impute that a 240 00:15:04,820 --> 00:15:08,920 time to live has expired out of cache because if you see, okay, 241 00:15:08,980 --> 00:15:11,560 I know what the time to live was and I know when it entered the 242 00:15:11,560 --> 00:15:15,340 cache and I saw another query for it right after the time to 243 00:15:15,340 --> 00:15:18,420 live expired, then you can say, hmm, okay, time to live expired, 244 00:15:18,640 --> 00:15:20,760 therefore it got purged from cache. And then you can say, 245 00:15:20,780 --> 00:15:26,060 hmm, a new fetch occurred. If you see that refresh event soon, 246 00:15:26,240 --> 00:15:30,040 sooner than the time to live expiration, then you can guess 247 00:15:30,040 --> 00:15:32,960 maybe the cache was full and some kind of at least recently 248 00:15:32,960 --> 00:15:37,540 used replacement algorithm got run so that, you know, it could 249 00:15:37,540 --> 00:15:40,440 have lived another several hours or several days in cache but it 250 00:15:40,440 --> 00:15:43,640 got pushed out by something because it wasn't popular enough. 251 00:15:43,780 --> 00:15:47,660 So you can impute those events by things you see on the wire. 252 00:15:47,780 --> 00:15:49,800 But it's much better, in my opinion, to just have it 253 00:15:49,800 --> 00:15:50,680 reported to you. 254 00:15:50,780 --> 00:15:53,860 If you buy a name server which has proper instrumentation, 255 00:15:53,960 --> 00:15:56,700 it will just tell you, this is what I did, this is why I did 256 00:15:56,700 --> 00:16:04,020 it. So the other problem with our current approach is that 257 00:16:04,020 --> 00:16:10,760 we're blind to TCP. So TCP is not a single request and a 258 00:16:11,300 --> 00:16:14,600 multi-packet response with UDP fragmentation, the way 259 00:16:15,200 --> 00:16:20,760 traditional DNS works. If you speak DNS over TCP port 53, you 260 00:16:20,780 --> 00:16:22,920 are sending the SYN, you're getting the SYN hack, you're 261 00:16:22,920 --> 00:16:25,660 sending the hack, then you're sending the query. This is a lot 262 00:16:25,660 --> 00:16:30,200 more state for us in trying to reconstruct that query stream if 263 00:16:30,200 --> 00:16:33,480 TCP is used. And we are lazy and we haven't gotten around to 264 00:16:33,480 --> 00:16:36,020 it yet. So, again, we're hoping that we don't have to implement 265 00:16:36,020 --> 00:16:38,780 that part because we'll be able to instrument the server 266 00:16:38,780 --> 00:16:42,180 directly and that we will then be able to get all of these 267 00:16:42,180 --> 00:16:45,960 transactions regardless of what transport protocol, TCP or UDP, 268 00:16:46,120 --> 00:16:50,760 was used. So, again, that's just a Lurie Walton, Lurie 269 00:16:50,780 --> 00:16:53,540 Wal said when he was talking about Pearl back in the early 270 00:16:53,540 --> 00:16:57,060 days that laziness was the great virtue of programmers and so 271 00:16:57,060 --> 00:17:02,260 we're trying to be that. So Van Jacobsen, when he was first 272 00:17:02,260 --> 00:17:05,560 talking about random early detection of congestion events, 273 00:17:06,100 --> 00:17:09,880 came up with this picture. And I've never seen it done better. 274 00:17:10,520 --> 00:17:14,840 What you're seeing here is a very fat pipe on the left and a 275 00:17:14,840 --> 00:17:18,200 very fat pipe on the right and a very skinny pipe in the middle. 276 00:17:18,440 --> 00:17:20,760 And although the pipe is a little bit thicker than the 277 00:17:20,780 --> 00:17:23,320 pipe in the middle is getting faster, right, a lot of us don't 278 00:17:23,320 --> 00:17:26,680 have 100 kilobit DSL lines at home. We've got, you know, 279 00:17:26,740 --> 00:17:32,380 multiple tens of megabits DSL or cable motor or whatever we have. 280 00:17:32,600 --> 00:17:36,260 It's still slower than our LANs, which tend to be gigabit. So 281 00:17:36,260 --> 00:17:39,360 this picture, although all of the dimensions are bigger, the 282 00:17:39,360 --> 00:17:42,720 relative sizes of those dimensions are about the same as 283 00:17:42,720 --> 00:17:45,280 they always were. You're always going to be able to generate 284 00:17:45,280 --> 00:17:49,920 more traffic on your LAN than your wide area router is going to 285 00:17:49,920 --> 00:17:50,760 be able to put on your LAN. So you're going to be able to get 286 00:17:50,780 --> 00:17:54,080 more traffic on its link. That's the nature of the Internet that 287 00:17:54,080 --> 00:17:56,720 will never change. And so we always have to deal with that 288 00:17:56,720 --> 00:17:59,440 when we're talking about, in Van's case, he was talking about 289 00:17:59,440 --> 00:18:03,380 TCP and how to slow down so that you could kind of only send the 290 00:18:03,380 --> 00:18:06,740 packets that we're likely to get through. But in our case, we have 291 00:18:06,740 --> 00:18:09,800 the problem of generating a lot of transactions. Again, if 292 00:18:09,800 --> 00:18:14,040 you're answering 200,000 queries a second or generating maybe 293 00:18:14,040 --> 00:18:17,000 thousands, many tens of thousands of cache miss 294 00:18:17,000 --> 00:18:20,760 transactions above the recursive per second, you might not have a 295 00:18:20,760 --> 00:18:25,180 enough upstream capacity to deliver all of that to your 296 00:18:25,180 --> 00:18:28,560 telemetry hub that is then going to store it and analyze it and do 297 00:18:28,560 --> 00:18:32,040 all that sort of thing. Which means the loss will occur. And 298 00:18:32,040 --> 00:18:35,560 whenever loss is going to occur, then we as designers have to make 299 00:18:35,560 --> 00:18:39,360 an intelligent, informed, constructive choice about where 300 00:18:39,360 --> 00:18:42,820 it will occur. Where in the topology will it occur and what 301 00:18:42,820 --> 00:18:47,260 will be the implications of that placement. So in this picture, 302 00:18:47,300 --> 00:18:50,220 what you're seeing is that way too many packets have been 303 00:18:50,220 --> 00:18:50,740 committed, and they're not going to be able to get through. So in 304 00:18:50,760 --> 00:18:51,920 the bottom, you have two lines, the left and the right. And they're 305 00:18:51,920 --> 00:18:54,320 trying to pass through on the right, and a lot of them are 306 00:18:54,320 --> 00:18:57,620 dropped right there where I've written the words loss region. 307 00:18:57,880 --> 00:19:04,360 And what you see on the far side is what survived. And this is the 308 00:19:04,360 --> 00:19:10,720 geometry of your data in flight. So in general, if you're going to 309 00:19:10,720 --> 00:19:13,320 be losing something, if you're going to lose data, you want to 310 00:19:13,320 --> 00:19:16,440 lose it as early as possible so that you have not wasted a lot 311 00:19:16,440 --> 00:19:20,120 of capacity carrying something halfway through the network that 312 00:19:20,120 --> 00:19:20,740 is not going to be able to get through. So all of these things 313 00:19:20,760 --> 00:19:25,580 make it to the far side. In other words, it's your job to efficiently utilize the network 314 00:19:25,580 --> 00:19:31,060 resources that are close to you in order to then sort of preserve them for other people who might 315 00:19:31,060 --> 00:19:36,640 be going to different destinations where there's less congestion. And one of the great, in my 316 00:19:36,640 --> 00:19:43,540 opinion, wonderful differences between the Internet and all of the sort of telephone company 317 00:19:43,540 --> 00:19:50,080 protocols that preceded it is that we demand that every endpoint cope with this problem. We don't 318 00:19:50,080 --> 00:19:54,320 simply commit our data to the network and let virtual circuits sort it out for us. We have a 319 00:19:54,320 --> 00:19:59,220 smart edge and a stupid core. That's why the Internet keeps doubling in speed every unit time. 320 00:19:59,700 --> 00:20:03,600 The telephone company was not going to be able to do that with their virtual circuits. But it does 321 00:20:03,600 --> 00:20:08,840 mean that, again, we as endpoints have to be cognizant of this. And, you know, granted, a lot 322 00:20:08,840 --> 00:20:13,240 of us don't. A lot of us just write whatever web application we have knowing that there's a 323 00:20:13,240 --> 00:20:19,180 framework around us that will take care of syslog files and all the rest. And since we're mostly 324 00:20:19,180 --> 00:20:20,060 answering the question, we don't have to do that. We don't have to do that. We don't have to do 325 00:20:20,080 --> 00:20:26,220 that. We don't have to worry about over committing the network because if we can't deliver our 326 00:20:26,220 --> 00:20:32,480 responses, then the questions will automatically slow down. So, you know, we do get some beautiful 327 00:20:32,480 --> 00:20:38,200 simplicity in our thinking about this because we don't have to think about the congestion in 328 00:20:38,200 --> 00:20:44,360 every endpoint. But the kernel people do and the device driver people do. And I want to shout out 329 00:20:44,360 --> 00:20:49,960 to Jim Geddes and Dave Tott, by the way. If you don't know about buffer bloat, then make a note 330 00:20:50,080 --> 00:20:56,220 to Google that later. Buffer bloat. There is way too much buffering in the Internet right now and 331 00:20:56,220 --> 00:21:00,980 it is hurting us. It is killing performance. Even on the wireless LAN that we're all using right 332 00:21:00,980 --> 00:21:05,880 here, right now, buffer bloat is killing you. And it would be good if all of us could rise up 333 00:21:06,240 --> 00:21:11,660 and arm ourselves with torches and march on the castles of the people who build our wireless 334 00:21:11,660 --> 00:21:20,020 gateways and our DSL modems and even our Ethernet drivers. Nevertheless, this thinking informed our 335 00:21:20,080 --> 00:21:25,660 design. And I want you to think carefully about that loss region because you should not commit 336 00:21:25,660 --> 00:21:32,980 packets into the network that are not going to make it. And that's what happened here. So, we 337 00:21:32,980 --> 00:21:38,460 created a thing called DNS TAP. It doesn't stand for anything. DNS is the domain name system. 338 00:21:38,600 --> 00:21:44,060 But TAP is not an acronym. This is just what some engineer decided to call it. And something 339 00:21:44,060 --> 00:21:49,860 called frame streams as a bearer channel for that. And these are open source libraries. If you go to 340 00:21:49,860 --> 00:21:56,480 dnstap.info on the web, you'll get the source code. It's in GitHub. It has an Apache open 341 00:21:56,480 --> 00:22:02,620 source version 2 license on it. It may have broader applicability to other problems you're 342 00:22:02,620 --> 00:22:08,040 solving. And I think these libraries are pretty good. And I'm going to explain why. DNS TAP is 343 00:22:08,040 --> 00:22:13,500 the part you have to put into your name server. That means that I have the burden inside of my 344 00:22:13,500 --> 00:22:19,440 security company of having to go hack bind and pay my people to hack bind. I hate that. I thought 345 00:22:19,440 --> 00:22:19,840 I was in the wrong. So, DNS TAP is the part you have to put into your name server. That means that 346 00:22:19,860 --> 00:22:24,180 you're ending that when I left Internet systems consortium. But we're also hacking it into other 347 00:22:24,180 --> 00:22:29,140 name servers. I'll give you the list of those. Frame stream has what we call reliable front 348 00:22:29,140 --> 00:22:34,520 loss. In other words, that's the thing that is able to kind of guess that if something is not 349 00:22:34,520 --> 00:22:38,540 going to get through, we're not going to commit resources to it. And I have some pictures about 350 00:22:38,540 --> 00:22:46,000 that. Implementation has sort of begun. We have quite a bit of software. But we don't have a 351 00:22:46,000 --> 00:22:49,840 receiver for this data yet. In other words, our sensor does not use this source code. We're 352 00:22:49,840 --> 00:22:54,880 this technique yet. We're trying to get more name servers to support it before we build the 353 00:22:54,880 --> 00:22:59,860 infrastructure capable of receiving this. On the other hand, it is open source. You guys, if you 354 00:22:59,860 --> 00:23:04,660 want it, could build a receiver for this. In principle, it's no different from a NetFlow 355 00:23:04,660 --> 00:23:12,140 receiver. It has to listen on a socket and do something with what it receives. And, you know, 356 00:23:12,160 --> 00:23:18,820 when I say deployment is commencing, I mean that it's running at my house. So DNS tap is a 357 00:23:18,820 --> 00:23:26,120 server-embedded thing. Again, it doesn't have to do UDP reassembly. Thanks to some idiot who 358 00:23:26,120 --> 00:23:34,160 wrote RFC 2671, we now have IP fragmentation trying to happen at scale, which does not work, 359 00:23:34,260 --> 00:23:40,580 was never going to work, and that the author of RFC 2671 really ought to be taken out behind the 360 00:23:40,580 --> 00:23:46,120 barn and beaten with a stick. But nevertheless, we have IP fragmentation happening in DNS. 361 00:23:46,340 --> 00:23:48,800 That's one of the reasons that DNS doesn't work so well. We're trying to build a server-embedded 362 00:23:48,820 --> 00:23:54,840 network, but it doesn't work so often. For example, DNSSEC requires this, but IP reassembly and 363 00:23:54,840 --> 00:24:00,400 IP fragmentation often just won't get through a firewall. If you think about your usual firewall 364 00:24:00,400 --> 00:24:09,000 rule for DNS is to allow a packet through if it is to UDP port 53 or if it's from UDP port 53. 365 00:24:09,720 --> 00:24:15,420 The problem is that fragments in IP version 4 don't have port numbers. And so if you want to let 366 00:24:15,420 --> 00:24:18,800 the fragments through also, you have to let all fragments through, or you have to let all 367 00:24:18,820 --> 00:24:21,880 fragments through. You have to build state into your firewall. And I have to tell you that no 368 00:24:21,880 --> 00:24:27,380 matter which of those things you choose, that way lies madness. So again, we should not have 369 00:24:28,100 --> 00:24:33,880 extended DNS to use IP fragmentation, but we did. And right now, that means we have to cope 370 00:24:33,880 --> 00:24:39,100 with that fragmentation even with our passive DNS sensors. And it's not just the kernel's 371 00:24:39,100 --> 00:24:43,960 problem. And then there's the TCP stream reassembly that we don't want to do. We're just 372 00:24:43,960 --> 00:24:48,800 going to get the questions and the answers directly out of the name server. At the moment, we're 373 00:24:48,800 --> 00:24:53,520 going to have to guess what you thought you were doing by looking at your Q name and looking at 374 00:24:53,520 --> 00:25:00,380 what server you sent to. So since we like to make sure that your cache, that cache pollution 375 00:25:00,380 --> 00:25:05,940 attempts don't make it into our logs, we've got logic in our sensor that says, ah, you were 376 00:25:05,940 --> 00:25:12,480 asking, let's say, for the example.com domain name, and you were sending that question to an IP 377 00:25:12,480 --> 00:25:17,560 address that we know is authoritative for .com. And so the answer is probably a referral. It's 378 00:25:17,560 --> 00:25:18,780 probably VeriSign telling you that you're not going to be able to access that domain name. And 379 00:25:18,780 --> 00:25:23,460 if it's telling you where to find example.com, that's okay. Or once we've seen the referral, 380 00:25:23,660 --> 00:25:28,140 then we'll remember those IP addresses. And if you ask the question of those name servers, then 381 00:25:28,140 --> 00:25:33,260 again, it's able to say, hey, you were asking the question of an IP address that we know is one 382 00:25:33,260 --> 00:25:38,160 of the name servers for example.com. Therefore, it's allowed. And there's a huge amount of 383 00:25:38,160 --> 00:25:42,720 transactions that are coming through the network that don't come from any place that they should be 384 00:25:42,720 --> 00:25:47,240 allowed to come from. And we drop those. And every passive DNS collector has the responsibility 385 00:25:47,240 --> 00:25:48,220 of dropping those. 386 00:25:48,780 --> 00:25:53,940 But nevertheless, you're guessing. And you can probably imagine what happens if a name server is 387 00:25:53,940 --> 00:25:59,140 responsible for both .com and example.com, which is that we don't know what you thought you were 388 00:25:59,140 --> 00:26:04,340 doing. We're going to guess that it's okay, but we don't actually know. Whereas inside the name 389 00:26:04,340 --> 00:26:09,300 server, you know exactly what you're doing. You're asking the .com servers because that's your 390 00:26:09,300 --> 00:26:14,420 best guess about where to find example.com. After you get that answer, you're asking those servers 391 00:26:15,000 --> 00:26:18,760 for what's called the bailiwick of example.com because you're not going to be able to find it. You're 392 00:26:18,760 --> 00:26:26,820 always going to send a query to the most specific matching set of servers that you have. But even 393 00:26:26,820 --> 00:26:31,040 though you inside the name server know exactly why you're sending this query and who you're 394 00:26:31,040 --> 00:26:35,780 sending it to and what you think they're responsible for, we, as a passive collector, have to 395 00:26:35,780 --> 00:26:42,100 kind of guess what that is. So once we move into server embedded DNS tap logic, we'll just, you 396 00:26:42,100 --> 00:26:46,240 know, reach directly into your transaction data structure and figure out what you thought the 397 00:26:46,240 --> 00:26:48,740 bailiwick was when you sent that query. Because that's what we're going to be able to do. So we're 398 00:26:48,740 --> 00:26:52,180 information here is it's very important to know that bailiwick if you're going to resist cash 399 00:26:52,180 --> 00:27:18,720 poisoning attempts. Now we also maintain quite a bit of state in our sensor. We will only care about a response if we have seen the query go out. And that's okay for smaller sites. But it can mean tens of megabytes of hash tables and heap for a large regional ISP name server just trying to keep track of what are the outstanding queries so that we can make 400 00:27:18,740 --> 00:27:20,900 make sure that we don't inappropriately collect a 401 00:27:20,900 --> 00:27:24,860 response that was sent unsolicited. That all goes away 402 00:27:24,860 --> 00:27:30,460 with this server embedded logic also. And I mentioned already 403 00:27:30,460 --> 00:27:35,040 we're using Google protocol buffers. One expert explained 404 00:27:35,040 --> 00:27:39,840 them to me as ASN1 for the new century. And it really is a 405 00:27:39,840 --> 00:27:44,000 terribly fast way to serialize and deserialize data. So if 406 00:27:44,000 --> 00:27:46,260 you're thinking you'd like to send data between your 407 00:27:46,260 --> 00:27:50,520 applications but JSON and XML are too slow and you're just not 408 00:27:50,520 --> 00:27:53,320 going to be able to scan forward looking for quotes and commas 409 00:27:53,320 --> 00:27:56,840 and braces fast enough to keep up with the data rate, please 410 00:27:56,840 --> 00:27:59,620 take a look at Google protocol buffers. They did some good work 411 00:27:59,620 --> 00:28:04,240 there and they made it completely open source. So 412 00:28:05,680 --> 00:28:08,420 another thing we'd like to be able to do is store more than 413 00:28:08,420 --> 00:28:12,220 just the packet and various metadata. For example, the 414 00:28:12,220 --> 00:28:16,240 identity of the server is sometimes very important. 415 00:28:16,260 --> 00:28:18,480 There's a lot of information. And if you do a collection for 416 00:28:18,480 --> 00:28:21,700 the enterprise purposes, you're planning on looking through the 417 00:28:21,700 --> 00:28:25,620 logs yourselves, you might like to know that a bunch of 418 00:28:26,140 --> 00:28:31,460 transactions that are in your log file came from the same 419 00:28:31,460 --> 00:28:34,960 server even though the server address itself was any casted. 420 00:28:35,100 --> 00:28:37,900 So all of your transactions look like they came from the 421 00:28:37,900 --> 00:28:41,200 same server. But in this case, you could actually get a per 422 00:28:41,200 --> 00:28:46,240 server identity appended to the transaction in the log. And that 423 00:28:46,260 --> 00:28:51,560 log. And you can also keep track of why a certain query was 424 00:28:51,560 --> 00:28:53,980 sent. Sometimes you're forwarding a query because it's a 425 00:28:53,980 --> 00:28:56,560 cache miss. Sometimes you're sending a query of your own 426 00:28:57,080 --> 00:28:59,820 because you need to know where the name servers for something 427 00:28:59,820 --> 00:29:03,700 are even though there's no query that you're forwarding at this 428 00:29:03,700 --> 00:29:07,540 instant that is causing you to need to know that. And so this 429 00:29:07,540 --> 00:29:10,720 is an opportunity to kind of put an enumerated data type there 430 00:29:10,720 --> 00:29:14,260 and say, by the way, these three transactions might all 431 00:29:14,260 --> 00:29:17,200 look the same, but they have different motivations. So the 432 00:29:17,200 --> 00:29:20,400 motivation becomes something we can append to the data structure 433 00:29:20,400 --> 00:29:23,880 in the log. And I've already said this is all about 434 00:29:24,720 --> 00:29:28,680 observation. We're trying to rebuild the DNS content. We're 435 00:29:28,680 --> 00:29:31,940 not trying to find out who's looking stuff up. Now, that 436 00:29:31,940 --> 00:29:35,440 having been said, if you're an enterprise and you want to know 437 00:29:35,440 --> 00:29:38,900 which of your employees looks something up, that is permitted 438 00:29:38,900 --> 00:29:42,800 by this particular library. I can't keep that out by not 439 00:29:42,800 --> 00:29:44,240 including it myself. It's open to the public. I can't keep it 440 00:29:44,260 --> 00:29:47,120 open source. Somebody can send us a patch. So it will have that 441 00:29:47,120 --> 00:29:52,940 capability, but in my company, we will not be using it. So I 442 00:29:52,940 --> 00:29:56,320 mentioned reliable front loss. Again, if you're not going to 443 00:29:56,320 --> 00:29:59,000 have enough capacity to get something all the way through 444 00:29:59,000 --> 00:30:02,040 the other end, you would like to not send it in the first place. 445 00:30:03,380 --> 00:30:09,680 So the TCP protocol was really first implemented in BSD. I know 446 00:30:09,680 --> 00:30:13,900 there were some other cheese bag little experimental things in the 447 00:30:14,920 --> 00:30:18,700 early 80s that did this, but they were mostly NCP things that 448 00:30:18,700 --> 00:30:21,900 had been redone. So really, TCP and the Berkeley socket 449 00:30:21,900 --> 00:30:26,980 interface co-evolved. And I think a lot of mistakes were 450 00:30:26,980 --> 00:30:31,260 made. And I'm happy to see that both the Windows folks and the 451 00:30:31,260 --> 00:30:35,360 Linux folks have realized, you know, BSD sockets is not exactly 452 00:30:35,360 --> 00:30:38,120 the right way to talk to the Internet. We need some additional 453 00:30:38,920 --> 00:30:42,780 API work here. And so things have improved since the BSD days. 454 00:30:43,080 --> 00:30:44,240 There's one part that has to be improved. And that's the fact that 455 00:30:44,260 --> 00:30:47,980 it hasn't improved. And that is the treatment of non-blocking data. 456 00:30:48,300 --> 00:30:52,060 Right? Because the best way to lose data would be to commit it 457 00:30:52,060 --> 00:30:54,700 to the kernel. And if the kernel hasn't got room in the socket 458 00:30:54,700 --> 00:30:57,460 buffer, then the kernel will reject it. And then you know, 459 00:30:57,560 --> 00:30:59,600 well, that data didn't get through. And you can make an 460 00:30:59,600 --> 00:31:02,600 informed decision from that failure whether you want to try 461 00:31:02,600 --> 00:31:07,800 and resend it later or not. And that works for UDP. Because UDP is 462 00:31:07,800 --> 00:31:12,480 an atomic protocol. If the kernel cannot commit your entire 463 00:31:12,480 --> 00:31:14,240 message into a UDP socket, then it's not going to work. And so 464 00:31:14,260 --> 00:31:14,640 if you try to send a 500 octet message into a TCP socket, it 465 00:31:14,640 --> 00:31:18,260 will reject your entire message. Thank you. That's exactly what I 466 00:31:18,260 --> 00:31:23,960 wanted. For TCP it is not so. If you try to send a 500 octet 467 00:31:23,960 --> 00:31:28,380 message into a TCP socket that's non-blocking and it only has room 468 00:31:28,380 --> 00:31:33,920 for 490, it's going to return 490 from the right call and you're 469 00:31:33,920 --> 00:31:36,320 going to be sitting there with ten bytes in your hand that you 470 00:31:36,320 --> 00:31:39,660 have to send later. Because that's what the far end is going 471 00:31:39,660 --> 00:31:43,800 to expect is the rest of the 500 bytes that you tried to send. And 472 00:31:43,800 --> 00:31:47,240 that means you're stuck. I don't want to be stuck. I would really 473 00:31:47,240 --> 00:31:51,420 love it if TCP had reliable rejection on a message boundary 474 00:31:51,920 --> 00:31:54,760 but the socket interface doesn't permit it. It's not a TCP 475 00:31:54,760 --> 00:31:58,160 problem. It is a kernel API design problem. It's the way 476 00:31:58,160 --> 00:32:01,540 the system calls are organized. And so we had to build a whole 477 00:32:01,540 --> 00:32:05,160 infrastructure in front of the kernel to cause this to happen 478 00:32:05,160 --> 00:32:11,640 the way it should. So we developed a library called 479 00:32:11,640 --> 00:32:12,860 Framestream. I don't know if you've heard of Framestream. 480 00:32:13,800 --> 00:32:16,160 I don't know why we don't use vowels. It's not like we need 481 00:32:16,160 --> 00:32:20,220 short identifiers. But anyway, it's Efstrom. And it uses a 482 00:32:20,220 --> 00:32:24,960 lockless single producer, single consumer ring buffer. When I say 483 00:32:24,960 --> 00:32:28,800 lockless, I mean that almost all of this stuff is threaded and most 484 00:32:28,800 --> 00:32:32,640 of the loss of performance we see in threaded applications is 485 00:32:32,640 --> 00:32:36,180 because they're trying to lock and unlock these fine grained 486 00:32:36,180 --> 00:32:40,280 semaphores. And so we wanted to avoid all of that. And so we 487 00:32:40,280 --> 00:32:43,720 found a method of getting this to work without having to call 488 00:32:43,720 --> 00:32:48,060 any of the P thread locking or the mutex handlers. That turned 489 00:32:48,060 --> 00:32:50,460 out to be important for performance once you get into 490 00:32:50,460 --> 00:32:54,040 the half million events per second range. Obviously the 491 00:32:54,040 --> 00:32:57,540 exact range at which you have problems is going to continue to 492 00:32:57,540 --> 00:33:01,040 go up as we get faster processors. But there will 493 00:33:01,040 --> 00:33:06,340 always be some point that you should not exceed. So we're just 494 00:33:06,340 --> 00:33:10,700 avoiding the whole problem. Now the Efstrom socket, the output 495 00:33:10,700 --> 00:33:13,700 side of the Efstrom socket toward your list of the 496 00:33:13,720 --> 00:33:17,740 listener, is still blocking. And so the thread that is writing 497 00:33:17,740 --> 00:33:21,620 to it could just block. And in this case, if you had 500 octets 498 00:33:21,620 --> 00:33:26,280 to write and there was only room for 490, then rather than 499 00:33:26,280 --> 00:33:30,480 returning you the last 10 bytes to deal with, it's a normal 500 00:33:31,000 --> 00:33:34,300 blocking socket. It just blocks until there's room for all 500 501 00:33:34,300 --> 00:33:37,840 of them. Which means that the consumer side is not going to 502 00:33:37,840 --> 00:33:41,160 pick up the data out of your ring buffer until there is room 503 00:33:41,160 --> 00:33:43,700 in the upstream socket for it. And that's what we're trying to 504 00:33:43,720 --> 00:33:49,580 do. And that's how we get the reliable front loss. We have a 505 00:33:49,580 --> 00:33:53,500 diagram for this. This was all done in LaTeX, by the way, so you 506 00:33:53,500 --> 00:33:56,220 should clap now. I don't know how to do it, but the guy who 507 00:33:56,220 --> 00:33:59,680 wrote this is a wizard with this kind of thing. So what you're 508 00:33:59,680 --> 00:34:03,220 seeing here is DNS queries and responses in the red and green 509 00:34:03,220 --> 00:34:06,100 on your left are coming into the worker threads in the name 510 00:34:06,100 --> 00:34:09,320 server that are then dumping things into this circular queue. 511 00:34:09,780 --> 00:34:12,780 And then there is this I.O. thread, the separate thing, that 512 00:34:12,780 --> 00:34:13,700 is actually trying to block. And that's what we're trying to 513 00:34:13,720 --> 00:34:18,960 bucket things out of those circular queues. So the dashed 514 00:34:18,960 --> 00:34:22,320 line, the curved dashed line on the right side going from top to 515 00:34:22,320 --> 00:34:26,100 bottom is a normal byte stream socket. It's a TCP session 516 00:34:26,100 --> 00:34:29,900 somewhere. And it will block if it's full. If that DNS tap 517 00:34:29,900 --> 00:34:33,420 receiver down there can't keep up, then that causes the DNS 518 00:34:33,420 --> 00:34:37,220 tap I.O. thread to just block. At which point the circular queues 519 00:34:37,220 --> 00:34:41,480 that are upstream of it are overrun. And that gives us a 520 00:34:41,480 --> 00:34:43,700 delightful property of discarding DNS queries and 521 00:34:43,720 --> 00:34:43,880 getting rid of them. So that's what we're trying to do here. 522 00:34:43,880 --> 00:34:47,360 get rid of the oldest data. Because really, in the 523 00:34:47,360 --> 00:34:50,980 telemetry world, if you're going to lose something, what 524 00:34:50,980 --> 00:34:53,760 you want to do is lose the stuff that is going to be oldest 525 00:34:53,760 --> 00:34:56,760 if it got through. In other words, yesterday's newspaper is 526 00:34:56,760 --> 00:34:59,820 of no interest to us. So if you were trying to carry two 527 00:34:59,820 --> 00:35:03,740 newspapers and you're planning to read both of them, but you 528 00:35:03,740 --> 00:35:06,280 finally realize you can only carry one, keep today's 529 00:35:06,280 --> 00:35:10,280 newspaper. And that's what this logic is designed to do. And 530 00:35:10,280 --> 00:35:13,420 ultimately we're showing it going into a log file here, but 531 00:35:13,720 --> 00:35:17,640 the real game here is to do all kinds of real time analysis on 532 00:35:17,640 --> 00:35:22,720 it. So the log file is virtual in that sense. These are the 533 00:35:22,720 --> 00:35:26,260 message types that we have defined so far. So we have stub 534 00:35:26,260 --> 00:35:29,640 queries, authoritative queries, and the responses. Resolver 535 00:35:29,640 --> 00:35:34,100 queries, client queries, forwarder queries. There are a 536 00:35:34,100 --> 00:35:39,660 couple more. I asked for review of the slide deck. And I got 537 00:35:39,660 --> 00:35:42,980 told, yeah, there are some other things. But frankly, they are a 538 00:35:43,720 --> 00:35:47,180 fairly deep in the weeds. So if you look on the DNSTAP.info 539 00:35:47,180 --> 00:35:49,780 website and get the latest version of the software, you're 540 00:35:49,780 --> 00:35:52,440 going to see a few more message types than what I've shown you. 541 00:35:53,620 --> 00:35:58,000 We're thinking about ways to remember other things that 542 00:35:58,000 --> 00:36:02,380 happen inside of a name server. So for example, DNS is used for 543 00:36:02,380 --> 00:36:05,680 DDoS amplification purposes. Because we have all these 544 00:36:05,680 --> 00:36:09,700 immensely powerful servers that are answering UDP whose source 545 00:36:09,700 --> 00:36:13,520 IP addresses can be forged trivially over probably 546 00:36:13,720 --> 00:36:17,300 60% of the edge of the Internet. Which means that if you don't 547 00:36:17,300 --> 00:36:20,700 like somebody, you can send a stream of queries having that 548 00:36:21,420 --> 00:36:24,680 unlikable person's IP address in them as the source and they 549 00:36:24,680 --> 00:36:28,620 will receive the responses. So every time you hear about spam 550 00:36:28,620 --> 00:36:32,800 house receiving a 400 gigabit per second DDoS, it's that. It's 551 00:36:32,800 --> 00:36:37,840 because UDP is so dangerous in this way. So my team back at 552 00:36:37,840 --> 00:36:41,100 ISC developed something called response rate limiting where you 553 00:36:41,100 --> 00:36:43,700 can start to keep track of, well, gee, should you be 554 00:36:43,720 --> 00:36:45,980 asking the same question over and over again? If you're not 555 00:36:45,980 --> 00:36:49,180 hearing my answer, then I'm going to stop sending it. Or 556 00:36:49,180 --> 00:36:52,800 maybe send you an indication that you should retry with TCP 557 00:36:52,800 --> 00:36:56,420 because then I will know that the address wasn't forged, that 558 00:36:56,420 --> 00:37:01,480 kind of thing. The problem with rate limiting is you don't have 559 00:37:01,480 --> 00:37:07,080 any records. And we thought perhaps DNS tap would be a great 560 00:37:07,080 --> 00:37:10,880 place to put an event that says, hey, we've received too many 561 00:37:11,400 --> 00:37:13,700 similar queries from a certain net block. We're going to have to 562 00:37:13,720 --> 00:37:16,140 do this again. So we've begun suppressing responses. And then 563 00:37:16,140 --> 00:37:19,900 later when that time's out, then we have stopped suppressing those 564 00:37:19,900 --> 00:37:23,580 responses. So that's the kind of thing you could do if your name 565 00:37:23,580 --> 00:37:27,000 server had something other than syslog as a way to record its 566 00:37:27,000 --> 00:37:29,940 activities. Because I got to tell you, putting this into ASCII 567 00:37:29,940 --> 00:37:34,100 in a log file somewhere is old. I know Splunk built a business on 568 00:37:34,100 --> 00:37:37,200 it, but that doesn't mean that it's, that that's what the 569 00:37:37,200 --> 00:37:40,000 future has to look like. I feel certain, by the way, that Splunk 570 00:37:40,000 --> 00:37:43,600 will come up with a receiver for DNS tap format since it's all 571 00:37:43,720 --> 00:37:46,980 open source and I intended to be very popular. We're also 572 00:37:46,980 --> 00:37:51,420 thinking about ways to do zone transfers and cache purge, cache 573 00:37:51,420 --> 00:37:55,300 expiry were examples I used earlier in the talk. Let's look 574 00:37:55,300 --> 00:38:00,680 at performance. This is Bind9's performance on a particular 575 00:38:00,680 --> 00:38:05,540 server. It was able to reach to about 400,000 answers per 576 00:38:05,540 --> 00:38:09,540 second without logging turned on. But if you turn on logging 577 00:38:09,920 --> 00:38:13,700 and you're logging into a hard disk, then it tops off the 578 00:38:13,720 --> 00:38:16,960 data and logs out at about 160,000 queries a second. Same 579 00:38:16,960 --> 00:38:20,200 hardware. This is the impact of logging is that you go from the 580 00:38:20,200 --> 00:38:26,060 blue line to the red line. This is unbound with our patches 581 00:38:26,060 --> 00:38:31,840 installed. And what you should be able to see is that without 582 00:38:32,580 --> 00:38:36,560 anything going on, we were reaching about 850,000 queries a 583 00:38:36,560 --> 00:38:40,780 second. Putting our logic in but disabling it did cost a little 584 00:38:40,780 --> 00:38:43,700 bit because there was one more if statement. So we were able to 585 00:38:43,720 --> 00:38:45,960 put a statement in the code to test to see whether this was 586 00:38:45,960 --> 00:38:50,200 enabled. But it didn't hurt much. Turning it on and then 587 00:38:50,200 --> 00:38:54,520 telling our logic to execute but discard cost nothing. And 588 00:38:55,120 --> 00:38:59,380 turning it on and actually logging to a hard disk reduced 589 00:39:00,380 --> 00:39:04,900 us to around 800 from around 850. And so we like the 590 00:39:04,900 --> 00:39:07,920 performance aspects of this far better than we like the 591 00:39:08,400 --> 00:39:13,200 performance aspects of syslog. I mentioned that it's a 592 00:39:14,500 --> 00:39:21,060 patchy OSL2. I actually rewrote the BSD license to be shorter for 593 00:39:21,060 --> 00:39:24,500 ISC. So if you go to Wikipedia, you'll see that there's 594 00:39:24,500 --> 00:39:28,800 something now called the ISC license. And what I did is I 595 00:39:28,800 --> 00:39:31,920 kept removing words until it made no sense and then added 596 00:39:31,920 --> 00:39:35,500 back the last word I had removed. And it got real short 597 00:39:35,500 --> 00:39:38,620 but it got so short that it doesn't actually protect you in 598 00:39:38,620 --> 00:39:42,500 the ways that we need to. Turns out that the Apache open source 599 00:39:43,720 --> 00:39:47,520 team had access to lawyers who cared passionately about this. 600 00:39:47,740 --> 00:39:51,620 And so their license is much longer than ISC's license or the 601 00:39:51,620 --> 00:39:54,560 Berkeley license. But it means the same thing. You can do 602 00:39:54,560 --> 00:39:56,880 whatever you want with the code as long as you don't sue them. 603 00:39:57,720 --> 00:40:01,200 So that's the license we're using on all of this now. In 604 00:40:01,200 --> 00:40:04,140 fact, I've advised my friends back at ISC maybe they should 605 00:40:04,140 --> 00:40:11,040 switch from their license to the Apache license. Everything is on 606 00:40:11,040 --> 00:40:13,700 the website. dnstap.info. We've got the protocol. We've got the 607 00:40:13,720 --> 00:40:18,720 reference API. Reference tool set. Any patches that have been 608 00:40:18,720 --> 00:40:22,320 accepted by the unbound team or the not team or the bind team 609 00:40:22,320 --> 00:40:26,360 once we get around to that will disappear from the website. But 610 00:40:26,360 --> 00:40:29,460 as long as we just have a patch that we've offered the name 611 00:40:29,460 --> 00:40:32,180 server implementer but they haven't integrated it yet, 612 00:40:32,280 --> 00:40:34,900 you'll find those patches here also. So if you want to try 613 00:40:34,900 --> 00:40:38,000 something out that isn't in your name server yet, then you'll 614 00:40:38,000 --> 00:40:42,820 find the patches here. Obviously, I am not in the 615 00:40:42,820 --> 00:40:43,700 non-profit. I'm not in the non-profit. I'm not in the 616 00:40:43,720 --> 00:40:47,380 non-profit open source world anymore. I spent 18 years at ISC. 617 00:40:47,480 --> 00:40:50,820 I did a lot of work with bind. I've given a lot of stuff away. 618 00:40:51,380 --> 00:40:53,800 At this point, I've got to put some kids through college. So 619 00:40:53,800 --> 00:40:57,840 this is a commercial endeavor. But it turns out that I have 620 00:40:57,840 --> 00:41:01,520 aligned our commercial interests with your potential commercial 621 00:41:01,520 --> 00:41:04,960 or non-commercial interests. Because what we want is wide 622 00:41:04,960 --> 00:41:07,840 adoption. And once there is wide adoption, I think you're 623 00:41:07,840 --> 00:41:11,520 going to see a lot more people analyzing their DNS transaction 624 00:41:11,520 --> 00:41:13,700 flow than has occurred up until now. So we're going to have to 625 00:41:13,700 --> 00:41:17,700 wait and see what happens. And eventually, we will get around 626 00:41:17,700 --> 00:41:21,480 to putting some pressure on Nominum and Microsoft who have 627 00:41:21,480 --> 00:41:25,680 proprietary commercial binary only non-open source name 628 00:41:25,680 --> 00:41:29,540 servers. We think that if we build an ecosystem around DNS 629 00:41:29,540 --> 00:41:33,400 tap, that those companies will start losing commercial deals 630 00:41:33,400 --> 00:41:36,420 because they can't speak the telemetry protocol that their 631 00:41:36,420 --> 00:41:38,940 customers have built an infrastructure for. So that's 632 00:41:38,940 --> 00:41:41,640 kind of the end game. And I don't mind them knowing that. I was 633 00:41:41,640 --> 00:41:43,680 the co-founder and first chairman of a company called 634 00:41:43,680 --> 00:41:47,440 Nominum. And I have many friends at Microsoft. So by now, 635 00:41:47,480 --> 00:41:54,980 they know what to expect from me. I am going to skip a bunch 636 00:41:54,980 --> 00:42:00,300 of this. Because I said I wouldn't talk about the passive 637 00:42:00,300 --> 00:42:07,260 DNS database. And indeed, I won't. So I may be about to 638 00:42:07,260 --> 00:42:09,620 give you back some time if we don't have questions. I'm 639 00:42:09,620 --> 00:42:11,060 really hoping for some questions. 640 00:42:15,940 --> 00:42:28,660 Or complaints. Yes. The question is, what can you do 641 00:42:28,660 --> 00:42:31,500 with DNS tap if your existing infrastructure is already 642 00:42:31,500 --> 00:42:36,120 collecting in PCAP format? And the answer is, we anticipate 643 00:42:36,120 --> 00:42:40,640 writing a tool that will do the best it can. Obviously you won't 644 00:42:40,640 --> 00:42:43,560 see cache purge events and the rest of it. But we're going to do 645 00:42:43,560 --> 00:42:47,980 the best we can with a tool that will ingest a PCAP stream or a 646 00:42:47,980 --> 00:42:54,780 PCAP file and turn it into DNS tap just as a data reduction and 647 00:42:54,780 --> 00:42:59,920 data normalization tool. But you really don't, that's, you 648 00:42:59,920 --> 00:43:04,260 should see that as a transition method rather than as something 649 00:43:04,260 --> 00:43:07,260 you'd really plan to build new infrastructure to work that way. 650 00:43:14,000 --> 00:43:18,400 Help me out here. I rode two days on a motorcycle to get here for 651 00:43:18,400 --> 00:43:28,380 this. I need complaints. I need questions. All right. So public 652 00:43:28,380 --> 00:43:33,180 service announcement. ISC announced a bind vulnerability 653 00:43:33,890 --> 00:43:38,960 about a week ago. It's like all bind 9 vulnerabilities, it's not 654 00:43:38,960 --> 00:43:43,540 a remote code execution problem. It is an assertion problem. But 655 00:43:43,560 --> 00:43:47,380 bind 8 had a lot of remote code execution errors in it. And so 656 00:43:47,380 --> 00:43:51,060 when I told the team what to do with bind 9, I wrote no code in 657 00:43:51,060 --> 00:43:53,980 bind 9. But when I told them what to do, I said, if anything 658 00:43:53,980 --> 00:43:57,420 ever goes wrong, I want it to die on an assertion rather than 659 00:43:57,900 --> 00:44:01,120 executing code that came in over the network. And so it does that. 660 00:44:01,280 --> 00:44:04,860 It is very assertion heavy code. And all the vulnerabilities that 661 00:44:04,860 --> 00:44:07,660 have been reported against bind and it's bind 9, it's long 662 00:44:07,660 --> 00:44:10,680 history, have been of the form, if you send it a packet that 663 00:44:10,680 --> 00:44:13,540 looks like this, you will, you will cause the machine to do a 664 00:44:13,560 --> 00:44:19,060 thing to dump core. That's now happening. It's been seen in the 665 00:44:19,060 --> 00:44:24,220 wild. You want to patch your name servers. If you have bind or if 666 00:44:24,220 --> 00:44:26,540 you think you might have bind or if you have an appliance that 667 00:44:26,540 --> 00:44:29,580 you suspect might have bind, make sure it's patched. Because 668 00:44:29,580 --> 00:44:32,920 right now it's possible for anybody who wants to send you a 669 00:44:32,920 --> 00:44:35,920 simple unauthenticated packet that will cause your name server 670 00:44:35,920 --> 00:44:38,920 to stop. So that's my public service announcement for the 671 00:44:38,920 --> 00:44:43,540 day. So with that, thank you all for your time. Thank you for 672 00:44:43,560 --> 00:44:46,580 coming. And thank you to the organizers for inviting me.