WEBVTT

00:00.000 --> 00:00.440
All right.

00:00.440 --> 00:01.060
Thanks a lot.

00:01.060 --> 00:04.420
And thank you all for filling this arguably a little bit small room.

00:04.420 --> 00:05.280
But it's cool.

00:05.280 --> 00:08.280
I'll tell everyone the room was full and not how many people were in it.

00:08.400 --> 00:09.960
So thank you for coming.

00:09.960 --> 00:11.160
I work at DirectSupply.

00:11.160 --> 00:13.600
I'm a technical fellow and chief software architect.

00:14.400 --> 00:17.860
And I'm here to talk to you about scaling security in the cloud today.

00:17.880 --> 00:23.720
Our company, DirectSupply, we do services and solutions for the long‑term care industry.

00:23.720 --> 00:36.700
So things for nursing homes, assisted living, apps where they can do maintenance on their equipment, all the way through e‑commerce sites where they can buy products and food for the residents.

00:38.680 --> 00:43.460
So we've been undergoing a journey to migrate into the cloud for about the past two years.

00:43.460 --> 00:48.160
I've been interested in going in that direction for longer than that.

00:48.160 --> 00:51.660
But it was only about two years ago when we decided to do this.

00:51.660 --> 01:10.760
And a big part of the talk today is kind of around how we've migrated somewhat from a traditional infrastructure and software culture, you know, two different silos, to the DevOps mode where development teams are owning their own deployments and how we're starting to scale the security amongst those DevOps teams.

01:13.690 --> 01:15.350
Now, I do have a lot to talk about.

01:15.350 --> 01:17.830
I will stay out in the hall for questions afterwards.

01:17.830 --> 01:19.670
So if you would just hold them to the end, that would be great.

01:19.670 --> 01:23.170
I have some slides I was going to maybe have to skip over, but hopefully I won't have to.

01:23.450 --> 01:29.110
But I wanted to talk about first our company's cloud vision and strategy that I was part of putting together.

01:29.290 --> 01:35.430
When we decided to migrate into the cloud, we wanted to make sure that we took advantage of a lot of the things that the cloud was going to get us.

01:35.430 --> 01:42.490
We didn't want to just take our applications as they were running and then shift them to run on EC2 instances in AWS.

01:42.870 --> 01:46.190
An argument you might hear is that, well, you don't own the infrastructure.

01:46.190 --> 01:46.870
And that's true.

01:46.870 --> 01:51.610
We don't own the infrastructure, but we can architect for not owning the infrastructure.

01:52.030 --> 01:56.390
So part of the strategy included things like immutable servers.

01:56.390 --> 02:00.970
If you've heard of this, this is the idea that once you run a server, you're not going to change it.

02:00.970 --> 02:06.750
If you want to change it, you will tear that server down and relaunch from a new image that you've built.

02:08.270 --> 02:11.190
We wanted to embrace infrastructure as code.

02:11.210 --> 02:24.970
We had limited scripting in our old infrastructure world and part of the programmability of the cloud is that you can take advantage of all of the things that software development teams have been able to take advantage of for a very long time.

02:24.970 --> 02:30.430
Like version control, peer review, automated deployments and automated testing.

02:30.910 --> 02:33.090
Which takes me to automated deployments.

02:33.150 --> 02:38.870
We wanted to make sure that our deployments as we ran them in different accounts and in different environments were the same.

02:38.930 --> 02:41.290
And the best way to do that is through automation.

02:41.290 --> 02:47.910
You can write a very long document with step by step pros of what to do, but if somebody's doing it, they're going to do something slightly different each time.

02:49.610 --> 03:00.790
A big part of what I'll be talking about today is we wanted to encourage defaults to be secure so that as development teams started rolling infrastructure, they would get secure defaults.

03:00.790 --> 03:12.550
And maybe they weren't even consciously getting them, but we were trying to take some of those decisions away from them so that when they just ran the thing the easiest way that we provided for them to do it, it would be secure.

03:13.470 --> 03:24.710
And finally, and this is a bit more of a migration over the next couple years, but I will touch on this later as we're starting to provide a platform as a service for our software delivery teams.

03:24.950 --> 03:40.210
And the idea here is that now that we've scaled infrastructure out and ownership out to across all of our software development teams, now we want to provide more abstractions for them to use to run their applications in the cloud.

03:42.960 --> 03:49.500
So I want to start by just talking about the programmability of the cloud and some of the things that it can get you.

