WEBVTT

00:00.000 --> 00:02.120
Good morning, party track.

00:02.120 --> 00:03.180
How are we doing?

00:03.620 --> 00:04.820
Yeah!

00:05.660 --> 00:06.700
All right.

00:06.700 --> 00:09.900
How many people here came to hear about home alarm systems?

00:10.880 --> 00:12.340
All right.

00:12.340 --> 00:14.960
You're not going to hear about home alarm systems.

00:15.800 --> 00:18.180
Oh, sorry.

00:19.800 --> 00:23.940
The speaker had a small problem with his employer.

00:25.580 --> 00:28.300
So that talk is not going to happen.

00:28.540 --> 00:32.560
But I can guess and I'll summarize it even though I haven't read the talk.

00:33.220 --> 00:35.400
Your home alarm system is kind of fucked.

00:37.160 --> 00:37.960
All right.

00:41.830 --> 00:46.010
So with that out of the way, let's figure out a bonus talk then, right?

00:46.210 --> 00:47.570
So this is my good friend Zach.

00:47.570 --> 00:48.910
We go back a long way.

00:49.050 --> 00:55.370
And he's going to give you the most entertaining and exciting talk about logs that you're going to see all day.

00:55.610 --> 00:59.490
So let's give Zach a big party track welcome.

01:05.880 --> 01:08.660
It's the most exciting one because there's no other one.

01:08.780 --> 01:13.960
So before we get started, as Juris was saying, this is Logan.

01:14.060 --> 01:15.260
Everyone say hi, Logan.

01:16.540 --> 01:21.940
He was the one who was originally supposed to speak at this slot about the insecurities in home alarm systems.

01:22.200 --> 01:27.220
And you may have seen a few articles, you know, hit up on a few different sites about his talk.

01:27.220 --> 01:32.220
But last week this article came out and it sounds like he had to cancel.

01:32.220 --> 01:33.500
Ergo why I'm here.

01:34.740 --> 01:37.240
More recently NPR actually did an article.

01:37.380 --> 01:38.520
They actually got time with him.

01:38.520 --> 01:43.440
I pinged him a few times to see if he wanted to actually share some information that he could share.

01:43.740 --> 01:44.580
But didn't respond.

01:44.580 --> 01:49.200
So I just want to post this NPR article real quick because that summarizes pretty much what happened.

01:50.140 --> 01:56.200
He was supposed to be on stage but because of the pressures put on him he can't.

01:56.880 --> 02:00.040
So I'm just going to leave those names up there for a second.

02:03.820 --> 02:05.100
And we're moving on.

02:05.740 --> 02:12.640
So in honor of Logan, because he couldn't make it, I decided to start our new meme.

02:12.640 --> 02:14.700
Ridiculously good looking researcher.

02:16.300 --> 02:19.600
Has to pull talks, still impresses us all with his smile.

02:22.270 --> 02:23.310
So I'm going to give you a talk.

02:23.310 --> 02:24.990
And this is your top gear, top tip.

02:24.990 --> 02:32.910
If you're going to do this and get your talk pulled, pro tip number one, follow responsible disclosure if you're feeling nice.

02:34.150 --> 02:39.330
Tip number two, don't name the vendor in a press release unless your goal is to get your talk pulled.

02:40.990 --> 02:48.530
And if you're going to give the talk and you're worried about legal action, go ahead and up a skate.

02:49.470 --> 02:50.710
And make sure you sell the job.

02:50.710 --> 03:01.770
So top gear, top tip, if you're going to do what Logan did for the future, for those of you who may be considering, I don't know, doing his talk or a similar talk in a future venue, you might want to follow that.

03:01.770 --> 03:04.630
So instead you get me logging by Zach.

03:12.340 --> 03:14.320
This is party track, isn't it?

03:18.520 --> 03:19.320
Good.

03:20.060 --> 03:27.060
So I always like to start the talks off with what this talk is and what this talk is not so you don't have to spend the next 45 minutes listening to me ramble.

03:28.200 --> 03:30.820
So first and foremost, this is going to be a defense focused talk.

03:30.820 --> 03:34.320
So if you're looking for some sexy Oday, you're not going to find it here .

03:35.540 --> 03:40.940
We're going to be talking about collecting, storing, monitoring, parsing, having fun with logs.

03:41.720 --> 03:43.040
And we're going to try to make it fun.

03:43.340 --> 03:48.020
And the big reason I'm giving this is because it's a reoccurring problem we keep having over and over and over.

03:48.560 --> 03:51.300
We're not getting good logging systems put together.

03:51.300 --> 03:53.640
We're not getting good logging data in most situations.

03:53.640 --> 03:57.480
Sure, you may be the 1% here who's like, yeah, I got this shit covered.

03:57.480 --> 03:58.940
This talk is not for you.

03:59.980 --> 04:07.020
And if you know what ELK stands for and you are an ELK rock star, you may want to go get a few minutes elsewhere.

04:07.020 --> 04:13.820
But this is going to be probably a 200, 300 level talk on logging and big logging environments.

04:14.200 --> 04:19.340
So as I said, this is not a talk about hacking your alarm systems and the wireless problems with them.

04:20.100 --> 04:26.620
This is not an offensive security talk and I'm not going to be addressing challenges of dealing with over 200 gigs of log data a day.

04:26.620 --> 04:30.320
That's going to be a whole different barrel of monkeys to deal with.

04:31.740 --> 04:33.100
So who am I?

04:33.100 --> 04:35.180
My name is Zach, as we've already covered.

04:36.060 --> 04:37.960
I'm a magic partner over at Urbane.

04:37.960 --> 04:39.140
I hail from Chicago.

04:39.140 --> 04:40.600
I do things and stuff.

04:42.140 --> 04:44.560
And everyone has their big slide of credentials.

04:44.560 --> 04:45.600
This is mine.

