[00:00.000 --> 00:07.860] Good morning, party track. How are we doing? Yeah! All right. How many people here came [00:07.860 --> 00:13.900] to hear about home alarm systems? All right. You're not going to hear about home alarm [00:13.900 --> 00:27.240] systems. Oh, sorry. The speaker had a small problem with his employer. So that talk is [00:27.240 --> 00:31.880] not going to happen. But I can guess and I'll summarize it even though I haven't read the [00:31.880 --> 00:43.790] talk. Your home alarm system is kind of fucked. All right. So with that out of the way, let's [00:43.790 --> 00:48.190] figure out a bonus talk then, right? So this is my good friend Zach. We go back a long [00:48.190 --> 00:53.630] way. And he's going to give you the most entertaining and exciting talk about logs that you're going [00:53.630 --> 00:59.490] to see all day. So let's give Zach a big party track welcome. [01:05.880 --> 01:11.920] It's the most exciting one because there's no other one. So before we get started, as [01:11.920 --> 01:17.720] Juris was saying, this is Logan. Everyone say hi, Logan. He was the one who was originally [01:17.720 --> 01:22.800] supposed to speak at this slot about the insecurities in home alarm systems. And you may have seen [01:22.920 --> 01:29.360] a few articles, you know, hit up on a few different sites about his talk. But last week this [01:29.360 --> 01:36.060] article came out and it sounds like he had to cancel. Ergo why I'm here. More recently NPR [01:36.060 --> 01:39.860] actually did an article. They actually got time with him. I pinged him a few times to see if [01:39.860 --> 01:44.800] he wanted to actually share some information that he could share. But didn't respond. So I [01:44.800 --> 01:48.380] just want to post this NPR article real quick because that summarizes pretty much what [01:48.380 --> 01:57.160] happened. He was supposed to be on stage but because of the pressures put on him he can't. So [01:57.160 --> 02:09.160] I'm just going to leave those names up there for a second. And we're moving on. So in honor [02:09.160 --> 02:13.440] of Logan, because he couldn't make it, I decided to start our new meme. Ridiculously good [02:13.440 --> 02:22.630] looking researcher. Has to pull talks, still impresses us all with his smile. So I'm going to [02:23.070 --> 02:27.110] give you a talk. And this is your top gear, top tip. If you're going to do this and get your [02:27.110 --> 02:34.410] talk pulled, pro tip number one, follow responsible disclosure if you're feeling nice. Tip [02:34.410 --> 02:38.430] number two, don't name the vendor in a press release unless your goal is to get your talk [02:38.430 --> 02:46.110] pulled. And if you're going to give the talk and you're worried about legal action, go ahead [02:46.110 --> 02:53.370] and up a skate. And make sure you sell the job. So top gear, top tip, if you're going to do [02:53.370 --> 02:57.770] what Logan did for the future, for those of you who may be considering, I don't know, doing [02:57.770 --> 03:02.290] his talk or a similar talk in a future venue, you might want to follow that. So instead you [03:02.290 --> 03:21.360] get me logging by Zach. This is party track, isn't it? Good. So I always like to start the [03:21.360 --> 03:24.640] talks off with what this talk is and what this talk is not so you don't have to spend the [03:24.640 --> 03:30.020] next 45 minutes listening to me ramble. So first and foremost, this is going to be a [03:30.020 --> 03:33.960] defense focused talk. So if you're looking for some sexy Oday, you're not going to find it [03:33.960 --> 03:39.780] here. We're going to be talking about collecting, storing, monitoring, parsing, having fun [03:40.220 --> 03:44.760] with logs. And we're going to try to make it fun. And the big reason I'm giving this is [03:44.760 --> 03:48.940] because it's a reoccurring problem we keep having over and over and over. We're not [03:48.940 --> 03:52.960] getting good logging systems put together. We're not getting good logging data in most [03:52.960 --> 03:57.660] situations. Sure, you may be the 1% here who's like, yeah, I got this shit covered. This [03:57.660 --> 04:04.900] talk is not for you. And if you know what ELK stands for and you are an ELK rock star, you [04:04.900 --> 04:08.780] may want to go get a few minutes elsewhere. But this is going to be probably a 200, 300 level [04:08.780 --> 04:16.200] talk on logging and big logging environments. So as I said, this is not a talk about hacking [04:16.200 --> 04:21.600] your alarm systems and the wireless problems with them. This is not an offensive security [04:21.600 --> 04:25.520] talk and I'm not going to be addressing challenges of dealing with over 200 gigs of log [04:25.520 --> 04:33.100] data a day. That's going to be a whole different barrel of monkeys to deal with. So who am I? [04:33.100 --> 04:38.520] My name is Zach, as we've already covered. I'm a magic partner over at Urbane. I hail from [04:38.520 --> 04:44.900] Chicago. I do things and stuff. And everyone has their big slide of credentials. This is [04:44.900 --> 04:54.950] mine. Moving on. So let's face it, you know, offensive talks can get up here and ramble [04:54.950 --> 05:00.510] about the cool hotness for a full hour about how awesome things are. But really, we're not [05:00.510 --> 05:04.490] going to use a lot of that stuff. Yeah, it's cool to hear about, you know, the insecurities [05:04.490 --> 05:07.850] and this and that. But when we come back to our day jobs back at home, we've actually got to [05:07.850 --> 05:14.710] deal with protecting stuff. So the vast majority of us actually need more defensive talks. I [05:14.710 --> 05:17.490] figured I would take and make it my initiative to start looking a little more on the [05:17.490 --> 05:23.370] defensive side. So let's start with logging. I'm going to say it with an Irish or Boston [05:23.370 --> 05:28.130] accent. I don't know. So we still have a logging problem. We're still relying on log data [05:28.130 --> 05:33.610] and log formats that are archaic. And we've seen, you know, from me and my consulting role [05:33.610 --> 05:37.450] and from a lot of other people, we've seen that, you know, the tech community has this [05:37.450 --> 05:42.050] figured out, but not from a security perspective. Their focus has been on, you know, we [05:42.050 --> 05:47.570] want to know if there's errors. We want to know what user habits are. But InfoSec hasn't [05:47.570 --> 05:51.270] really figured it out. I don't know if it's because we're lazy or because we haven't taken the [05:51.270 --> 05:57.370] time to look at it, but I figured let's dive into it a little bit more. So kind of what we're [05:57.370 --> 06:00.310] going to cover today, we're not going to talk about generating logs, because that's easy. I [06:00.310 --> 06:04.250] could give you a configuration file and we could call it a day. I'm not going to fill 45 [06:04.250 --> 06:07.490] minutes of explaining a config file. It will put you all to sleep, even if there's music [06:07.490 --> 06:12.150] here at party track. We're going to talk more about the collecting logs. We're going to talk [06:12.150 --> 06:17.590] about storing, processing, and most importantly, the actual monitoring and security [06:17.590 --> 06:24.750] events for logs. Here's the obligatory why do we need logs, because, oh, I'm just storing [06:24.750 --> 06:30.810] them. It goes beyond just security. You know, we need it just from a management perspective [06:30.810 --> 06:35.950] to convince our bosses that we're doing what we're doing and we're doing it right. A lot of [06:35.950 --> 06:45.550] times we have to deal with this compliance stuff. Full disclosure, I'm a QSA now and I cannot [06:45.550 --> 06:54.150] say anything about it. So it's not out of choice. So long story short, yeah, compliance is [06:54.150 --> 06:58.350] going to be a driving force a lot of times for stuff. And we can use that also from a security [06:58.350 --> 07:03.210] point of view of going, hey, I've got to meet this ISO, PCI, HIPAA, whatever it may be, [07:03.210 --> 07:07.290] whatever you have to deal with. We can use that to say, hey, I need a little money, I need a [07:07.290 --> 07:12.950] little time to actually do the cool security stuff I want to do. We need it from the [07:13.530 --> 07:17.190] security perspective, duh. For instance, response, duh. And from a technical operation [07:17.190 --> 07:20.830] side, as I said, DevOps has this figured out. They've got to figure it out from, you know, we [07:20.830 --> 07:26.490] need this from an operational side. But they don't really share that information sometimes, [07:26.490 --> 07:30.450] or we don't have a DevOps kind of thing. And I'm using DevOps loosely, if people don't know [07:30.450 --> 07:33.970] what it is, it's the whole integration of developers with operational people and being one [07:33.970 --> 07:40.510] big happy family. And let's be honest about our current state of logs. Most stuff just kind of [07:40.510 --> 07:44.850] sits there or gets deleted. You know, we have our log rotate set for 90 days because we have [07:44.850 --> 07:49.510] to for compliance reasons, and it's getting deleted. Or we're sending it to some product [07:49.510 --> 07:54.470] that's magically this pretty little box or pretty little VM or pretty little software, and [07:54.470 --> 07:57.950] we're storing it, and when, you know, we're having people come in to troubleshoot something [07:57.950 --> 08:05.030] or having an auditor or assessor come in, we're showing it to them. But honestly, let's be [08:05.030 --> 08:07.790] honest with ourselves and confess right now, we're not really watching them as much as we [08:07.790 --> 08:10.870] should in most cases. You know, we set it up because we thought we were doing the right [08:10.870 --> 08:15.670] thing, but we don't actually watch them. And I think a lot of that comes from the usual [08:15.670 --> 08:20.250] approach of watching logs. As you can tell, by the way, I love the TV show Archer. So all [08:20.250 --> 08:25.770] these images that don't have attribution, you can take them. But so the traditional [08:25.770 --> 08:31.830] approach of using a sys log server and using regex and sending alerts if it hits a [08:31.830 --> 08:36.470] certain thing, it doesn't really scale well. We can take and set up for multiple systems [08:36.470 --> 08:40.490] and back up, but it really defeats the purpose of being able to search and actually leverage [08:40.490 --> 08:45.930] those. And again, as I said, we can leverage a vendor product. A lot of good vendors, I [08:45.930 --> 08:53.030] won't name names here. You can. But a lot of them have great products out there, but they are [08:53.470 --> 08:59.750] expensive as shit. And the whole model is to do it as a volume based licensing. You want to [08:59.750 --> 09:04.850] log more, it's going to cost you more. But I'm hosting my own data. It's going to cost you [09:04.850 --> 09:08.710] more. And yeah, it makes sense from a business standpoint and it makes sense from a scale [09:08.710 --> 09:13.830] standpoint, but it can get very expensive quickly. I was talking to a friend the other day [09:13.830 --> 09:20.630] and they had a $2 million IT budget for all their operational expenses. They had a large [09:20.630 --> 09:29.090] vendor, we'll call them a flog him him. And they wanted $400,000 to do the logging for their [09:29.090 --> 09:36.670] environment. I mean, that's almost 25% of their year's budget just to do logs? I mean, we [09:36.670 --> 09:42.390] can use our money a little bit more wisely. And I'm not saying, you know, vendors are a [09:42.390 --> 09:46.970] bad thing. If you work for a vendor, a lot of you probably do, I'm not saying, oh, don't go [09:46.970 --> 09:51.390] buy the big guy's data. It's great a lot of times. If you have the financial resources, they [09:51.390 --> 09:58.090] are definitely great. And they also offer, most importantly, the idea of not having to have [09:58.090 --> 10:01.910] the technical talent to manage them. You can hire the guy who just graduated from college, [10:01.910 --> 10:06.990] say here, have fun with this product and they'll figure it out. But we can be a little bit [10:06.990 --> 10:11.470] smarter since we're people who actually like to tinker with things, break things and do [10:11.470 --> 10:17.410] things right. So I've been on this journey to find open source solutions and to actually [10:18.250 --> 10:22.370] help share the open source solutions that are out there and how to configure them. So I [10:22.370 --> 10:27.130] looked for this scalable logging solution that's, you know, open source so we can tinker [10:27.130 --> 10:30.970] with them, we don't have to pay license fees. It's reliable, scalable, secure. And the [10:30.970 --> 10:35.450] reliable and scalable is really important when it comes to your logs. And meets the [10:35.450 --> 10:40.630] compliance requirements stuff that you have to follow. And here are our top three winners. [10:41.110 --> 10:45.410] We've got Logstash, Elasticsearch and Kibana, which is what I'll be talking about today, also [10:45.410 --> 10:50.550] known as Elk. As a runner up we have Fluentd, which leverages Elasticsearch. They're a great [10:50.550 --> 10:54.050] product or a great solution. I don't want to call them a product because they don't really [10:54.050 --> 11:00.770] sell it. And then there's Greylog2 as well. Now as you can tell, Logstash and Greylog are [11:00.770 --> 11:07.150] Java based. I know, boo, hiss, Java, so memory consumption, but they work. And then [11:07.150 --> 11:13.570] Fluentd is CRuby based, so Ruby. So as I said, we'll be focusing on Logstash, kind of going [11:13.570 --> 11:18.950] through what is this Logstash, Elasticsearch, Kibana stuff, and how do we get events, [11:18.950 --> 11:23.670] process them, alert them, search them, and most importantly, impress that boss, because [11:23.670 --> 11:28.450] that's what we're doing. And so that's the end of my talk. You should just go use it and [11:28.450 --> 11:38.010] we're done. More or less my water break. So the biggest pains for logging as a lot of us have [11:38.010 --> 11:41.990] faced is that we're getting a lot of log data from a bunch of different sources that come in [11:41.990 --> 11:47.390] all these different formats and all these different timestamp formats and sometimes they're [11:47.390 --> 11:50.030] this, sometimes they're that, and we've got to parse them, we've got to actually make sure we [11:50.030 --> 11:57.090] have the accurate time for them. And so the Logstash processor actually tries to do that. So [11:57.090 --> 12:03.910] this is a look as to how Logstash processes its data. So from a shipper perspective, that's [12:03.910 --> 12:08.970] kind of your Syslog agents, your Logstash agents that are basically generating those logs [12:08.970 --> 12:13.330] and sending it to a central source. You have a broker which basically queues everything up so [12:13.330 --> 12:18.030] it can process it as fast as possible and distribute that job across. You have an indexer [12:18.030 --> 12:24.430] that looks at it, does the analysis of what is this log, how do I parse it, how do I tag it, [12:24.430 --> 12:28.450] and where do I ship it, and sends it off to search and storage, and then you've got the pretty [12:28.450 --> 12:31.190] little web interface to actually monitor everything. This sounds kind of familiar to a lot [12:31.190 --> 12:36.370] of other products out there. But the cool thing with Elasticsearch and with Logstash is that [12:36.370 --> 12:41.290] you can scale it. So instead of just having one system, you know, you may be logging 10 [12:41.290 --> 12:45.730] gigs of data a day and then next week you've got to log 100. Obviously the whole title of [12:45.730 --> 12:50.390] the talk is log all the things. You know, I'll start on the ramble about generating logs [12:50.390 --> 12:54.810] later, but the more data we have, the more we can actually do actionable intelligence for [12:54.810 --> 13:00.190] it. So to scale it up, all you have to do is take those little individual parts and split [13:00.190 --> 13:04.570] them across more systems. So you can take and split the broker across multiple systems [13:04.570 --> 13:08.610] to queue everything up and have a little more redundancy. You can take the Logstash [13:08.610 --> 13:13.130] indexer and split it up across multiple systems to actually process those logs. And then [13:13.130 --> 13:18.170] your Elasticsearch cluster obviously can grow as well for the storage and the searching. So [13:18.170 --> 13:23.590] as I previously said, we're going to focus on really the aspects of collecting and [13:23.590 --> 13:27.450] shipping logs, storing logs, processing, monitoring them, and searching them. And [13:27.450 --> 13:32.170] obviously there's that generating log component as well. So first things first, the [13:32.170 --> 13:36.130] biggest reason a lot of us don't generate the logs we need to is because we're using some [13:36.130 --> 13:41.450] commercial product and paying based upon how much we generate. That doesn't really work [13:41.450 --> 13:45.510] well for security and for monitoring because you're starting to get in the case of picking [13:45.510 --> 13:50.490] and choosing before you get the intel. So my theory is we should build something that we [13:50.490 --> 13:54.910] can collect all the logs we want and the only cost to us is more disk space and more [13:54.910 --> 14:04.400] processing power, which is now relatively cheap compared to other things. So in order to [14:04.400 --> 14:09.200] collect the logs, Logstash has the thing called inputs. And so we can use our traditional [14:09.200 --> 14:15.840] syslog that everyone has fun and is familiar with, the archaic syslog of text. We can also [14:15.840 --> 14:20.560] leverage Logstash's agent, Lumberjack, which is a thinner version that actually can do the [14:20.560 --> 14:25.160] parsing of the data on the clients. And we can also do time queries as inputs, and I'll [14:25.160 --> 14:29.600] touch on that in a second. So going through kind of the different systems you typically [14:29.600 --> 14:35.500] have to face for your Linux, Unix and Mac logs, obviously you can leverage syslog agents [14:35.500 --> 14:41.360] just as is and send that data to Logstash. Or you can also leverage the Logstash agent, [14:41.360 --> 14:44.780] which is Java based. Now obviously you have to do that tradeoff of do I want to install [14:44.780 --> 14:54.340] Java or do I want to just send it with syslog? Syslog. So it also supports TLS as well, so [14:54.340 --> 14:58.160] for those of you who are like, oh, UDP, syslog, it will lose stuff, it's not encrypted. It [14:58.160 --> 15:03.960] does support TCP and TLS. So the good old Windows logs that everyone has a hiccup on [15:03.960 --> 15:07.100] and everyone is making their money off of because there's no good solution out there [15:07.100 --> 15:15.340] for Windows logging agents. You're able to do it with obviously Windows Logstash agent. [15:15.340 --> 15:20.500] Again, you'll be installing Java on systems. Or there are syslog agents that are available, [15:20.500 --> 15:26.120] open source, free, and community editions of them online. So NX log is a great one that [15:26.120 --> 15:31.320] basically takes whatever you're sending in, files, or Windows event logs, sends it off to [15:31.320 --> 15:36.580] syslog. And same thing for Snare's open source edition. Now both of these agents, NX log [15:36.580 --> 15:41.160] and Snare have commercial versions, so before you go, Zach, they have a paid version. They [15:41.160 --> 15:46.160] also have an open source community edition. It just doesn't have as much pretties. And [15:46.160 --> 15:48.900] then obviously the third option for those of you who are banging your head about Windows [15:48.900 --> 15:53.100] logs and how do you deploy this across your environment is to just use Windows built in [15:53.100 --> 15:57.420] event collector. Using Windows event collector and one Windows system to kind of collect [15:57.420 --> 16:02.040] all those logs, use that central event collector system to parse the logs and then ship them [16:02.040 --> 16:06.520] off over syslog. That way you can easily deploy it with a group policy and not have to worry [16:06.520 --> 16:13.620] about installing software on all your production systems. And then obviously the device logs, [16:13.620 --> 16:18.560] your network devices, your storage devices, your traditional syslog works well, but what's [16:18.560 --> 16:22.800] one of the cool things about log stash is it also offers SNMP traps as well. So you're [16:22.800 --> 16:27.120] able to just send SNMP traps to it and it's able to parse that and push it into the logging [16:27.120 --> 16:32.700] complex. You can also send raw socket data and it will be able to parse whatever it has [16:32.700 --> 16:38.660] coming in. And then able to make exec calls, which I'll touch on in a second. But most [16:38.660 --> 16:43.060] importantly, a lot of times we focus on just the operating system logs and the application [16:43.060 --> 16:47.620] logs get fed into the syslog complex. But one of the biggest things we miss is these [16:47.620 --> 16:54.120] application logs. So we need to log more than just the defaults, hey, I requested this [16:54.120 --> 17:01.720] page, moving on. Leveraging web app logs and integrating into the web app code with your [17:01.720 --> 17:05.580] development team to generate, hey, I saw a password change, this seems weird, oh, we just [17:05.580 --> 17:10.340] got a bunch of sessions that didn't exist, send something into the main logging complex. It [17:10.340 --> 17:14.120] creates a single source for you and the rest of the security teams out there to kind of [17:14.120 --> 17:19.040] monitor everything. Instead of having all these different aspects to pull. And obviously [17:19.040 --> 17:23.100] you can generate from those applications the usual text files depending on what [17:23.100 --> 17:30.380] application you're using. Or use Redis to queue up the logs and pretty much anything. One of [17:30.380 --> 17:34.200] the nice things about Logstash is the ability to pull from any source and write your own [17:34.200 --> 17:38.320] plugins. That would be a whole different talk for a whole other day so we won't get too far [17:38.320 --> 17:48.680] deep in there but it's an option. So what about the cloud? We're going to drink every time I [17:48.680 --> 17:58.880] say the cloud. So what about the cloud? Cyber, cyber, cyber. If you're playing at home, I [17:58.880 --> 18:06.260] don't see many people playing at home. It's afternoon, yes. So more and more providers who are [18:06.260 --> 18:08.720] offering cloud infrastructures and a lot more people are moving to these cloud [18:08.720 --> 18:12.420] infrastructures are offering the ability to grab the audit logs without having to do a [18:12.420 --> 18:18.080] formal request. So a lot of people aren't monitoring this. You know, recently, I'm trying to [18:18.080 --> 18:24.520] remember the name, code someone fill me in, that had their AWS instances completely. Thank [18:24.520 --> 18:29.820] you. Codespaces. Codespaces recently had one under an AWS attack and yes we can argue [18:29.820 --> 18:32.560] over how their infrastructure was actually set up, that they should have had their backups in [18:32.660 --> 18:40.860] a whole different environment that wasn't AWS. But we aren't monitoring those logs there. We're [18:40.860 --> 18:46.460] pushing all of our emails, not we all, but a lot of places are pushing these logs and this [18:46.460 --> 18:52.300] data out everywhere and not monitoring it. We're not monitoring who's logging into our Google [18:52.300 --> 18:56.120] apps account. Someone could be sitting there for months or logging in from some other [18:56.120 --> 19:01.140] geolocation that doesn't normally log into. No one is checking AWS to see who's got our [19:01.140 --> 19:05.380] API key that may have accidentally ended up somewhere. Something seems weird. So some of [19:05.380 --> 19:11.100] these services started offering the ability to actually take and grab these logs from AWS, [19:11.100 --> 19:17.680] Google apps, box, sales force, but others aren't yet. So these are kind of a top gear, top [19:17.680 --> 19:22.140] tip of different options for logging if you want to start pulling logs from these cloud [19:22.140 --> 19:33.400] services. So AWS has cloud trail. Thank you. The gentleman is keeping me honest. Thank you, sir. [19:34.420 --> 19:42.720] AWS has trail, which basically takes event logs every five minutes and pushes them into an S3 [19:42.720 --> 19:48.440] bucket. Log stash is able to pull those S3 buckets and parse those logs. Google apps has [19:48.440 --> 19:51.820] their reports API, which is basically an API you can make queries against. Box has their [19:51.820 --> 19:57.800] events API. And sales force has log in history now. But correct me if I'm wrong, but [19:57.800 --> 20:02.460] office 365 currently doesn't offer any kind of live parsing. You can request them, but that [20:02.460 --> 20:06.740] doesn't help you with monitoring it. Drop box, same thing. You can see it through their [20:06.740 --> 20:11.340] dashboard, but you can't have any kind of API access to it. And GitHub, I have yet to find [20:11.340 --> 20:14.880] any kind of logging other than enterprise. And more and more people for some reason think [20:14.880 --> 20:20.040] it's a good idea to push all your enterprise code into GitHub. I love GitHub, don't get me [20:20.040 --> 20:25.960] wrong, but I think it's kind of a bad idea to push everything out there. So as I said, log [20:25.960 --> 20:30.040] stash can pull from these from either an exec or from a built in input. Now you may be like, [20:30.040 --> 20:33.380] okay, you're talking about all these inputs, what are they? This is a list of the current [20:33.380 --> 20:40.940] version of inputs. And there's a lot that are, we'll call them alpha. And we'll touch on that [20:40.940 --> 20:44.480] later. But there's a lot that have been established, tested and well rounded. So as I [20:44.480 --> 20:50.240] said, you have exec. Exec will let you run any kind of shell script, any kind of Ruby script, [20:50.240 --> 20:55.280] any kind of command whatsoever, take whatever the output is and send it into the logging [20:55.280 --> 21:00.020] infrastructure. So you can customize exactly how you want to get that log data. You know, [21:00.020 --> 21:04.260] if you don't have a traditional source of data, you can start querying other APIs. And in [21:04.260 --> 21:08.480] fact, you may see also on that list, there's a Twitter plugin. You can have it monitor the [21:08.480 --> 21:12.680] Twitter stream for mentions of something, hashtags, whatever, and put that into your [21:12.680 --> 21:17.220] logging complex. I think that's pretty cool. That you're able to be like, oh, create a [21:17.220 --> 21:24.000] security event, somebody just doc dropped this. So as I said, it's got the S3 input, it's [21:24.000 --> 21:27.720] got exec and it's got a few other things in there and the SNMP trap as well. So those are [21:27.720 --> 21:38.100] the different inputs. So as I said, traditional inputs, you can still use the Syslog to [21:38.100 --> 21:43.740] collect the events and Redis and all those other agents. But the idea is then, do you really [21:43.740 --> 21:49.160] trust this somewhat young product? By the way, I did mention Logstash is now part of Elastic [21:49.160 --> 21:53.940] Search and their whole parent family. So they have commercial support behind them. But do you [21:53.940 --> 22:00.800] really trust this new Java based application with all your logs all the time? So yeah, if [22:00.800 --> 22:04.600] you're one of those people who live on the wild side like me, you can send it straight to [22:04.600 --> 22:08.500] Logstash and just be like, here, have fun. But you can also take and build a logging [22:08.500 --> 22:13.040] complex where you're able to send these logs and parse these logs in different ways. So my [22:13.040 --> 22:16.860] recommendation is always, if you don't really trust it, you can always build up an R [22:16.860 --> 22:22.280] Syslog or Syslog NG layer of basically send the logs to the Syslog system first, then send [22:22.280 --> 22:27.320] it to Logstash and then also send it to Hadoop for storage or send it traditional files for [22:27.320 --> 22:30.920] storage. So you still have that retention and you still have that log being archived [22:30.920 --> 22:37.900] elsewhere, but you also have all the cool new pretties that Logstash offers. So once Logstash [22:37.900 --> 22:44.540] has all these events, what do you do with them? Projects kind of is awesome and sucks at [22:44.540 --> 22:50.100] the same time. It's awesome because you can do anything with it. It sucks because you can [22:50.100 --> 22:54.700] do anything with it and you have to learn how to do anything with it. So Logstash has [22:54.700 --> 22:58.920] decided to create this thing called, this parsing engine called Grok. It still supports [22:58.920 --> 23:04.220] regex, it still supports traditional grep statements, but Grok is pretty awesome as it [23:04.220 --> 23:09.940] simplifies not having to know regex. They have prebuilt all these different syntaxes in [23:09.940 --> 23:15.960] here and I'll go through examples in a second. This is just probably 10% of them. But if you [23:15.960 --> 23:22.300] want to map an IP address, a user name, a log status level, you're able to do that with [23:22.300 --> 23:33.060] just saying what the syntax is. So you would just say word or data. It makes life easy. So [23:33.060 --> 23:37.500] even those who are not super technical with regex are able to write a pattern this [23:37.500 --> 23:42.840] quickly to parse Apache logs. And this is really it. I mean, as soon as you get an input, [23:42.840 --> 23:46.700] obviously you need to have the input in there too. But this is it for the filter. Combine [23:46.700 --> 23:52.360] Apache log. Done. It parses it. Happy days. What about more complex data? Stuff that [23:52.360 --> 24:00.900] doesn't really fit in existing syntax? Let's take this as an example. We have a typical [24:00.900 --> 24:08.200] PAM notification. This is raw sys log data that I generated August 8th. You do the math. [24:09.600 --> 24:16.220] Basically it's typical, hey, PAM detected someone log in. Now this may look a little [24:16.220 --> 24:19.940] complicated, but really I'm doing two levels of parsing here. And this is an actual working [24:19.940 --> 24:25.180] config and I'll be posting more later. But this is all you have to do in order to parse it. [24:25.180 --> 24:30.980] First we parse to see is it a PAM message. So we look for the PAM UNIX flag. Say grab all the [24:30.980 --> 24:35.280] data. Pick what module. Pick what phase it's coming from. Is it authentication? Is it [24:35.280 --> 24:40.000] authorization? And then once you tag it, you know, as you can see in there, there's those [24:40.000 --> 24:45.220] add tags, add tag for PAM, add tag for log in. So you can do filtering and pondering for it. [24:45.780 --> 24:49.020] Once you tag it with that, you can easily then say, all right, let me grab all the other [24:49.020 --> 24:52.880] data out of it. I want to grab the user, I want to grab the session ID, I want to grab the [24:52.880 --> 24:59.980] remote host. And that's it for the regex and it gets parsed. And you're able to take, and [24:59.980 --> 25:05.140] here's a quick from Elasticsearch of it parsing into all the different fields. And [25:05.140 --> 25:10.020] without having to know all this crazy regex to figure out, oh, we got a missing case here, [25:10.020 --> 25:14.040] you're able to quickly say, all right, grab the data, put it into this format, and it's [25:14.040 --> 25:19.460] pretty easy to figure out how to start parsing and filtering your logs. But that's not all [25:19.460 --> 25:23.920] the filters it has on the way in. We can tag metrics with it. We can track to see, all [25:23.920 --> 25:27.160] right, let's grab everything that has a failed log in and start assigning a metric to it and [25:27.160 --> 25:31.920] know how many failed log ins we have for this IP or this user over a one minute, five [25:31.920 --> 25:37.500] minute, 15 minute, one hour window. We can get GUIP information in it with the filters as [25:37.500 --> 25:42.460] well. Those pretty graphs like I was saying your bosses love. I don't know why people love [25:42.460 --> 25:48.540] seeing that. We have a bunch of attacks coming from this other country. Did they get in? No, [25:48.540 --> 25:56.520] but we have a bunch of attacks. You're on the internet, bro. But management for some reason [25:56.520 --> 25:59.960] loves that. So you can give them those pretty little graphs. You can do GUIP tagging and pull [25:59.960 --> 26:04.700] from the GUIP databases. You can do reverse DNS lookups to make your matches easier if you [26:04.700 --> 26:09.460] have a dynamic environment or just want to start logging that data. And then there's URL [26:09.460 --> 26:15.460] decode so you can take a decode if you have a URL inside of a URL. You can do multiline data [26:15.460 --> 26:19.560] so if it crosses more than one line you can do key value. So if it's a situation as you saw in [26:19.560 --> 26:24.160] the previous one of our host equals, action equals, you can just say key value it and it [26:24.160 --> 26:28.420] parses all that automatically. And the coolest thing is it can do anonymize. So if you [26:28.420 --> 26:34.700] happen to not be here in the U.S. and have to not store data of people, you can anonymize that [26:34.700 --> 26:40.180] data as soon as it comes in with random data, hash data, however you can take and sanitize [26:40.180 --> 26:44.720] that. So for those of you who have to deal with European laws or other laws that say you can't [26:44.720 --> 26:52.770] actually store this after so long. So after you filter all that data, Logstash can output it [26:52.770 --> 26:57.910] to pretty much anywhere. Traditionally people will send it to Elasticsearch for monitoring [26:57.910 --> 27:01.570] and searching and that's what we're going to cover next. But you can send it to different [27:01.570 --> 27:07.870] indexes just like you can with other large logging products. You can also do what's really [27:07.870 --> 27:14.470] cool is called exec. So with exec, if you see a certain set of flags or you parse it out and [27:14.470 --> 27:19.710] filter it out, you can take and go, oh, this looks interesting. I wanted to do something every [27:19.710 --> 27:24.090] time I see this. But I don't want an email. I wanted to, I don't know, automatically block [27:24.090 --> 27:28.350] something. You can just make an exec call to whatever script. I'll touch on some cool things [27:28.350 --> 27:32.270] later. If you're like me and you don't want to keep changing your filters and want to [27:32.270 --> 27:37.430] dynamically change how things are, you can make a simple web call to some other monitoring [27:37.430 --> 27:42.150] app that you wrote and say, hey, I saw a bunch of odd things or I saw a log in from this IP. [27:42.730 --> 27:47.130] Do something with that. And write up a web app, instead of having to script and write all [27:47.130 --> 27:51.530] this stuff and keep restarting your filters, you can just say, send all this log in [27:51.530 --> 27:57.790] information to this other web source and tell me if I should generate any kind of alerts. If [27:57.790 --> 28:01.910] you're someone who sits on chat all day, you can send it as into your chat logs. I don't [28:01.910 --> 28:06.750] think there's an IRC output, which I was kind of disappointed in. If you're a user of [28:06.750 --> 28:09.910] PagerDuty, you can send it there or your traditional email notifications that go in that [28:09.910 --> 28:21.370] bucket you never monitor. So, as I was saying, you can filter, you can parse, you can [28:21.370 --> 28:24.910] do all this fun stuff. What do we care about? We're sending it to this place and we're [28:24.910 --> 28:27.550] not monitoring it. As I said, the biggest important thing is for us to actually monitor [28:27.550 --> 28:33.370] these security events. So, as I was saying, we sub filter some parts of stuff, we tag them, [28:33.370 --> 28:37.490] saying this is a security event, this is a compliance event, this is a fail log in, [28:37.490 --> 28:41.570] success log in. We can create all the tags you want. Add metrics if you want to see if [28:41.570 --> 28:45.490] there's too many fail log ins over a certain window. You pick the output and then you can [28:45.490 --> 28:51.630] scale. So here are two simple outputs that I wrote together real fast that shows if it's a [28:51.630 --> 28:58.530] fail log in and it's been over two for this specific user within a minute, send me an email. [28:59.110 --> 29:05.670] That's how simple it is. If you want to send it, like I was saying, all the auth requests, [29:05.670 --> 29:08.610] you want to send it to some other source to dynamically determine, hey, I wrote this cool [29:08.610 --> 29:13.030] little PHP app that will tell me if you send it the IP and the user name, it will determine [29:13.030 --> 29:17.490] if it's new. If you're more comfortable with some other language, Ruby, whatever, send it [29:17.490 --> 29:21.730] there. You can start sending these kind of actions elsewhere that traditional logging [29:21.730 --> 29:28.830] complexes can't do. Yes, some commercial products support this as well. But this one's free. [29:30.590 --> 29:34.930] So in the second example, obviously, any time there's an auth request that's tagged as an [29:34.930 --> 29:39.650] auth request after we do all those filters, send it to whatever. That's not actually real, [29:39.650 --> 29:45.510] so don't go trying to query that. You're not going to get anything. And send it a post. So [29:45.510 --> 29:48.870] this is what I'm saying, we can do these execs, we can do these remote calls. As a security [29:48.870 --> 29:53.770] people, this is awesome. We can have it do whatever we want automatically. We can have it [29:53.770 --> 29:58.230] update, again, this is for those who like to live dangerously on the end. You can have it [29:58.230 --> 30:02.690] automatically update firewalls, switches. Oh, I see someone new join the thing. I don't [30:02.690 --> 30:07.910] have a traditional NAT complex. Go ahead and tell it to disable switch port. Cool, exec, [30:07.910 --> 30:11.750] da, da, da, wrote this cool script, done. You're able to do that with this new logging [30:11.750 --> 30:17.450] complex. Notify a user directly, hey, somebody logged in from a new IP address and this [30:17.450 --> 30:21.790] looks weird or it's not from within the U.S. or whatever country you're from, hey, this is [30:21.790 --> 30:25.790] weird for them, let me send that user an email and make it their responsibility to go, hey, [30:25.790 --> 30:30.390] security, something's up, I didn't log in. You don't have to monitor that all and you can [30:30.390 --> 30:34.630] start using your logging complex to generate those kind of alerts directly to your users. [30:35.770 --> 30:40.030] Obviously notify for admin logins, both on an internal and external side. One of the [30:40.030 --> 30:43.910] greatest things pen testers will talk about is, oh, I got admin on all these systems, oh, [30:43.910 --> 30:48.350] yeah, it crawled across the environment. Why aren't we logging and detecting that? Admin [30:48.350 --> 30:51.870] shouldn't be logging in remotely typically and why not generate events for people to [30:51.870 --> 30:57.570] follow up on them? And then obviously for user logins on new machines, hey, Jim doesn't [30:57.570 --> 31:01.310] normally log in this machine and I haven't seen this before, I'm going to generate an event. [31:01.310 --> 31:06.950] And this is easy to do then with these filters, with these custom outputs that some other [31:06.950 --> 31:10.910] logging complexes don't support. So, again, we've got the monitoring, we've got the [31:10.910 --> 31:15.510] collection, we've got the storage. What about the searching? That's one of the biggest [31:15.510 --> 31:19.910] problems with traditional syslogs is that you have to run, grab, awk, run through this text [31:19.910 --> 31:26.390] file, wait, wait, wait, wait, go through 10 gigs, come on, give me something. So, since it's [31:26.390 --> 31:31.270] based on Elasticsearch, the crew over at Elasticsearch is complex has this pretty little [31:31.270 --> 31:35.830] front end called Kibana. Kibana pretty much looks like every other logging searching thing [31:35.830 --> 31:40.490] you can ever imagine. And you're able to quickly search for the events, correlate the [31:40.490 --> 31:43.330] events, and go through there. I'm not going to go too far into Kibana because you're going to [31:43.330 --> 31:47.510] create all these pretty custom dashboards, you can go through and have a pretty map for [31:47.510 --> 31:58.430] the management, as we were saying, your boss loves them. But no, I mean, get a raise, [31:58.430 --> 32:05.070] sorry. But so, this works great. But that's all the pretty dashboards, you can do all the [32:05.070 --> 32:08.310] searches, really, like I said, we're focusing on the security side, getting those alerts, [32:08.310 --> 32:13.610] getting that notification. But you may be going, for those of you who know what Elasticsearch [32:13.610 --> 32:21.850] is, may be going, dude, Elasticsearch, really? That shit kind of not has any security [32:21.850 --> 32:26.390] controls whatsoever. Yeah, it does not have security controls whatsoever. You have to build [32:26.390 --> 32:30.370] them. So as I said, it's not an easy solution, but it's one that you can scale and [32:30.370 --> 32:34.590] customize greatly. So Elasticsearch is made so that basically you can cluster with [32:34.590 --> 32:39.210] everything, multicast to figure out all the other peers, doesn't have authentication, just [32:39.210 --> 32:43.990] trust everyone, gives everyone pseudo rights. Yeah, it's bad, from a security perspective. [32:43.990 --> 32:46.810] But it's great from a data perspective. So we have to build in these security controls on [32:46.810 --> 32:51.290] top of that. We have to write an NGX proxy in order to bind locally, really simple [32:51.290 --> 32:55.730] configure. Have to segment the stuff off on the network so it doesn't take a multicast [32:55.730 --> 33:01.390] everywhere else. Again, simple change. And you need to enable some logging on your NGX [33:01.390 --> 33:05.210] front end that you're doing the proxy for. Again, for compliance reasons and for the [33:05.210 --> 33:09.770] tracking of that. Again, simple configs. But everyone who's like, oh, you can't use that [33:09.770 --> 33:16.210] because of security reasons, you just have to add a few additional controls. Now from a [33:16.210 --> 33:21.350] performance side, you can tweak, obviously, a lot more when you build your own system. So [33:21.350 --> 33:25.070] you can take in a tweak if you're starting to scale up the size of your indexes, [33:25.070 --> 33:29.770] sometimes by default Logstash and Elasticsearch do daily indexes, but if you start [33:29.770 --> 33:35.030] logging, I don't know, 200 gigs a day, a 200 gig index is kind of a bad thing. So you can [33:35.030 --> 33:40.010] start changing the size of your indexes to hourly, minutes, so on and so forth. You can [33:40.010 --> 33:43.390] increase the number of workers in Logstash in order to parse that stuff faster. You can [33:43.390 --> 33:48.130] enable compression in Elasticsearch and you can enable queuing for the network traffic [33:48.130 --> 33:53.570] coming in. And again, the whole point of this is so you can scale. You know, the [33:53.570 --> 33:57.590] traditional systems you can't scale, you can't cluster, it's not fault tolerant. You can [33:57.590 --> 34:01.590] easily scale up with Logstash, Elasticsearch, and Kibana by spinning up more instances of [34:01.590 --> 34:06.730] Elasticsearch, spinning up more instances of Logstash, and as I was saying, putting more [34:06.730 --> 34:10.030] steps in front of it that can kind of distribute and spin it out, and they recommend [34:10.030 --> 34:13.950] Redis, works well if you put Logstash in front of Logstash. I know it doesn't make sense, [34:13.950 --> 34:19.470] but it does. So the question you all have is, is it as good or better than a vendor? You're [34:19.470 --> 34:22.250] up here preaching, you should look at open source stuff and you should take and do [34:22.250 --> 34:26.970] something different than just buy a product. Is it better? It's your call. I mean, if you [34:26.970 --> 34:32.530] have the technical ability or the team who has the technical ability or coworkers, yeah, it [34:32.530 --> 34:36.610] works well and it doesn't come at the licensure cost of other things, but it's not easy to [34:36.610 --> 34:41.950] manage as a paid solution. And still very relatively young, so there may be bugs you [34:41.950 --> 34:46.310] encounter. So if you're sitting there with critical logs, you cannot lose it all, you may [34:46.310 --> 34:50.190] want to look at someone who's a little more established or, like I was saying, add a few steps [34:50.190 --> 34:55.070] in there to send it off to multiple storage locations. And it lacks authentication out of [34:55.070 --> 34:58.790] the box, again, something you can easily change, but you'll hear people shaking their stick at [34:58.790 --> 35:05.550] that saying you've got to be able to authenticate to it. Entry proxy, HTTP password, done. But [35:05.550 --> 35:11.270] on the flip side, it's extremely customizable, the price is just right, and some enterprise [35:11.270 --> 35:25.680] support is available. And you can even use it in the cloud. I had to whet my whistle there. So [35:25.680 --> 35:30.500] what's next? I just rambled here about how great this thing is, what's next? We have this [35:30.500 --> 35:35.200] little thing as much as, okay, I'm ready for the boo and the hiss, but we call it the open [35:35.200 --> 35:42.480] PCI project, the domain hack PCI also works for some reason, I don't know why. But basically [35:42.480 --> 35:46.680] the idea of that, there shouldn't be any secrets as to how to secure stuff. People have [35:46.680 --> 35:50.860] been selling this whole magic bean of, oh, we can give you these configs and keep [35:50.860 --> 35:57.060] reselling them. They're configs, guys. We can share that information. It doesn't provide [35:57.060 --> 36:01.060] any kind of competitive advantage. In fact, it just makes things easier for all of us. So we [36:01.060 --> 36:06.500] have this thing called the open PCI project. It needs an update for all this stuff, but I [36:06.500 --> 36:13.540] will get that soon. As soon as possible. But basically to take and share this information, [36:13.540 --> 36:18.400] and we'll take and share all the configs, the base parsing, a VM that's ready to go that you [36:18.400 --> 36:22.920] can just spin up right away. And obviously the hardening guides, as I was saying, elastic [36:22.920 --> 36:28.340] search and secure by default. Some hardening guides and configs are just here. It works. [36:28.340 --> 36:33.540] Great. Awesome. To make it as close as similar to these large commercial products, but [36:34.260 --> 36:40.520] obviously you need a little more hands on support. So with that, I'm ending a little bit [36:40.520 --> 36:44.780] early, I'm sorry, but I'll let you guys get in line for the next talks here. But that's me, [36:44.780 --> 36:50.180] that's the talk about all that stuff and all in all log stuff. Fuck companies that sue [36:50.180 --> 36:56.580] people for legal pressure for giving talks about stuff they don't want. And that's it. Thanks [36:56.580 --> 36:57.280] all.