03:49.500 --> 03:56.260
And it kind of hit me that there's pretty much four layers of making use of programmability with your infrastructure.

03:56.420 --> 03:58.660
The first is you have no automation.

03:58.660 --> 04:03.020
You do things by hand and you have people that really like doing things by hand.

04:05.200 --> 04:08.200
Eventually you start to script up some of your work.

04:08.200 --> 04:15.000
If you've worked against a traditional infrastructure like a VMware, some of those have been a lot more difficult to automate.

04:15.200 --> 04:21.360
And part of the programmability of the cloud, it makes that a lot easier and a lot more reproducible.

04:21.400 --> 04:25.920
As you begin to progress, you'll get into DevOps and continuous delivery.

04:26.140 --> 04:30.560
And again, now we're fully taking advantage of the cloud for our deployment reasons.

04:30.560 --> 04:36.900
But the final level of taking advantage of cloud programmability is using it for evil.

04:39.160 --> 04:41.000
So I'm going to hit with just one quick thing.

04:41.000 --> 04:45.160
We had an accidental commit to GitHub of some AWS access keys.

04:47.540 --> 04:51.820
And I don't know if anyone's experienced that, but what do you think happened?

04:54.320 --> 04:56.400
GitHub, it was public.

04:56.960 --> 04:59.280
You don't get to answer because you know what happened.

05:00.880 --> 05:14.120
We might talk about this in threat modeling and your threat might, like your impact could go all the way up to someone could potentially like encrypt all of your data or delete or destroy all of your data in that account.

05:14.120 --> 05:15.920
Destroy all of your infrastructure.

05:16.440 --> 05:26.480
But because of the automated nature of the programmability of the cloud, what happened was a bot found that on GitHub and then just started launching instances to mine cryptocurrency.

05:27.060 --> 05:28.980
So there was really no damages.

05:30.420 --> 05:33.260
There weren't any damages to our infrastructure.

05:33.460 --> 05:38.740
Amazon noticed this within a few minutes and disabled the account and it was a development account.

05:38.820 --> 05:41.180
So it wasn't our production account that was disabled.

05:42.400 --> 05:49.240
But it's kind of that idea that if you're not ruthless enough in attacking someone else is going to take that place.

05:49.240 --> 05:53.440
And there was a very small window of opportunity where somebody could do damage.

05:53.460 --> 06:09.060
And it seemed like the lowest, like if you talk about like electricity is going to follow the path of least resistance, the attack was one of convenience and it cost I think about $800 when it was done because we got stuff shut down really quick.

06:09.060 --> 06:11.020
So in the end it wasn't that bad.

06:11.600 --> 06:16.880
But I just wanted to point out that you can use the same programmability of the cloud for both good and evil.

06:19.020 --> 06:26.980
So as we're migrating into this mode of DevOps, we started trying to figure out how are we going to be able to do more with less.

06:27.020 --> 06:30.440
And I don't mean do more, like do less security.

06:30.440 --> 06:32.220
We wanted to do more security.

06:32.220 --> 06:41.340
But since things are now spread out across development teams without hiring teams and teams of individuals focused on security, we weren't going to be able to keep up with development.

06:41.580 --> 06:45.960
So we have to start spreading some of that out across the teams.

06:49.550 --> 06:57.830
I'm going to talk now about a few of the open source things that we use to both help with that issue we had with the GitHub push of the keys.

06:58.030 --> 07:04.570
And also solve a number of our other security issues in the cloud.

07:04.570 --> 07:07.030
And the first is a product from HashiCorp called Vault.

07:07.030 --> 07:07.990
I don't work for them.

07:07.990 --> 07:13.770
I'm a huge fan and their open source product gets you a lot of things you wouldn't even expect.

07:13.770 --> 07:20.930
Like companies that do open source sometimes will save the LDAP integration or the UI for the commercial versions.

07:20.930 --> 07:24.090
But they've got so much in their open source that it's almost unbelievable.

07:24.750 --> 07:40.190
But what Vault is, and this is right from their website, it's a product to secure, store and tightly control access tokens or access to tokens, passwords, certificates, encryption keys for protecting secrets and other sensitive data using a UI, CLI or an HTTP API.

07:40.770 --> 07:42.570
So it does a lot of stuff.

07:42.570 --> 07:45.670
And they kind of flag it as security as a service.

07:45.670 --> 07:49.830
You've got this very secure box that does all these things for you.