04:49.450 --> 04:50.510
Moving on.

04:50.850 --> 04:58.770
So let's face it, you know, offensive talks can get up here and ramble about the cool hotness for a full hour about how awesome things are.

04:59.150 --> 05:01.670
But really, we're not going to use a lot of that stuff.

05:01.670 --> 05:05.270
Yeah, it's cool to hear about, you know, the insecurities and this and that.

05:05.270 --> 05:09.930
But when we come back to our day jobs back at home, we've actually got to deal with protecting stuff.

05:10.530 --> 05:14.530
So the vast majority of us actually need more defensive talks.

05:14.530 --> 05:18.550
I figured I would take and make it my initiative to start looking a little more on the defensive side.

05:18.550 --> 05:21.490
So let's start with logging.

05:21.950 --> 05:23.830
I'm going to say it with an Irish or Boston accent.

05:23.830 --> 05:24.530
I don't know.

05:25.290 --> 05:26.770
So we still have a logging problem.

05:26.770 --> 05:31.090
We're still relying on log data and log formats that are archaic.

05:31.170 --> 05:40.110
And we've seen, you know, from me and my consulting role and from a lot of other people, we've seen that, you know, the tech community has this figured out, but not from a security perspective.

05:40.130 --> 05:43.410
Their focus has been on, you know, we want to know if there's errors.

05:43.410 --> 05:45.610
We want to know what user habits are.

05:46.410 --> 05:48.850
But InfoSec hasn't really figured it out.

05:48.850 --> 05:55.130
I don't know if it's because we're lazy or because we haven't taken the time to look at it, but I figured let's dive into it a little bit more.

05:56.190 --> 06:00.210
So kind of what we're going to cover today, we're not going to talk about generating logs, because that's easy.

06:00.210 --> 06:02.930
I could give you a configuration file and we could call it a day.

06:03.230 --> 06:05.730
I'm not going to fill 45 minutes of explaining a config file.

06:05.730 --> 06:08.690
It will put you all to sleep, even if there's music here at party track.

06:09.610 --> 06:11.790
We're going to talk more about the collecting logs.

06:11.790 --> 06:19.610
We're going to talk about storing, processing, and most importantly, the actual monitoring and security events for logs.

06:21.150 --> 06:25.510
Here's the obligatory why do we need logs, because, oh, I'm just storing them.

06:25.910 --> 06:27.750
It goes beyond just security.

06:27.750 --> 06:34.830
You know, we need it just from a management perspective to convince our bosses that we're doing what we're doing and we're doing it right.

06:35.470 --> 06:39.690
A lot of times we have to deal with this compliance stuff.

06:42.270 --> 06:46.910
Full disclosure, I'm a QSA now and I cannot say anything about it.

06:47.490 --> 06:51.330
So it's not out of choice.

06:51.670 --> 06:56.130
So long story short, yeah, compliance is going to be a driving force a lot of times for stuff.

06:56.130 --> 07:04.970
And we can use that also from a security point of view of going, hey, I've got to meet this ISO, PCI, HIPAA, whatever it may be, whatever you have to deal with.

07:05.210 --> 07:10.390
We can use that to say, hey, I need a little money, I need a little time to actually do the cool security stuff I want to do.

07:11.990 --> 07:14.610
We need it from the security perspective, duh.

07:14.670 --> 07:15.950
For instance, response, duh.

07:15.950 --> 07:19.310
And from a technical operation side , as I said, DevOps has this figured out.

07:19.370 --> 07:22.410
They've got to figure it out from, you know, we need this from an operational side.

07:23.470 --> 07:28.650
But they don't really share that information sometimes, or we don't have a DevOps kind of thing.

07:28.650 --> 07:35.110
And I'm using DevOps loosely, if people don't know what it is, it's the whole integration of developers with operational people and being one big happy family.

07:36.190 --> 07:38.830
And let's be honest about our current state of logs.

07:39.630 --> 07:41.810
Most stuff just kind of sits there or gets deleted.

07:41.810 --> 07:47.710
You know, we have our log rotate set for 90 days because we have to for compliance reasons, and it's getting deleted.

07:47.710 --> 08:01.170
Or we're sending it to some product that's magically this pretty little box or pretty little VM or pretty little software, and we're storing it, and when, you know, we're having people come in to troubleshoot something or having an auditor or assessor come in,

08:01.170 --> 08:02.390
we're showing it to them.

08:03.450 --> 08:09.030
But honestly, let's be honest with ourselves and confess right now, we're not really watching them as much as we should in most cases.

08:09.270 --> 08:12.910
You know, we set it up because we thought we were doing the right thing, but we don't actually watch them.

08:13.710 --> 08:17.110
And I think a lot of that comes from the usual approach of watching logs.

08:17.110 --> 08:19.650
As you can tell, by the way, I love the TV show Archer.

08:19.910 --> 08:22.650
So all these images that don't have attribution, you can take them.

08:24.550 --> 08:34.550
But so the traditional approach of using a sys log server and using regex and sending alerts if it hits a certain thing, it doesn't really scale well.

08:34.650 --> 08:40.890
We can take and set up for multiple systems and back up, but it really defeats the purpose of being able to search and actually leverage those .

08:41.350 --> 08:44.290
And again, as I said, we can leverage a vendor product.

08:44.290 --> 08:47.150
A lot of good vendors, I won't name names here.

08:47.830 --> 08:48.710
You can.

08:49.570 --> 08:55.350
But a lot of them have great products out there, but they are expensive as shit.

08:56.510 --> 08:59.450
And the whole model is to do it as a volume based licensing.

08:59.450 --> 09:01.830
You want to log more, it's going to cost you more.

09:02.330 --> 09:03.930
But I'm hosting my own data.

09:03.930 --> 09:05.590
It's going to cost you more.

09:05.710 --> 09:12.190
And yeah, it makes sense from a business standpoint and it makes sense from a scale standpoint, but it can get very expensive quickly.