07:50.290 --> 07:52.670
We're not using it for all of its uses.

07:52.830 --> 07:56.470
We are using it, uh, for these use cases.

07:56.490 --> 07:58.730
We're using it to store static secrets.

07:58.730 --> 08:01.950
Things using its key value secrets engine.

08:02.030 --> 08:05.150
And these would be things like passwords to back end services.

08:05.150 --> 08:09.130
If we had like access to a third party API and we needed to store some sort of key.

08:09.230 --> 08:11.810
Um, that's a piece of information that does not change.

08:11.810 --> 08:14.350
We need to store and access that securely.

08:17.790 --> 08:20.790
Vault also has the potential to deal with dynamic secrets.

08:20.790 --> 08:22.650
And these are things that can change.

08:22.950 --> 08:28.770
And the idea of them changing is interesting because it allows you to lease them for a certain amount of time.

08:29.930 --> 08:35.330
First that we, the first, uh, dynamic secret engine that we use is one for Postgres.

08:35.850 --> 08:49.230
Um, historically, when we were on prem, the vast majority of our databases were running Microsoft SQL server and we had them on our domain and we used integrated Windows authentication between applications in the database.

08:49.490 --> 08:55.910
And then when users needed to get access to those databases, we granted, you know, put them in roles based on their domain account.

08:55.950 --> 09:02.470
We wanted something similar, but with the dynamic nature of the cloud and things coming up and down all the time, we didn't want that coupling to a domain.

09:02.470 --> 09:09.110
So we've not made any attempt as we started to move into Postgres to get those onto our domain or to do LDAP authentication.

09:09.330 --> 09:20.650
Uh, but one thing that Vault can do is it can dynamically generate me, if I'm a developer, a username and password to access that Postgres server that's good for an hour.

09:20.750 --> 09:30.350
So Vault will authenticate me on our domain and then I have access to a policy that lets me generate a username and password for a specific Postgres instance.

09:30.350 --> 09:32.510
And it's good for a certain amount of time.

09:33.110 --> 09:37.210
So it gets us effectively the same thing without the database having to be tied to our domain.

09:38.010 --> 09:45.890
Uh, the second thing is that after our incident with the GitHub push of the access keys is we don't issue access keys to anybody anymore.

09:46.850 --> 09:58.250
Vault has an AWS secrets engine where me as a developer, I can authenticate to Vault using my domain credentials and then I can request a key pair that's good for a certain amount of time.

09:58.250 --> 09:59.290
And there's a maximum.

09:59.290 --> 10:01.170
I have an example of how we do this.

10:01.450 --> 10:07.850
Um, but then if that key got leaked, that would further limit the usefulness of the how, what you could do with it.

10:08.790 --> 10:15.290
Um, and the third thing that we're using it for right now is one time password to log into EC2 instances.

10:15.510 --> 10:20.550
It can do the same thing for, uh, Linux servers that it can do for like Postgres.

10:20.550 --> 10:24.870
It can generate a username and password that you can use to log in and it's only good for so long.

10:27.350 --> 10:32.730
Okay, so authentication to Vault, um, all of the components to Vault are pluggable.

10:32.730 --> 10:34.590
So you can authenticate to it different ways.

10:34.590 --> 10:41.730
We use LDAP for our user accounts and then with systems that are running in AWS, they'll use IAM to authenticate.

10:41.970 --> 10:46.570
Um, you can also use username and password or GitHub or any other mechanism, but it's all pluggable.

10:47.170 --> 10:53.930
Um, but I wanted to show really quick from the CLI how, I hope this is visible in the back, how we authenticate to Vault.

10:53.930 --> 11:03.630
We set our Vault adder environment variable to point at our Vault server and then we just issue a Vault login method LDAP and username equals whatever my LDAP username is.

11:03.750 --> 11:05.330
In a few seconds, it comes back.

11:05.330 --> 11:06.690
It issues me a token.

11:06.970 --> 11:10.130
That's good for, according to the output, 60 minutes.

11:12.310 --> 11:15.870
And at the bottom, you can see the policies that I have access to.

11:15.870 --> 11:22.290
This is in our development tier, so in this tier, I'm effectively an admin and you can see I have access to three policies.

11:22.290 --> 11:32.650
One is AWS API engineer, meaning that I'm an engineer that's going to use the CLI or the SDK to access AWS and that's what lets me generate access keys for AWS.

11:32.650 --> 11:39.710
Uh, there's the EC2 user OTP for one time passwords to let me generate one time passwords.

11:39.710 --> 11:43.230
Uh, this is the admin level, so this would be to any EC2 instance.

11:43.950 --> 11:48.950
And secrets read write allows me to get access to the key value store.

11:49.210 --> 11:55.590
You can make these policies as granular as you wish and they can be specific to just one path involved.

11:55.590 --> 12:08.990
So you might have an application secrets at slash secrets slash my application and if you have a team that operates just that application, you can define your policies so that they can just get access to secrets under that path.

12:09.650 --> 12:16.430
Uh, but these policies are pretty broad, uh, since I am an admin on this, uh, tier.

12:17.730 --> 12:22.870
Uh, the next piece is just an example of how you interact with the key value secrets engine.

12:24.290 --> 12:28.470
In this case, I'm issuing a vault KV get command.

12:28.470 --> 12:33.270
I'm asking for a specific field because what we store at those keys are JSON documents.

12:33.270 --> 12:37.530
So you can have any number of, uh, key values within that one document.

12:37.550 --> 12:46.090
Um, I'm asking for a field called gossip encryption key and it's at the path secrets slash console, which is another product we're working to roll out.

12:46.350 --> 12:49.010
Um, and then the output is simply the secret.

12:49.010 --> 13:00.350
So what would happen is the application that needs access to this secret would have an IAM policy defined that would get them access to a vault policy which says I can read this secret.

13:00.350 --> 13:12.570
And then when those instances run, when they start up, part of their bootstrap script will be to authenticate the vault using IAM and get this information and most likely, uh, plop it into an environment variable for the process.

13:14.610 --> 13:18.030
So at no point do we need to build these secrets into our images.

13:18.030 --> 13:23.650
We request them at runtime or at start time and then they become part of the environment for whatever process needs them.

13:25.530 --> 13:30.030
A quick example of how we generate secrets for Postgres.

13:31.650 --> 13:38.210
This look, the syntax is a little bit different, but in this case we have a databases secrets engine for a specific database .

13:38.210 --> 13:40.690
So it would be databases slash myDB.

13:40.930 --> 13:47.250
And then when you configure it, you define policies within there for like read only or read write.

13:47.250 --> 13:52.410
And then that ties back to the permissions that the Postgres users have on your underlying database.

13:52.430 --> 14:06.890
But if I issue a vault read databases myDB slash cred slash read only, you'll see it issues me a lease for one hour and it gives me a username and a password which I can then use to go attach to that Postgres instance.

14:06.910 --> 14:09.730
After an hour, it's expired and does not work anymore.

14:12.190 --> 14:24.910
Likewise for AWS, for as a developer, when I need access to a key pair to use, I will issue a vault write to AWS slash STS slash in this case engineer.

14:25.250 --> 14:30.490
And the way this manifests is then I will assume an engineer role within AWS.

14:30.490 --> 14:43.070
We define a role and if you've ever used federation or done any type of role assumption, you're not logging in with an IAM user, you're logging in, you're authenticating some other way and then you're assuming a role within IAM.

14:43.390 --> 14:51.750
So when I issue this vault write and when I put this together, I asked for a TTL of 600 minutes just to see what would happen because I didn't know.

14:52.130 --> 14:56.310
And it did issue me a one hour, it was maxed at one hour lease.

14:56.430 --> 15:03.370
So the token I got back was good for one hour and then I get an access key, a secret key and a token which I can use to run AWS configure.

15:04.170 --> 15:12.310
I did have to abridge part of this security token but the access key and secret key were actual keys for our accounts but I'm confident that they are no good anymore.

15:12.410 --> 15:13.990
So I'm showing them at DEF CON.

15:14.590 --> 15:15.950
Get a picture.

15:18.280 --> 15:19.940
It will be in the slides.

15:20.100 --> 15:41.340
For one time passwords, I want to connect as an operations person to an EC2 instance and the way I do that is by issuing another vault write to SSH slash creds, that's the secrets engine for a read user OTP, this is read only access to an EC2 server and I give it the IP address.

15:41.400 --> 15:50.240
It again has a lease duration of one hour and it outputs the username to use, read user and the key which is the password.

15:50.740 --> 15:55.800
So then you can just do a regular username password SSH onto that EC2 box.

15:56.860 --> 15:58.780
Nothing to clean up after an hour.