09:12.590 --> 09:18.690
I was talking to a friend the other day and they had a $2 million IT budget for all their operational expenses.

09:19.050 --> 09:23.990
They had a large vendor, we'll call them a flog him him.

09:25.090 --> 09:29.970
And they wanted $400,000 to do the logging for their environment.

09:30.250 --> 09:35.910
I mean, that's almost 25% of their year's budget just to do logs?

09:35.950 --> 09:38.730
I mean, we can use our money a little bit more wisely.

09:39.090 --> 09:42.930
And I'm not saying, you know, vendors are a bad thing.

09:42.930 --> 09:48.470
If you work for a vendor, a lot of you probably do, I'm not saying, oh, don't go buy the big guy's data.

09:48.730 --> 09:49.870
It's great a lot of times.

09:49.870 --> 09:52.530
If you have the financial resources, they are definitely great.

09:53.870 --> 09:59.710
And they also offer, most importantly, the idea of not having to have the technical talent to manage them.

09:59.710 --> 10:05.130
You can hire the guy who just graduated from college, say here, have fun with this product and they'll figure it out.

10:05.990 --> 10:12.370
But we can be a little bit smarter since we're people who actually like to tinker with things, break things and do things right.

10:13.350 --> 10:21.950
So I've been on this journey to find open source solutions and to actually help share the open source solutions that are out there and how to configure them.

10:22.110 --> 10:28.890
So I looked for this scalable logging solution that's, you know, open source so we can tinker with them, we don't have to pay license fees.

10:29.170 --> 10:30.870
It's reliable, scalable, secure.

10:30.870 --> 10:34.250
And the reliable and scalable is really important when it comes to your logs.

10:34.850 --> 10:37.850
And meets the compliance requirements stuff that you have to follow.

10:38.650 --> 10:40.630
And here are our top three winners.

10:41.110 --> 10:46.370
We've got Logstash, Elasticsearch and Kibana, which is what I'll be talking about today, also known as Elk.

10:47.010 --> 10:50.190
As a runner up we have Fluentd, which leverages Elasticsearch.

10:50.190 --> 10:52.730
They're a great product or a great solution.

10:52.730 --> 10:54.810
I don't want to call them a product because they don't really sell it.

10:55.410 --> 10:57.250
And then there's Greylog2 as well.

10:58.070 --> 11:01.610
Now as you can tell, Logstash and Greylog are Java based.

11:01.610 --> 11:06.510
I know, boo, hiss, Java, so memory consumption, but they work.

11:06.730 --> 11:09.830
And then Fluentd is CRuby based, so Ruby.

11:11.230 --> 11:24.770
So as I said, we'll be focusing on Logstash, kind of going through what is this Logstash, Elasticsearch, Kibana stuff, and how do we get events, process them, alert them, search them, and most importantly, impress that boss, because that's what we're doing.

11:25.130 --> 11:26.650
And so that's the end of my talk.

11:27.110 --> 11:29.190
You should just go use it and we're done.

11:32.010 --> 11:33.750
More or less my water break.

11:34.790 --> 11:48.330
So the biggest pains for logging as a lot of us have faced is that we're getting a lot of log data from a bunch of different sources that come in all these different formats and all these different timestamp formats and sometimes they're this, sometimes they're that,

11:48.330 --> 11:51.530
and we've got to parse them, we've got to actually make sure we have the accurate time for them.

11:52.630 --> 11:56.970
And so the Logstash processor actually tries to do that.

11:56.970 --> 12:00.970
So this is a look as to how Logstash processes its data.

12:02.050 --> 12:10.570
So from a shipper perspective, that's kind of your Syslog agents, your Logstash agents that are basically generating those logs and sending it to a central source.

12:11.170 --> 12:16.470
You have a broker which basically queues everything up so it can process it as fast as possible and distribute that job across.

12:17.250 --> 12:30.110
You have an indexer that looks at it, does the analysis of what is this log, how do I parse it, how do I tag it, and where do I ship it, and sends it off to search and storage, and then you've got the pretty little web interface to actually monitor everything.

12:30.110 --> 12:32.410
This sounds kind of familiar to a lot of other products out there.

12:33.790 --> 12:37.590
But the cool thing with Elasticsearch and with Logstash is that you can scale it.

12:38.030 --> 12:44.170
So instead of just having one system, you know, you may be logging 10 gigs of data a day and then next week you've got to log 100.

12:44.710 --> 12:47.710
Obviously the whole title of the talk is log all the things.

12:47.710 --> 12:55.310
You know, I'll start on the ramble about generating logs later, but the more data we have, the more we can actually do actionable intelligence for it.

12:55.950 --> 13:01.970
So to scale it up, all you have to do is take those little individual parts and split them across more systems.

13:02.270 --> 13:06.830
So you can take and split the broker across multiple systems to queue everything up and have a little more redundancy.

13:07.150 --> 13:12.690
You can take the Logstash indexer and split it up across multiple systems to actually process those logs.

13:12.930 --> 13:16.750
And then your Elasticsearch cluster obviously can grow as well for the storage and the searching.

13:17.810 --> 13:26.970
So as I previously said, we're going to focus on really the aspects of collecting and shipping logs, storing logs, processing, monitoring them, and searching them.

13:27.190 --> 13:29.850
And obviously there's that generating log component as well.

13:30.730 --> 13:39.990
So first things first, the biggest reason a lot of us don't generate the logs we need to is because we're using some commercial product and paying based upon how much we generate.

13:40.470 --> 13:47.490
That doesn't really work well for security and for monitoring because you're starting to get in the case of picking and choosing before you get the intel.

13:48.610 --> 13:59.070
So my theory is we should build something that we can collect all the logs we want and the only cost to us is more disk space and more processing power, which is now relatively cheap compared to other things.