15:59.800 --> 16:02.200
So that's kind of a lot of what we're doing with vault.

16:02.820 --> 16:12.220
The next thing I want to talk about is something that we've deployed in order to enforce policies against our AWS configuration itself.

16:12.380 --> 16:20.920
Everyone's seen the news, company releases a public S3 bucket and someone finds a bunch of data or something else is misconfigured and there's a big data leak.

16:21.460 --> 16:29.560
But with teams owning their own infrastructure, we have deployed a product from Capital One, that's open source called Cloud Custodian.

16:35.960 --> 16:36.800
Yeah.

16:36.940 --> 16:38.060
Right.

16:38.160 --> 16:39.060
Well, maybe they do.

16:39.060 --> 16:41.260
Maybe they don't have their policies defined correctly.

16:42.560 --> 16:46.480
But what we're getting from Cloud Custodian is the configuration governance.

16:46.480 --> 16:49.040
Again, it's policy as code.

16:49.100 --> 16:53.560
We get automated checking and enforcement of infrastructure that gets deployed.

16:53.560 --> 16:55.740
And we're running multiple AWS accounts.

16:55.740 --> 17:04.800
So even though this is a reactive thing, the infrastructure gets built and then Custodian notices it doesn't fit the policy and then it does something.

17:04.960 --> 17:10.200
But that happens in our development account, which is before it would get up to production, theoretically.

17:11.740 --> 17:13.600
It does get us policy as code.

17:13.600 --> 17:16.700
So again, we have automated deployments of our policy.

17:16.700 --> 17:20.340
We have peer review of our policy and we have version control.

17:21.100 --> 17:27.140
And it also supports notifications for notifying owners of systems.

17:27.300 --> 17:32.740
Again, if you're operating in a DevOps mode, teams are owning their own systems and infrastructure.

17:33.000 --> 17:36.940
So we have been tagging resources in AWS with who owns what.

17:37.300 --> 17:48.800
So as part of that, since we have an email or an SNS topic as a tag on our resources in Amazon, Custodian can look at those tags in order to figure out how to deliver a notification that it did something.

17:50.240 --> 17:56.760
So one of the key pieces of Custodian when we looked at it for us was that it does have the ability to take action.

17:57.320 --> 18:03.600
And what I was trying to not do and something that in my mind does not scale well is to just have a tool that gives you a list of work to do.

18:03.660 --> 18:07.460
If you just get a list of all the problems, then you have to go do all that work.

18:07.480 --> 18:14.940
And it would be much more preferable if you could instead have it automatically take some action where it makes sense.

18:15.860 --> 18:22.380
And I want to show you what one of the example policies would look like before I talk too much more about that.

18:22.820 --> 18:25.360
But they're all defined with YAML.

18:25.360 --> 18:26.640
There's quite a lot on here.

18:26.980 --> 18:32.840
But effectively, this is a policy that we have written for unencrypted S3 buckets.

18:32.980 --> 18:38.260
We wanted to just encrypt everything so we didn't have to deal with figuring out what type of data was in there.

18:38.360 --> 18:41.360
So we wanted to make sure that buckets were encrypted.

18:41.600 --> 18:48.020
So there's a resource type, which is AWS S3, ensure that S3 buckets are encrypted.

18:48.400 --> 18:50.240
And then there's a mode.

18:50.240 --> 18:55.580
And what's interesting about Custodian is when you deploy it, you can run it several different ways.

18:55.580 --> 18:58.240
You can run it as a batch job from a CLI.

18:58.240 --> 19:02.480
It's just a Python module that can be run as a batch task.

19:02.480 --> 19:10.020
It can deploy automatically into AWS Lambda to run scheduled Lambdas or Lambdas that are triggered by CloudTrail events.

19:10.120 --> 19:15.040
Or it can generate CloudTrail rules inside of AWS.

19:15.540 --> 19:21.720
The method that we're using for most things is to do periodic scheduled Lambdas, hence the rate of five minutes.

19:21.780 --> 19:23.320
So this will run every five minutes.

19:23.320 --> 19:24.500
So again, it's reactionary.

19:24.500 --> 19:33.980
Within five minutes, though, in our development tier, what it's going to do then, if it finds, you notice in the filters it says bucket encryption state false.

19:34.100 --> 19:38.320
Any buckets that are not encrypted, it's going to execute the actions for.

19:38.560 --> 19:42.600
And in this case, the action we have is type set bucket encryption.

19:43.060 --> 19:49.060
So while we could take a more heavy handed approach and delete the bucket, we are trying our best to take a less heavy handed approach.

19:49.060 --> 19:55.420
And if we can just make it okay and then let the person know that we made it okay, or the owners know that we made it okay, we're trying to do that.

19:55.420 --> 20:00.020
So in this case, it will get encrypted and then owners will get notified.

20:00.860 --> 20:07.160
So how the notification works, it has a mailer component that is part of it.

20:07.700 --> 20:14.020
And the mailer component, you give it a little template for like an email message.

20:14.020 --> 20:20.360
I think it can integrate with some other services, too, because really what it does is it fires off a message into an SQS queue.

20:20.500 --> 20:23.820
So you could consume that and do whatever you wanted with it.

20:23.820 --> 20:31.060
We're simply using it for an email notification, but with SQS you could go notify pager duty or some other type of end point.

20:32.280 --> 20:45.060
So what it does is it looks at, um, the, uh, the resource owner in the two, that's defined as part of our mailer configuration.

20:45.060 --> 20:49.980
And what we defined in our mailer configuration was to look for a certain number of tags.

20:49.980 --> 20:55.440
And we use owner email as a tag and we also use owner SNS topic as a tag.

20:55.440 --> 21:07.140
So if either of those tags are defined, it's either going to send an email to the email address that's under owner email, or it's going to notify an SNS topic that's listed in the owner SNS topic tag.

21:08.120 --> 21:11.100
And then there's a little template for the message that they get.

21:11.100 --> 21:15.000
So it'll say an S3 bucket that is unencrypted has been detected.

21:15.000 --> 21:16.720
The bucket has been encrypted.

21:17.520 --> 21:21.300
Uh, so we're using custodian for a ton of things.

21:21.460 --> 21:35.860
We're using it for, um, deregistering old AMIs that aren't being used, for whitelisting AWS services, adding security groups, patching, and adding security group to patching for running or to running EC2 instances.

21:37.280 --> 21:52.320
Let's talk a little bit now about, uh, scanning and some of the things we've had to do because we are running immutable servers or servers as cattle where we don't want to fix them, we don't want to patch them, we want to patch the image and then destroy them and have them come back from a new image.

21:53.340 --> 22:01.380
So one of the issues that this caused for us is that if we defined a bunch of scans that had instances running, those instances might not be around for very long.

22:01.420 --> 22:06.300
Uh, so when they went away, we'd have to go back and update all of our scans.

22:06.780 --> 22:10.740
So we wanted to eliminate any manual effort to update our scan configurations.

22:11.120 --> 22:22.680
We decided to group instances logically by owner, so the host doesn't matter, the IP doesn't matter, what we, what matters is who owns the instance that's running at this point in time.

22:22.680 --> 22:26.020
And we wanted to support custom scans based on tags.

22:27.500 --> 22:33.320
So really we have two approaches to this and each of them relied on a lambda.

22:33.760 --> 22:50.740
Um, in the first case, we are using, we are integrated with tenable IO for scanning instances and there is a method of scanning where you scan from your scanner and you have a scanner running which is in the lower left and again we're running that in an auto scaling group of one so that might go away at any given time.

22:50.840 --> 22:56.980
So what we have to do is we run a lambda every so often to update the scanner on the scans that are defined.

22:57.280 --> 23:05.980
So when this gets destroyed and comes back as a new host, we'll then go update it on any scans that it was supposed to be defined on and that's all based off of tags.

23:06.500 --> 23:13.660
Likewise with EC2 instances, we have another lambda that based on tags will add them to appropriate scans.

23:13.660 --> 23:20.360
So if we want to do an agent based scan, or sorry, a scanner based scan, um, we can do that.

23:20.780 --> 23:22.640
And we don't have to maintain it.

23:22.640 --> 23:25.660
The lambda runs every so often and then the scan gets updated.

23:26.000 --> 23:30.180
Um, and then you see that little, that red box is a security group that's around those instances.

23:30.180 --> 23:34.660
We have a custodian policy that adds the rule so that the scanner can get in.

23:34.960 --> 23:36.420
Uh, so that's one scenario.

23:36.940 --> 23:39.840
Uh, another scenario is agent based scanning.

23:39.840 --> 23:48.720
We've updated all of our base images to include a tenable agent so that when new systems get launched, they'll automatically have the tenable agent installed.