14:03.060 --> 14:07.580
So in order to collect the logs, Logstash has the thing called inputs.

14:08.180 --> 14:14.900
And so we can use our traditional syslog that everyone has fun and is familiar with, the archaic syslog of text.

14:15.380 --> 14:22.520
We can also leverage Logstash's agent, Lumberjack, which is a thinner version that actually can do the parsing of the data on the clients.

14:23.140 --> 14:26.420
And we can also do time queries as inputs, and I'll touch on that in a second.

14:26.980 --> 14:38.220
So going through kind of the different systems you typically have to face for your Linux, Unix and Mac logs, obviously you can leverage syslog agents just as is and send that data to Logstash.

14:38.880 --> 14:42.000
Or you can also leverage the Logstash agent, which is Java based.

14:42.000 --> 14:47.580
Now obviously you have to do that tradeoff of do I want to install Java or do I want to just send it with syslog?

14:48.600 --> 14:49.480
Syslog.

14:51.720 --> 14:58.120
So it also supports TLS as well, so for those of you who are like, oh, UDP, syslog, it will lose stuff, it's not encrypted.

14:58.120 --> 15:00.080
It does support TCP and TLS.

15:00.960 --> 15:08.940
So the good old Windows logs that everyone has a hiccup on and everyone is making their money off of because there's no good solution out there for Windows logging agents.

15:11.000 --> 15:15.340
You're able to do it with obviously Windows Logstash agent.

15:15.340 --> 15:17.620
Again, you'll be installing Java on systems.

15:18.460 --> 15:24.740
Or there are syslog agents that are available, open source, free, and community editions of them online.

15:24.800 --> 15:32.160
So NX log is a great one that basically takes whatever you're sending in, files, or Windows event logs, sends it off to syslog.

15:32.760 --> 15:34.960
And same thing for Snare's open source edition.

15:34.980 --> 15:41.020
Now both of these agents, NX log and Snare have commercial versions, so before you go, Zach, they have a paid version.

15:41.020 --> 15:42.980
They also have an open source community edition.

15:43.120 --> 15:45.040
It just doesn't have as much pretties.

15:45.980 --> 15:54.220
And then obviously the third option for those of you who are banging your head about Windows logs and how do you deploy this across your environment is to just use Windows built in event collector.

15:54.420 --> 16:03.320
Using Windows event collector and one Windows system to kind of collect all those logs, use that central event collector system to parse the logs and then ship them off over syslog.

16:03.320 --> 16:09.500
That way you can easily deploy it with a group policy and not have to worry about installing software on all your production systems.

16:10.980 --> 16:22.420
And then obviously the device logs, your network devices, your storage devices, your traditional syslog works well, but what's one of the cool things about log stash is it also offers SNMP traps as well.

16:22.600 --> 16:27.920
So you're able to just send SNMP traps to it and it's able to parse that and push it into the logging complex.

16:29.280 --> 16:33.500
You can also send raw socket data and it will be able to parse whatever it has coming in.

16:34.280 --> 16:37.600
And then able to make exec calls, which I'll touch on in a second.

16:38.240 --> 16:45.740
But most importantly, a lot of times we focus on just the operating system logs and the application logs get fed into the syslog complex.

16:46.200 --> 16:48.960
But one of the biggest things we miss is these application logs.

16:50.260 --> 16:55.620
So we need to log more than just the defaults, hey, I requested this page, moving on.

16:57.920 --> 17:09.640
Leveraging web app logs and integrating into the web app code with your development team to generate, hey, I saw a password change, this seems weird, oh, we just got a bunch of sessions that didn't exist, send something into the main logging complex.

17:10.160 --> 17:15.220
It creates a single source for you and the rest of the security teams out there to kind of monitor everything.

17:15.220 --> 17:17.580
Instead of having all these different aspects to pull.

17:18.380 --> 17:24.360
And obviously you can generate from those applications the usual text files depending on what application you're using.

17:24.800 --> 17:30.100
Or use Redis to queue up the logs and pretty much anything.

17:30.160 --> 17:34.920
One of the nice things about Logstash is the ability to pull from any source and write your own plugins.

17:35.360 --> 17:40.220
That would be a whole different talk for a whole other day so we won't get too far deep in there but it's an option.

17:41.360 --> 17:43.380
So what about the cloud?

17:47.560 --> 17:49.600
We're going to drink every time I say the cloud.

17:49.960 --> 17:51.340
So what about the cloud?

17:53.380 --> 17:54.640
Cyber, cyber, cyber.

17:56.880 --> 18:00.420
If you're playing at home, I don't see many people playing at home.

18:00.920 --> 18:02.680
It's afternoon, yes.

18:04.020 --> 18:13.280
So more and more providers who are offering cloud infrastructures and a lot more people are moving to these cloud infrastructures are offering the ability to grab the audit logs without having to do a formal request.

18:13.760 --> 18:15.840
So a lot of people aren't monitoring this.

18:15.840 --> 18:22.440
You know, recently, I'm trying to remember the name, code someone fill me in, that had their AWS instances completely.

18:23.900 --> 18:24.780
Thank you .

18:24.920 --> 18:25.720
Codespaces.

18:26.540 --> 18:35.160
Codespaces recently had one under an AWS attack and yes we can argue over how their infrastructure was actually set up, that they should have had their backups in a whole different environment that wasn't AWS.

18:37.560 --> 18:40.780
But we aren't monitoring those logs there.

18:40.780 --> 18:50.520
We're pushing all of our emails, not we all, but a lot of places are pushing these logs and this data out everywhere and not monitoring it.

18:50.560 --> 18:53.080
We're not monitoring who's logging into our Google apps account.

18:53.080 --> 18:58.580
Someone could be sitting there for months or logging in from some other geolocation that doesn't normally log into.

18:58.860 --> 19:03.500
No one is checking AWS to see who's got our API key that may have accidentally ended up somewhere.