23:48.720 --> 23:51.360
So when they come up, they'll register, they'll show up as an agent in tenable.

23:51.720 --> 23:59.800
Um, but we can't add them to a group or add them directly to a scan because if they get destroyed, it's going to go away and then they would have to be manually updated.

24:00.260 --> 24:05.040
So we did another thing based off of that owner email tag where we grouped them logically.

24:05.040 --> 24:11.260
We created, we created agent groups inside of tenable for each owned group of servers.

24:11.880 --> 24:17.960
And we have a lambda that runs that adds the agents to the relevant groups.

24:17.960 --> 24:24.300
When agents go offline, they automatically get cleaned up after a day or two based on the tenable configuration.

24:24.560 --> 24:31.420
Um, but for any instances that came back after having been destroyed, the lambda runs and then they get added to the groups.

24:31.420 --> 24:38.120
So we're able to define scans to scan machines that are in agent groups and we don't have to do any maintenance for when those machines go away.

24:41.810 --> 24:51.030
Uh, two other quick things I'm going to touch on are just how we're using two other products from HashiCorp, Packer for building images and Terraform for launching our infrastructure.

24:51.310 --> 24:53.910
And these are in the vein of that secure by default.

24:54.170 --> 25:02.650
Uh, so this is sort of the start of our platform as a service mentality where we're providing things for people to consume so that it's easy for them.

25:02.730 --> 25:10.770
Um, this is a, a sample Packer build template that we have for, uh, Amazon Linux and this is our base template that all the teams use.

25:10.770 --> 25:12.610
And then they just pass variables into it.

25:12.610 --> 25:17.370
So as a cloud development team, we created this initially and then all the teams started using it.

25:17.370 --> 25:26.390
And a, a few of the security features I have highlighted that went into the initial version so that any team that consumed this just got those and they didn't even have to think about what to set them to.

25:26.390 --> 25:34.690
Uh, the first is that when they select a source AMI based off of a filter, it restricts it to just instances or images that are owned by our accounts.

25:35.290 --> 25:40.790
Um, we're also encrypting the boot volume by default and applying a tagging policy.

25:42.990 --> 25:51.690
Uh, with Terraform, we've started, you know, Terraform could be a talk all by itself, um, but just a one shot here of some of the things we're doing.

25:51.690 --> 25:57.330
With Terraform , you deploy resources and then any group of Terraform code can be used as a module.

25:57.330 --> 25:59.990
So we've defined reusable modules for a lot of things.

25:59.990 --> 26:17.410
One of them, this is an example of us, uh, using our web farm module where a consumer of this just has to specify some information like which VPC, their service port, min and max size, um, what their health check path is and then if they want an auto scaling notification,

26:17.410 --> 26:18.810
they can pass an ARN.

26:19.110 --> 26:25.570
Um, but what they get from this is all the infrastructure designed as we saw fit to architect it without having to launch a load balancer.

26:25.570 --> 26:28.450
Make sure it was in the public subnet if they were internet facing.

26:28.530 --> 26:30.970
Do all, make sure all their instances are in the private subnet.

26:30.970 --> 26:33.050
Get everything registered with DNS properly.

26:33.050 --> 26:34.550
So it does all that for them.

26:36.350 --> 26:39.750
Um, I have some stuff of what, what went not, not so well.

26:39.750 --> 26:48.190
I'm running out of time so I will, I'll, I'll leave this up here for a second and then we can take any questions out into the hallway.

26:48.430 --> 26:53.470
Um, but really it was our pace that made us kind of be, start playing catch up from the beginning.

26:53.490 --> 26:56.910
Um, so we started doing a lot of work before we had custodian deployed.

26:57.050 --> 27:01.010
Teams started rolling their own Terraform before we had modules for everything.

27:01.450 --> 27:02.710
Um, so it's stuff like that.

27:02.710 --> 27:11.910
We have a lot of work we still want to do and one of the cool things about DEF CON is I'm sure everyone has great ideas for me, uh, on how we can take this further or alternative ideas.

27:11.910 --> 27:15.210
So if we could chat about that in the hall, uh, that would be great.

27:15.210 --> 27:17.830
I will hang around for as long as people want to talk.

27:19.470 --> 27:20.490
Thank you.

27:23.490 --> 27:24.210
All right.

27:24.210 --> 27:25.470
We got five more.

27:26.210 --> 27:26.850
Okay.