19:03.500 --> 19:04.680
Something seems weird.

19:05.060 --> 19:14.440
So some of these services started offering the ability to actually take and grab these logs from AWS, Google apps, box, sales force, but others aren't yet.

19:14.440 --> 19:22.780
So these are kind of a top gear, top tip of different options for logging if you want to start pulling logs from these cloud services.

19:22.780 --> 19:24.380
So AWS has cloud trail.

19:24.720 --> 19:26.000
Thank you.

19:26.360 --> 19:28.540
The gentleman is keeping me honest.

19:32.140 --> 19:33.400
Thank you, sir.

19:34.420 --> 19:43.480
AWS has trail, which basically takes event logs every five minutes and pushes them into an S3 bucket.

19:43.780 --> 19:46.780
Log stash is able to pull those S3 buckets and parse those logs.

19:47.840 --> 19:51.180
Google apps has their reports API, which is basically an API you can make queries against.

19:51.180 --> 19:53.280
Box has their events API.

19:53.680 --> 19:55.580
And sales force has log in history now.

19:55.800 --> 20:00.940
But correct me if I'm wrong, but office 365 currently doesn't offer any kind of live parsing.

20:00.940 --> 20:03.940
You can request them, but that doesn't help you with monitoring it.

20:04.660 --> 20:05.960
Drop box, same thing.

20:05.960 --> 20:09.700
You can see it through their dashboard, but you can't have any kind of API access to it.

20:10.180 --> 20:13.180
And GitHub, I have yet to find any kind of logging other than enterprise.

20:13.420 --> 20:17.540
And more and more people for some reason think it's a good idea to push all your enterprise code into GitHub.

20:18.660 --> 20:23.420
I love GitHub, don't get me wrong, but I think it's kind of a bad idea to push everything out there.

20:24.160 --> 20:29.360
So as I said, log stash can pull from these from either an exec or from a built in input.

20:29.360 --> 20:31.780
Now you may be like, okay, you're talking about all these inputs, what are they?

20:32.140 --> 20:34.920
This is a list of the current version of inputs.

20:35.640 --> 20:39.160
And there's a lot that are, we'll call them alpha.

20:40.120 --> 20:41.340
And we'll touch on that later.

20:41.340 --> 20:44.100
But there's a lot that have been established, tested and well rounded.

20:44.100 --> 20:46.620
So as I said, you have exec.

20:47.140 --> 20:56.000
Exec will let you run any kind of shell script, any kind of Ruby script, any kind of command whatsoever, take whatever the output is and send it into the logging infrastructure.

20:56.000 --> 20:59.820
So you can customize exactly how you want to get that log data.

20:59.820 --> 21:04.140
You know, if you don't have a traditional source of data, you can start querying other APIs.

21:04.140 --> 21:07.060
And in fact, you may see also on that list, there's a Twitter plugin.

21:07.100 --> 21:13.360
You can have it monitor the Twitter stream for mentions of something, hashtags, whatever, and put that into your logging complex.

21:13.360 --> 21:14.560
I think that's pretty cool.

21:15.160 --> 21:19.420
That you're able to be like, oh, create a security event, somebody just doc dropped this.

21:21.480 --> 21:27.380
So as I said, it's got the S3 input, it's got exec and it's got a few other things in there and the SNMP trap as well.

21:27.380 --> 21:30.680
So those are the different inputs.

21:33.500 --> 21:42.240
So as I said, traditional inputs, you can still use the Syslog to collect the events and Redis and all those other agents.

21:42.240 --> 21:46.500
But the idea is then, do you really trust this somewhat young product?

21:46.500 --> 21:50.980
By the way, I did mention Logstash is now part of Elastic Search and their whole parent family.

21:50.980 --> 21:53.180
So they have commercial support behind them.

21:53.180 --> 21:59.340
But do you really trust this new Java based application with all your logs all the time?

22:00.080 --> 22:06.560
So yeah, if you're one of those people who live on the wild side like me, you can send it straight to Logstash and just be like, here, have fun.

22:06.660 --> 22:12.160
But you can also take and build a logging complex where you're able to send these logs and parse these logs in different ways.

22:12.620 --> 22:27.960
So my recommendation is always, if you don't really trust it, you can always build up an R Syslog or Syslog NG layer of basically send the logs to the Syslog system first, then send it to Logstash and then also send it to Hadoop for storage or send it traditional files for storage.

22:27.960 --> 22:35.440
So you still have that retention and you still have that log being archived elsewhere, but you also have all the cool new pretties that Logstash offers.

22:37.100 --> 22:39.780
So once Logstash has all these events, what do you do with them?

22:41.960 --> 22:45.640
Projects kind of is awesome and sucks at the same time.

22:46.040 --> 22:48.540
It's awesome because you can do anything with it.

22:48.540 --> 22:53.460
It sucks because you can do anything with it and you have to learn how to do anything with it.

22:53.860 --> 22:58.260
So Logstash has decided to create this thing called, this parsing engine called Grok.

22:58.260 --> 23:07.720
It still supports regex, it still supports traditional grep statements, but Grok is pretty awesome as it simplifies not having to know regex.

23:07.920 --> 23:12.160
They have prebuilt all these different syntaxes in here and I'll go through examples in a second.

23:12.560 --> 23:15.260
This is just probably 10% of them.

23:15.520 --> 23:26.300
But if you want to map an IP address, a user name, a log status level, you're able to do that with just saying what the syntax is.

23:26.300 --> 23:29.820
So you would just say word or data.

23:30.460 --> 23:32.020
It makes life easy.

23:32.920 --> 23:40.060
So even those who are not super technical with regex are able to write a pattern this quickly to parse Apache logs.

23:40.060 --> 23:40.940
And this is really it.

23:40.940 --> 23:44.840
I mean, as soon as you get an input, obviously you need to have the input in there too.

23:45.000 --> 23:46.400
But this is it for the filter.

23:46.400 --> 23:47.520
Combine Apache log.

23:47.520 --> 23:48.100
Done.

23:48.100 --> 23:49.000
It parses it.

23:49.000 --> 23:50.000
Happy days.

23:50.780 --> 23:52.020
What about more complex data?

23:52.020 --> 23:55.060
Stuff that doesn't really fit in existing syntax?

23:58.260 --> 23:59.780
Let's take this as an example.

23:59.780 --> 24:02.540
We have a typical PAM notification.

24:02.620 --> 24:07.160
This is raw sys log data that I generated August 8th.

24:07.160 --> 24:08.200
You do the math.

24:09.600 --> 24:13.300
Basically it's typical, hey, PAM detected someone log in.

24:15.360 --> 24:18.940
Now this may look a little complicated, but really I'm doing two levels of parsing here.

24:18.940 --> 24:21.720
And this is an actual working config and I'll be posting more later.

24:22.040 --> 24:25.180
But this is all you have to do in order to parse it.

24:25.180 --> 24:27.540
First we parse to see is it a PAM message.

24:27.540 --> 24:29.740
So we look for the PAM UNIX flag.

24:30.260 --> 24:31.420
Say grab all the data.

24:31.420 --> 24:33.060
Pick what module.

24:33.060 --> 24:34.180
Pick what phase it's coming from.

24:34.180 --> 24:35.100
Is it authentication?

24:35.100 --> 24:35.900
Is it authorization?

24:37.760 --> 24:42.780
And then once you tag it, you know, as you can see in there, there's those add tags, add tag for PAM, add tag for log in.

24:42.840 --> 24:45.220
So you can do filtering and pondering for it.

24:45.780 --> 24:49.540
Once you tag it with that, you can easily then say, all right, let me grab all the other data out of it.

24:49.540 --> 24:54.180
I want to grab the user, I want to grab the session ID, I want to grab the remote host.

24:56.780 --> 24:59.040
And that's it for the regex and it gets parsed.

24:59.180 --> 25:03.580
And you're able to take, and here's a quick from Elasticsearch of it parsing into all the different fields.

25:04.860 --> 25:17.440
And without having to know all this crazy regex to figure out, oh, we got a missing case here, you're able to quickly say, all right, grab the data, put it into this format, and it's pretty easy to figure out how to start parsing and filtering your logs.

25:18.760 --> 25:21.060
But that's not all the filters it has on the way in.

25:21.180 --> 25:22.460
We can tag metrics with it.

25:22.460 --> 25:33.860
We can track to see, all right, let's grab everything that has a failed log in and start assigning a metric to it and know how many failed log ins we have for this IP or this user over a one minute, five minute, 15 minute, one hour window.

25:34.660 --> 25:38.120
We can get GUIP information in it with the filters as well.

25:38.300 --> 25:41.300
Those pretty graphs like I was saying your bosses love.

25:41.420 --> 25:43.020
I don't know why people love seeing that.

25:43.020 --> 25:45.520
We have a bunch of attacks coming from this other country.

25:47.140 --> 25:48.120
Did they get in?

25:48.120 --> 25:50.080
No, but we have a bunch of attacks.

25:51.060 --> 25:52.720
You're on the internet, bro.

25:55.280 --> 25:56.980
But management for some reason loves that.

25:56.980 --> 25:58.220
So you can give them those pretty little graphs.

25:58.220 --> 26:01.480
You can do GUIP tagging and pull from the GUIP databases.

26:01.660 --> 26:07.820
You can do reverse DNS lookups to make your matches easier if you have a dynamic environment or just want to start logging that data.

26:08.500 --> 26:13.260
And then there's URL decode so you can take a decode if you have a URL inside of a URL.

26:14.400 --> 26:18.280
You can do multiline data so if it crosses more than one line you can do key value.

26:18.280 --> 26:25.720
So if it's a situation as you saw in the previous one of our host equals, action equals, you can just say key value it and it parses all that automatically.

26:26.240 --> 26:28.100
And the coolest thing is it can do anonymize.

26:28.100 --> 26:30.180
So if you happen to not be here in the U.S.

26:30.180 --> 26:40.800
and have to not store data of people, you can anonymize that data as soon as it comes in with random data, hash data, however you can take and sanitize that.

26:41.140 --> 26:46.780
So for those of you who have to deal with European laws or other laws that say you can't actually store this after so long.

26:49.930 --> 26:54.430
So after you filter all that data, Logstash can output it to pretty much anywhere.

26:55.870 --> 26:59.930
Traditionally people will send it to Elasticsearch for monitoring and searching and that's what we're going to cover next.

27:00.770 --> 27:05.770
But you can send it to different indexes just like you can with other large logging products.

27:07.010 --> 27:09.010
You can also do what's really cool is called exec.

27:09.270 --> 27:17.850
So with exec, if you see a certain set of flags or you parse it out and filter it out, you can take and go, oh, this looks interesting.

27:18.370 --> 27:20.670
I wanted to do something every time I see this.

27:20.670 --> 27:21.850
But I don't want an email.

27:21.850 --> 27:24.770
I wanted to, I don't know, automatically block something.

27:25.430 --> 27:27.410
You can just make an exec call to whatever script.

27:27.410 --> 27:28.910
I'll touch on some cool things later.

27:29.470 --> 27:42.150
If you're like me and you don't want to keep changing your filters and want to dynamically change how things are, you can make a simple web call to some other monitoring 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:43.990
Do something with that.

27:44.490 --> 27:56.070
And write up a web app, instead of having to script and write all this stuff and keep restarting your filters, you can just say, send all this log in information to this other web source and tell me if I should generate any kind of alerts.

27:57.590 --> 28:01.730
If you're someone who sits on chat all day, you can send it as into your chat logs.

28:01.730 --> 28:04.890
I don't think there's an IRC output, which I was kind of disappointed in.