27:31.370 --> 27:32.690
All right.

27:32.750 --> 27:34.190
Thought he was waving me off.

27:34.190 --> 27:35.570
So all right in the back.

27:41.670 --> 27:42.270
Yeah.

27:42.270 --> 27:46.530
So when we, we automate, we use Chef to build images with Packer.

27:46.570 --> 27:53.090
Uh, Packer builds the image and you can, you do VMware or EBS on Amazon or several other formats.

27:53.090 --> 27:54.490
And then there's different provisioners.

27:54.490 --> 27:55.330
So we use Chef.

27:55.490 --> 27:59.150
Um, as part of our Chef, we use InSpec to run, uh, tests.

27:59.170 --> 28:03.770
So as part of our image build pipeline, we'll run all of our tests before they get merged back to master.

28:03.870 --> 28:06.690
And then that'll build us our real AMIs.

28:06.890 --> 28:14.370
Um, with Terraform, we've had with the modules, what we'd like to do is run a quick smoke test to stand up an instance of that module.

28:14.370 --> 28:20.910
So a web farm, or, um, we have another one for like, uh, an RDS, uh, Postgres instance.

28:20.950 --> 28:24.270
So we'll have a test to stand that up and then tear it down.

28:24.270 --> 28:26.530
There's a lot more that we could be doing with some of that.

28:26.530 --> 28:28.310
Um, but that's just what we've done so far.

28:29.270 --> 28:30.070
Yeah.

28:31.010 --> 28:32.070
In the hat.

28:38.800 --> 28:39.500
The tags.

28:39.500 --> 28:42.420
So our tagging structure, I think, is fairly standard.

28:42.560 --> 28:48.860
We use tags, application for which application it's part of, environment, which environment it's running in.

28:49.360 --> 28:55.860
Um, because in some accounts, we might have more than one environment running, like QA or integration testing on like a middle tier.

28:56.020 --> 28:57.580
Um, and then we have role.

28:57.580 --> 29:02.940
So the role within that application and environment, like database or web server.

29:03.080 --> 29:06.660
Uh, so those are the primary tags we use for grouping things.

29:06.660 --> 29:14.140
Um, and then as far as ownership goes, we use those owner email tags or SNS topics to keep track of who owns what.

29:14.620 --> 29:16.820
Um, yeah.

29:19.600 --> 29:20.300
Yeah.

29:23.500 --> 29:24.920
You would think so.

29:26.340 --> 29:30.080
Um, I have more details out there.

29:30.080 --> 29:40.520
It's, it's kind of a long discussion, but, um, they kind of force us into a mode where we weren't able to take advantage of some of the stuff like AWS organizations and control tower and some of that stuff they have.

29:41.640 --> 29:42.460
It is.

29:42.460 --> 29:46.060
It didn't exist when we, uh, when we first started working with them.

29:46.060 --> 29:49.000
And then they, we just haven't evolved it around.

29:49.000 --> 29:51.940
I don't even know if they support it yet, but we have to work with them on that.

29:53.580 --> 29:54.300
Uh, not yet.

29:54.300 --> 29:55.840
I got about a minute.

30:03.260 --> 30:04.220
Oh yeah.

30:09.080 --> 30:18.600
Well, when teams update the code, if they violate the policy, they're going to, that action is going to run, which may be turn on encryption if it's not there, but it may be destroy the resource.

30:19.260 --> 30:31.300
And we have had some race conditions with things like, um, if you deploy a load balancer, we wanted to make sure that you had an HTTPS listener so that you weren't just rolling an unencrypted web service.

30:31.440 --> 30:35.320
So the, but the problem is the load balancer gets deployed before the listeners.

30:35.320 --> 30:38.960
And then the policy was catching that and destroying things before the whole thing was done.

30:39.080 --> 30:45.720
Uh, likewise with tagging on instances, if we wanted to make sure things were tagged, uh, tagging is a separate operation.

30:45.720 --> 30:48.580
That's when Terraform stands up, uh, an EC2 instance.

30:48.580 --> 30:55.380
And that might be because of the AWS API, uh, but it'll create the instance and then subsequently apply the tag.

30:55.380 --> 30:58.300
So if custodian runs in between those two, it's going to say, you don't have tags.

30:58.300 --> 31:00.180
I'm going to destroy you.

31:00.600 --> 31:01.880
Yeah, we can go out in the hall.

31:01.880 --> 31:02.280
Yeah.