28:05.710 --> 28:11.190
If you're a user of PagerDuty, you can send it there or your traditional email notifications that go in that bucket you never monitor.

28:16.210 --> 28:22.510
So, as I was saying, you can filter, you can parse, you can do all this fun stuff.

28:22.750 --> 28:23.770
What do we care about?

28:23.770 --> 28:25.450
We're sending it to this place and we're not monitoring it.

28:25.450 --> 28:28.710
As I said, the biggest important thing is for us to actually monitor these security events.

28:29.250 --> 28:38.090
So, as I was saying, we sub filter some parts of stuff, we tag them, saying this is a security event, this is a compliance event, this is a fail log in, success log in.

28:38.090 --> 28:39.650
We can create all the tags you want.

28:40.270 --> 28:43.670
Add metrics if you want to see if there's too many fail log ins over a certain window.

28:44.270 --> 28:46.110
You pick the output and then you can scale.

28:46.610 --> 28:58.530
So here are two simple outputs that I wrote together real fast that shows if it's a fail log in and it's been over two for this specific user within a minute, send me an email.

28:59.110 --> 29:00.730
That's how simple it is.

29:02.470 --> 29:14.030
If you want to send it, like I was saying, all the auth requests, you want to send it to some other source to dynamically determine, hey, I wrote this cool little PHP app that will tell me if you send it the IP and the user name, it will determine if it's new.

29:14.390 --> 29:18.190
If you're more comfortable with some other language, Ruby, whatever, send it there.

29:18.350 --> 29:23.570
You can start sending these kind of actions elsewhere that traditional logging complexes can't do.

29:23.830 --> 29:26.290
Yes, some commercial products support this as well.

29:26.550 --> 29:28.830
But this one's free.

29:30.590 --> 29:38.630
So in the second example, obviously, any time there's an auth request that's tagged as an auth request after we do all those filters, send it to whatever.

29:38.630 --> 29:40.950
That's not actually real, so don't go trying to query that.

29:40.950 --> 29:42.270
You're not going to get anything.

29:42.850 --> 29:44.190
And send it a post.

29:45.330 --> 29:48.170
So this is what I'm saying, we can do these execs, we can do these remote calls.

29:48.290 --> 29:50.230
As a security people, this is awesome.

29:50.230 --> 29:52.450
We can have it do whatever we want automatically.

29:53.290 --> 29:57.570
We can have it update, again, this is for those who like to live dangerously on the end.

29:57.710 --> 30:00.430
You can have it automatically update firewalls, switches.

30:00.510 --> 30:02.490
Oh, I see someone new join the thing.

30:02.490 --> 30:04.450
I don't have a traditional NAT complex.

30:05.250 --> 30:07.110
Go ahead and tell it to disable switch port.

30:07.110 --> 30:09.770
Cool, exec, da , da, da, wrote this cool script, done.

30:10.350 --> 30:12.470
You're able to do that with this new logging complex.

30:13.010 --> 30:19.390
Notify a user directly, hey, somebody logged in from a new IP address and this looks weird or it's not from within the U.S.

30:19.390 --> 30:28.490
or whatever country you're from, hey, this is weird for them, let me send that user an email and make it their responsibility to go, hey, security, something's up, I didn't log in.

30:28.950 --> 30:34.630
You don't have to monitor that all and you can start using your logging complex to generate those kind of alerts directly to your users.

30:35.770 --> 30:39.410
Obviously notify for admin logins, both on an internal and external side.

30:39.670 --> 30:45.550
One of the greatest things pen testers will talk about is, oh, I got admin on all these systems, oh, yeah, it crawled across the environment.

30:45.770 --> 30:47.890
Why aren't we logging and detecting that?

30:47.990 --> 30:52.930
Admin shouldn't be logging in remotely typically and why not generate events for people to follow up on them?

30:54.090 --> 31:01.310
And then obviously for user logins on new machines, hey, Jim doesn't normally log in this machine and I haven't seen this before, I'm going to generate an event.

31:01.310 --> 31:08.690
And this is easy to do then with these filters, with these custom outputs that some other logging complexes don't support.

31:09.030 --> 31:12.570
So, again, we've got the monitoring, we've got the collection, we've got the storage.

31:13.630 --> 31:14.770
What about the searching?

31:14.790 --> 31:24.290
That's one of the biggest problems with traditional syslogs is that you have to run, grab, awk, run through this text file, wait, wait, wait, wait, go through 10 gigs, come on, give me something.

31:24.890 --> 31:32.630
So, since it's based on Elasticsearch, the crew over at Elasticsearch is complex has this pretty little front end called Kibana.

31:32.870 --> 31:37.610
Kibana pretty much looks like every other logging searching thing you can ever imagine.

31:38.330 --> 31:41.710
And you're able to quickly search for the events, correlate the events, and go through there.

31:41.710 --> 31:50.930
I'm not going to go too far into Kibana because you're going to create all these pretty custom dashboards, you can go through and have a pretty map for the management, as we were saying, your boss loves them.

31:56.810 --> 31:58.970
But no, I mean, get a raise, sorry.

31:59.230 --> 32:00.970
But so, this works great.

32:01.950 --> 32:09.490
But that's all the pretty dashboards, you can do all the searches, really, like I said, we're focusing on the security side, getting those alerts, getting that notification.

32:10.650 --> 32:18.930
But you may be going, for those of you who know what Elasticsearch is, may be going, dude, Elasticsearch, really?

32:19.750 --> 32:22.990
That shit kind of not has any security controls whatsoever.

32:23.330 --> 32:25.730
Yeah, it does not have security controls whatsoever.

32:25.730 --> 32:26.970
You have to build them.

32:27.410 --> 32:31.430
So as I said, it's not an easy solution, but it's one that you can scale and customize greatly.

32:32.250 --> 32:41.310
So Elasticsearch is made so that basically you can cluster with everything, multicast to figure out all the other peers, doesn't have authentication, just trust everyone, gives everyone pseudo rights.

32:41.590 --> 32:43.990
Yeah, it's bad, from a security perspective.

32:43.990 --> 32:45.230
But it's great from a data perspective.

32:45.230 --> 32:47.230
So we have to build in these security controls on top of that.

32:47.230 --> 32:52.070
We have to write an NGX proxy in order to bind locally, really simple configure.

32:52.870 --> 32:56.450
Have to segment the stuff off on the network so it doesn't take a multicast everywhere else.

32:56.450 --> 32:58.370
Again, simple change.

32:58.550 --> 33:03.570
And you need to enable some logging on your NGX front end that you're doing the proxy for.

33:03.950 --> 33:05.890
Again, for compliance reasons and for the tracking of that.

33:05.890 --> 33:07.990
Again, simple configs.

33:08.230 --> 33:12.750
But everyone who's like, oh, you can't use that because of security reasons, you just have to add a few additional controls.

33:15.370 --> 33:21.130
Now from a performance side, you can tweak, obviously, a lot more when you build your own system.

33:21.130 --> 33:34.390
So you can take in a tweak if you're starting to scale up the size of your indexes, sometimes by default Logstash and Elasticsearch do daily indexes, but if you start logging, I don't know, 200 gigs a day, a 200 gig index is kind of a bad thing.

33:34.850 --> 33:39.810
So you can start changing the size of your indexes to hourly, minutes, so on and so forth.

33:39.810 --> 33:43.090
You can increase the number of workers in Logstash in order to parse that stuff faster.

33:43.170 --> 33:48.870
You can enable compression in Elasticsearch and you can enable queuing for the network traffic coming in.

33:50.370 --> 33:53.250
And again, the whole point of this is so you can scale.

33:53.250 --> 33:56.990
You know, the traditional systems you can't scale, you can't cluster, it's not fault tolerant.

33:57.290 --> 34:09.610
You can easily scale up with Logstash, Elasticsearch, and Kibana by spinning up more instances of Elasticsearch, spinning up more instances of Logstash, and as I was saying, putting more steps in front of it that can kind of distribute and spin it out,

34:09.610 --> 34:13.070
and they recommend Redis, works well if you put Logstash in front of Logstash.

34:13.070 --> 34:14.830
I know it doesn't make sense, but it does.

34:16.190 --> 34:19.330
So the question you all have is, is it as good or better than a vendor?

34:19.330 --> 34:24.270
You're up here preaching, you should look at open source stuff and you should take and do something different than just buy a product.

34:24.270 --> 34:25.070
Is it better?

34:25.690 --> 34:26.570
It's your call.

34:26.590 --> 34:38.450
I mean, if you have the technical ability or the team who has the technical ability or coworkers, yeah, it works well and it doesn't come at the licensure cost of other things, but it's not easy to manage as a paid solution.

34:39.130 --> 34:42.550
And still very relatively young, so there may be bugs you encounter.

34:42.550 --> 34:52.730
So if you're sitting there with critical logs, you cannot lose it all, you may want to look at someone who's a little more established or, like I was saying, add a few steps in there to send it off to multiple storage locations.

34:53.930 --> 35:01.490
And it lacks authentication out of the box, again, something you can easily change, but you'll hear people shaking their stick at that saying you've got to be able to authenticate to it.

35:01.970 --> 35:04.370
Entry proxy, HTTP password, done.

35:05.310 --> 35:12.550
But on the flip side, it's extremely customizable, the price is just right, and some enterprise support is available.

35:13.470 --> 35:15.390
And you can even use it in the cloud.

35:22.120 --> 35:23.900
I had to whet my whistle there.

35:25.340 --> 35:26.880
So what's next?

35:26.880 --> 35:29.460
I just rambled here about how great this thing is, what's next?

35:29.920 --> 35:39.580
We have this little thing as much as, okay, I'm ready for the boo and the hiss, but we call it the open PCI project, the domain hack PCI also works for some reason, I don't know why.

35:40.740 --> 35:46.140
But basically the idea of that, there shouldn't be any secrets as to how to secure stuff.

35:46.140 --> 35:51.820
People have been selling this whole magic bean of, oh, we can give you these configs and keep reselling them.

35:51.960 --> 35:53.620
They're configs, guys.

35:54.960 --> 35:56.480
We can share that information.

35:56.480 --> 35:58.180
It doesn't provide any kind of competitive advantage.

35:58.180 --> 36:00.500
In fact, it just makes things easier for all of us.

36:00.880 --> 36:02.840
So we have this thing called the open PCI project.

36:04.040 --> 36:08.480
It needs an update for all this stuff, but I will get that soon.

36:09.580 --> 36:10.840
As soon as possible.

36:11.360 --> 36:19.660
But basically to take and share this information, and we'll take and share all the configs, the base parsing, a VM that's ready to go that you can just spin up right away.

36:20.580 --> 36:24.160
And obviously the hardening guides, as I was saying, elastic search and secure by default.

36:24.160 --> 36:26.540
Some hardening guides and configs are just here.

36:26.620 --> 36:28.340
It works.

36:28.340 --> 36:28.740
Great.

36:28.740 --> 36:29.320
Awesome.

36:29.320 --> 36:37.500
To make it as close as similar to these large commercial products, but obviously you need a little more hands on support.

36:38.440 --> 36:44.040
So with that, I'm ending a little bit early, I'm sorry, but I'll let you guys get in line for the next talks here.

36:44.160 --> 36:48.780
But that's me, that's the talk about all that stuff and all in all log stuff.

36:49.220 --> 36:54.700
Fuck companies that sue people for legal pressure for giving talks about stuff they don't want.

36:54.740 --> 36:56.420
And that's it.

36:56.420 --> 36:57.280
Thanks all.

