[00:00.000 --> 00:03.940] All right. Thanks a lot. And thank you all for filling this arguably a little bit small [00:03.940 --> 00:07.600] room. But it's cool. I'll tell everyone the room was full and not how many people were [00:07.600 --> 00:12.400] in it. So thank you for coming. I work at DirectSupply. I'm a technical fellow and chief [00:12.400 --> 00:17.860] software architect. 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:30.920] So things for nursing homes, assisted living, apps where they can do maintenance on their [00:30.920 --> 00:35.680] equipment, all the way through e‑commerce sites where they can buy products and food for [00:35.680 --> 00:42.360] the residents. So we've been undergoing a journey to migrate into the cloud for about the [00:42.360 --> 00:48.580] past two years. I've been interested in going in that direction for longer than that. But it [00:48.580 --> 00:53.600] was only about two years ago when we decided to do this. And a big part of the talk today is [00:53.600 --> 00:57.580] kind of around how we've migrated somewhat from a traditional infrastructure and software [00:57.580 --> 01:03.560] culture, you know, two different silos, to the DevOps mode where development teams are [01:03.560 --> 01:09.660] owning their own deployments and how we're starting to scale the security amongst those [01:09.660 --> 01:17.290] DevOps teams. Now, I do have a lot to talk about. I will stay out in the hall for questions [01:17.290 --> 01:20.030] afterwards. So if you would just hold them to the end, that would be great. I have some [01:20.030 --> 01:24.190] slides I was going to maybe have to skip over, but hopefully I won't have to. But I wanted to [01:24.190 --> 01:28.530] talk about first our company's cloud vision and strategy that I was part of putting [01:28.530 --> 01:32.890] together. When we decided to migrate into the cloud, we wanted to make sure that we took [01:32.890 --> 01:36.010] advantage of a lot of the things that the cloud was going to get us. We didn't want to [01:36.010 --> 01:41.090] just take our applications as they were running and then shift them to run on EC2 [01:41.090 --> 01:45.350] instances in AWS. An argument you might hear is that, well, you don't own the [01:45.350 --> 01:49.970] infrastructure. And that's true. We don't own the infrastructure, but we can architect for [01:49.970 --> 01:55.630] not owning the infrastructure. So part of the strategy included things like immutable [01:55.630 --> 01:59.870] servers. If you've heard of this, this is the idea that once you run a server, you're not [01:59.870 --> 02:04.570] going to change it. If you want to change it, you will tear that server down and relaunch [02:04.570 --> 02:11.510] from a new image that you've built. We wanted to embrace infrastructure as code. We had [02:11.510 --> 02:18.230] limited scripting in our old infrastructure world and part of the programmability of the [02:18.230 --> 02:21.710] cloud is that you can take advantage of all of the things that software development teams [02:21.710 --> 02:27.610] have been able to take advantage of for a very long time. Like version control, peer review, [02:27.610 --> 02:33.410] automated deployments and automated testing. Which takes me to automated deployments. We [02:33.410 --> 02:36.650] wanted to make sure that our deployments as we ran them in different accounts and in [02:36.650 --> 02:41.430] different environments were the same. And the best way to do that is through automation. You [02:41.430 --> 02:45.430] can write a very long document with step by step pros of what to do, but if somebody's [02:45.430 --> 02:51.430] doing it, they're going to do something slightly different each time. A big part of what I'll [02:51.430 --> 02:55.990] be talking about today is we wanted to encourage defaults to be secure so that as [02:55.990 --> 03:01.510] development teams started rolling infrastructure, they would get secure defaults. And maybe [03:01.510 --> 03:04.830] they weren't even consciously getting them, but we were trying to take some of those [03:04.830 --> 03:08.890] decisions away from them so that when they just ran the thing the easiest way that we [03:08.890 --> 03:17.150] provided for them to do it, it would be secure. And finally, and this is a bit more of a [03:17.150 --> 03:21.070] migration over the next couple years, but I will touch on this later as we're starting to [03:21.210 --> 03:26.690] provide a platform as a service for our software delivery teams. And the idea here is [03:26.690 --> 03:32.750] that now that we've scaled infrastructure out and ownership out to across all of our [03:32.750 --> 03:37.990] software development teams, now we want to provide more abstractions for them to use to [03:37.990 --> 03:45.520] run their applications in the cloud. So I want to start by just talking about the [03:45.960 --> 03:50.120] programmability of the cloud and some of the things that it can get you. And it kind of [03:50.120 --> 03:55.320] hit me that there's pretty much four layers of making use of programmability with your [03:55.320 --> 04:01.020] infrastructure. The first is you have no automation. You do things by hand and you have [04:01.020 --> 04:07.420] people that really like doing things by hand. Eventually you start to script up some of [04:07.420 --> 04:11.980] your work. If you've worked against a traditional infrastructure like a VMware, some of [04:11.980 --> 04:17.620] those have been a lot more difficult to automate. And part of the programmability of the [04:17.620 --> 04:22.820] cloud, it makes that a lot easier and a lot more reproducible. As you begin to progress, [04:22.820 --> 04:27.540] you'll get into DevOps and continuous delivery. And again, now we're fully taking [04:27.540 --> 04:33.200] advantage of the cloud for our deployment reasons. But the final level of taking advantage [04:33.200 --> 04:41.060] of cloud programmability is using it for evil. So I'm going to hit with just one quick thing. We [04:41.060 --> 04:49.340] had an accidental commit to GitHub of some AWS access keys. And I don't know if anyone's [04:49.340 --> 04:57.660] experienced that, but what do you think happened? GitHub, it was public. You don't get to [04:57.660 --> 05:03.680] answer because you know what happened. We might talk about this in threat modeling and [05:03.680 --> 05:09.900] your threat might, like your impact could go all the way up to someone could potentially [05:09.900 --> 05:14.460] like encrypt all of your data or delete or destroy all of your data in that account. Destroy [05:14.460 --> 05:20.700] all of your infrastructure. But because of the automated nature of the programmability of [05:20.700 --> 05:24.380] the cloud, what happened was a bot found that on GitHub and then just started launching [05:24.380 --> 05:31.360] instances to mine cryptocurrency. So there was really no damages. There weren't any [05:31.360 --> 05:36.660] damages to our infrastructure. Amazon noticed this within a few minutes and disabled the [05:36.660 --> 05:40.280] account and it was a development account. So it wasn't our production account that was [05:40.280 --> 05:47.580] disabled. But it's kind of that idea that if you're not ruthless enough in attacking someone [05:47.580 --> 05:51.600] else is going to take that place. And there was a very small window of opportunity where [05:51.600 --> 05:56.380] somebody could do damage. And it seemed like the lowest, like if you talk about like [05:56.380 --> 06:01.540] electricity is going to follow the path of least resistance, the attack was one of [06:02.660 --> 06:08.480] convenience and it cost I think about $800 when it was done because we got stuff shut down [06:08.480 --> 06:13.880] really quick. So in the end it wasn't that bad. But I just wanted to point out that you can use [06:13.880 --> 06:21.340] the same programmability of the cloud for both good and evil. So as we're migrating into [06:21.340 --> 06:26.060] this mode of DevOps, we started trying to figure out how are we going to be able to do more [06:26.060 --> 06:32.220] with less. And I don't mean do more, like do less security. We wanted to do more security. [06:32.220 --> 06:36.840] But since things are now spread out across development teams without hiring teams and [06:36.840 --> 06:40.780] teams of individuals focused on security, we weren't going to be able to keep up with [06:40.780 --> 06:50.150] development. So we have to start spreading some of that out across the teams. I'm going to [06:50.150 --> 06:54.950] talk now about a few of the open source things that we use to both help with that issue we [06:54.950 --> 07:03.550] had with the GitHub push of the keys. And also solve a number of our other security issues [07:03.550 --> 07:07.990] in the cloud. And the first is a product from HashiCorp called Vault. I don't work for them. [07:07.990 --> 07:13.210] I'm a huge fan and their open source product gets you a lot of things you wouldn't even [07:13.210 --> 07:19.110] expect. Like companies that do open source sometimes will save the LDAP integration or the [07:19.110 --> 07:22.950] UI for the commercial versions. But they've got so much in their open source that it's [07:22.950 --> 07:28.010] almost unbelievable. But what Vault is, and this is right from their website, it's a product [07:28.010 --> 07:33.090] to secure, store and tightly control access tokens or access to tokens, passwords, [07:33.090 --> 07:37.910] certificates, encryption keys for protecting secrets and other sensitive data using a UI, [07:37.910 --> 07:45.210] CLI or an HTTP API. So it does a lot of stuff. And they kind of flag it as security as a [07:45.210 --> 07:51.090] service. You've got this very secure box that does all these things for you. We're not using [07:51.090 --> 07:57.450] it for all of its uses. We are using it, uh, for these use cases. We're using it to store [07:57.450 --> 08:03.250] static secrets. Things using its key value secrets engine. And these would be things like [08:03.250 --> 08:07.790] passwords to back end services. If we had like access to a third party API and we needed to [08:07.790 --> 08:12.230] store some sort of key. Um, that's a piece of information that does not change. We need to [08:12.230 --> 08:20.850] store and access that securely. Vault also has the potential to deal with dynamic secrets. And [08:20.850 --> 08:26.130] these are things that can change. And the idea of them changing is interesting because it [08:26.130 --> 08:32.470] allows you to lease them for a certain amount of time. First that we, the first, uh, dynamic [08:32.470 --> 08:38.910] secret engine that we use is one for Postgres. Um, historically, when we were on prem, the [08:38.910 --> 08:43.550] vast majority of our databases were running Microsoft SQL server and we had them on our [08:43.550 --> 08:48.490] domain and we used integrated Windows authentication between applications in the [08:48.490 --> 08:53.650] database. And then when users needed to get access to those databases, we granted, you know, [08:53.650 --> 08:58.170] put them in roles based on their domain account. We wanted something similar, but with the [08:58.170 --> 09:01.470] dynamic nature of the cloud and things coming up and down all the time, we didn't want that [09:01.470 --> 09:06.390] coupling to a domain. So we've not made any attempt as we started to move into Postgres to [09:06.390 --> 09:11.030] get those onto our domain or to do LDAP authentication. Uh, but one thing that Vault can [09:11.030 --> 09:17.870] do is it can dynamically generate me, if I'm a developer, a username and password to access [09:17.870 --> 09:23.870] that Postgres server that's good for an hour. So Vault will authenticate me on our domain and [09:23.870 --> 09:29.130] then I have access to a policy that lets me generate a username and password for a specific [09:29.130 --> 09:34.410] Postgres instance. And it's good for a certain amount of time. So it gets us effectively the [09:34.410 --> 09:39.650] same thing without the database having to be tied to our domain. Uh, the second thing is that [09:39.650 --> 09:44.650] after our incident with the GitHub push of the access keys is we don't issue access keys to [09:44.650 --> 09:51.790] anybody anymore. Vault has an AWS secrets engine where me as a developer, I can authenticate to [09:51.790 --> 09:57.510] Vault using my domain credentials and then I can request a key pair that's good for a certain [09:57.510 --> 10:02.790] amount of time. And there's a maximum. I have an example of how we do this. Um, but then if [10:02.790 --> 10:07.130] that key got leaked, that would further limit the usefulness of the how, what you could do [10:07.130 --> 10:13.550] with it. Um, and the third thing that we're using it for right now is one time password to log [10:13.550 --> 10:20.070] into EC2 instances. It can do the same thing for, uh, Linux servers that it can do for like [10:20.070 --> 10:23.790] Postgres. It can generate a username and password that you can use to log in and it's only [10:23.790 --> 10:32.090] good for so long. Okay, so authentication to Vault, um, all of the components to Vault are [10:32.090 --> 10:36.390] pluggable. So you can authenticate to it different ways. We use LDAP for our user accounts [10:36.830 --> 10:42.350] and then with systems that are running in AWS, they'll use IAM to authenticate. Um, you can [10:42.350 --> 10:47.610] also use username and password or GitHub or any other mechanism, but it's all pluggable. Um, [10:47.610 --> 10:52.670] but I wanted to show really quick from the CLI how, I hope this is visible in the back, how we [10:52.670 --> 10:56.890] authenticate to Vault. We set our Vault adder environment variable to point at our Vault [10:56.890 --> 11:02.470] server and then we just issue a Vault login method LDAP and username equals whatever my LDAP [11:02.470 --> 11:08.230] username is. In a few seconds, it comes back. It issues me a token. That's good for, [11:08.230 --> 11:15.130] according to the output, 60 minutes. And at the bottom, you can see the policies that I have [11:15.130 --> 11:20.350] access to. This is in our development tier, so in this tier, I'm effectively an admin and you [11:20.350 --> 11:25.230] can see I have access to three policies. One is AWS API engineer, meaning that I'm an [11:25.230 --> 11:30.510] engineer that's going to use the CLI or the SDK to access AWS and that's what lets me [11:30.510 --> 11:37.170] generate access keys for AWS. Uh, there's the EC2 user OTP for one time passwords to let me [11:37.170 --> 11:42.390] generate one time passwords. Uh, this is the admin level, so this would be to any EC2 [11:42.390 --> 11:50.410] instance. And secrets read write allows me to get access to the key value store. You can make [11:50.410 --> 11:55.710] these policies as granular as you wish and they can be specific to just one path involved. So [11:55.710 --> 12:02.570] you might have an application secrets at slash secrets slash my application and if you have a [12:02.570 --> 12:06.810] team that operates just that application, you can define your policies so that they can just [12:06.810 --> 12:14.550] get access to secrets under that path. Uh, but these policies are pretty broad, uh, since I am [12:14.550 --> 12:21.210] an admin on this, uh, tier. Uh, the next piece is just an example of how you interact with the [12:21.210 --> 12:29.770] key value secrets engine. In this case, I'm issuing a vault KV get command. I'm asking for a [12:29.770 --> 12:34.070] specific field because what we store at those keys are JSON documents. So you can have any [12:34.070 --> 12:40.290] number of, uh, key values within that one document. Um, I'm asking for a field called gossip [12:40.290 --> 12:45.310] encryption key and it's at the path secrets slash console, which is another product we're [12:45.310 --> 12:50.150] working to roll out. Um, and then the output is simply the secret. So what would happen is [12:50.150 --> 12:56.350] the application that needs access to this secret would have an IAM policy defined that would get [12:56.350 --> 13:01.710] them access to a vault policy which says I can read this secret. And then when those instances [13:01.710 --> 13:06.070] run, when they start up, part of their bootstrap script will be to authenticate the vault using [13:06.070 --> 13:11.610] IAM and get this information and most likely, uh, plop it into an environment variable for the [13:11.610 --> 13:19.110] process. So at no point do we need to build these secrets into our images. We request them at [13:19.110 --> 13:22.670] runtime or at start time and then they become part of the environment for whatever process [13:22.670 --> 13:33.130] needs them. A quick example of how we generate secrets for Postgres. This look, the syntax is a [13:33.130 --> 13:38.110] little bit different, but in this case we have a databases secrets engine for a specific [13:38.110 --> 13:44.390] database. So it would be databases slash myDB. And then when you configure it, you define [13:44.390 --> 13:48.830] policies within there for like read only or read write. And then that ties back to the [13:48.830 --> 13:53.510] permissions that the Postgres users have on your underlying database. But if I issue a vault [13:53.510 --> 14:01.650] read databases myDB slash cred slash read only, you'll see it issues me a lease for one hour and [14:01.650 --> 14:05.850] it gives me a username and a password which I can then use to go attach to that Postgres [14:05.850 --> 14:16.050] instance. After an hour, it's expired and does not work anymore. Likewise for AWS, for as a [14:16.050 --> 14:21.850] developer, when I need access to a key pair to use, I will issue a vault write to AWS slash [14:21.850 --> 14:29.010] STS slash in this case engineer. And the way this manifests is then I will assume an engineer [14:29.010 --> 14:34.510] role within AWS. We define a role and if you've ever used federation or done any type of role [14:34.510 --> 14:38.890] assumption, you're not logging in with an IAM user, you're logging in, you're [14:38.890 --> 14:44.170] authenticating some other way and then you're assuming a role within IAM. So when I issue [14:44.170 --> 14:50.230] this vault write and when I put this together, I asked for a TTL of 600 minutes just to see what [14:50.230 --> 14:55.570] would happen because I didn't know. And it did issue me a one hour, it was maxed at one hour [14:55.570 --> 15:00.410] lease. So the token I got back was good for one hour and then I get an access key, a secret key [15:00.410 --> 15:06.150] and a token which I can use to run AWS configure. I did have to abridge part of this security [15:06.150 --> 15:10.710] token but the access key and secret key were actual keys for our accounts but I'm confident [15:10.710 --> 15:19.060] that they are no good anymore. So I'm showing them at DEF CON. Get a picture. It will be in [15:19.060 --> 15:25.960] the slides. For one time passwords, I want to connect as an operations person to an EC2 [15:25.960 --> 15:32.660] instance and the way I do that is by issuing another vault write to SSH slash creds, that's [15:32.660 --> 15:40.120] the secrets engine for a read user OTP, this is read only access to an EC2 server and I give it [15:40.120 --> 15:46.960] the IP address. It again has a lease duration of one hour and it outputs the username to use, [15:46.960 --> 15:52.440] read user and the key which is the password. So then you can just do a regular username [15:52.440 --> 16:00.880] password SSH onto that EC2 box. Nothing to clean up after an hour. So that's kind of a lot of [16:00.880 --> 16:05.420] what we're doing with vault. The next thing I want to talk about is something that we've [16:05.420 --> 16:13.040] deployed in order to enforce policies against our AWS configuration itself. Everyone's seen [16:13.040 --> 16:18.300] the news, company releases a public S3 bucket and someone finds a bunch of data or something [16:18.300 --> 16:23.180] else is misconfigured and there's a big data leak. But with teams owning their own [16:23.180 --> 16:28.060] infrastructure, we have deployed a product from Capital One, that's open source called [16:28.060 --> 16:40.300] Cloud Custodian. Yeah. Right. Well, maybe they do. Maybe they don't have their policies defined [16:40.300 --> 16:46.860] correctly. But what we're getting from Cloud Custodian is the configuration governance. Again, [16:46.860 --> 16:52.660] it's policy as code. We get automated checking and enforcement of infrastructure that gets [16:52.660 --> 16:59.440] deployed. And we're running multiple AWS accounts. So even though this is a reactive thing, [16:59.440 --> 17:03.720] the infrastructure gets built and then Custodian notices it doesn't fit the policy and then it [17:03.720 --> 17:08.020] does something. But that happens in our development account, which is before it would [17:08.020 --> 17:14.540] get up to production, theoretically. It does get us policy as code. So again, we have [17:14.540 --> 17:19.400] automated deployments of our policy. We have peer review of our policy and we have version [17:19.400 --> 17:28.540] control. And it also supports notifications for notifying owners of systems. Again, if you're [17:28.540 --> 17:33.240] operating in a DevOps mode, teams are owning their own systems and infrastructure. So we [17:33.240 --> 17:39.040] have been tagging resources in AWS with who owns what. So as part of that, since we have an [17:39.040 --> 17:45.420] email or an SNS topic as a tag on our resources in Amazon, Custodian can look at those tags in [17:45.420 --> 17:51.000] order to figure out how to deliver a notification that it did something. So one of the key [17:51.000 --> 17:56.100] pieces of Custodian when we looked at it for us was that it does have the ability to take [17:56.100 --> 18:01.120] action. And what I was trying to not do and something that in my mind does not scale well is [18:01.120 --> 18:04.840] to just have a tool that gives you a list of work to do. If you just get a list of all the [18:04.840 --> 18:11.080] problems, then you have to go do all that work. And it would be much more preferable if you [18:11.080 --> 18:17.060] could instead have it automatically take some action where it makes sense. And I want to show [18:17.060 --> 18:22.380] you what one of the example policies would look like before I talk too much more about that. [18:22.820 --> 18:29.120] But they're all defined with YAML. There's quite a lot on here. But effectively, this is a [18:29.120 --> 18:35.420] policy that we have written for unencrypted S3 buckets. We wanted to just encrypt everything so [18:35.420 --> 18:39.800] we didn't have to deal with figuring out what type of data was in there. So we wanted to make [18:39.800 --> 18:46.940] sure that buckets were encrypted. So there's a resource type, which is AWS S3, ensure that S3 [18:46.940 --> 18:52.100] buckets are encrypted. And then there's a mode. And what's interesting about Custodian is when [18:52.100 --> 18:58.240] you deploy it, you can run it several different ways. You can run it as a batch job from a CLI. [18:58.240 --> 19:04.320] It's just a Python module that can be run as a batch task. It can deploy automatically into [19:04.320 --> 19:11.020] AWS Lambda to run scheduled Lambdas or Lambdas that are triggered by CloudTrail events. Or it [19:11.020 --> 19:18.020] can generate CloudTrail rules inside of AWS. The method that we're using for most things is to do [19:18.020 --> 19:22.820] periodic scheduled Lambdas, hence the rate of five minutes. So this will run every five [19:22.820 --> 19:28.020] minutes. So again, it's reactionary. Within five minutes, though, in our development tier, what [19:28.020 --> 19:33.120] it's going to do then, if it finds, you notice in the filters it says bucket encryption state [19:33.120 --> 19:39.040] false. Any buckets that are not encrypted, it's going to execute the actions for. And in this [19:39.040 --> 19:44.420] case, the action we have is type set bucket encryption. So while we could take a more heavy [19:44.420 --> 19:48.300] handed approach and delete the bucket, we are trying our best to take a less heavy handed [19:48.300 --> 19:52.720] approach. And if we can just make it okay and then let the person know that we made it okay, or [19:52.720 --> 19:56.560] the owners know that we made it okay, we're trying to do that. So in this case, it will get [19:56.560 --> 20:04.720] encrypted and then owners will get notified. So how the notification works, it has a mailer [20:04.720 --> 20:13.060] component that is part of it. And the mailer component, you give it a little template for like [20:13.060 --> 20:17.260] an email message. I think it can integrate with some other services, too, because really what [20:17.260 --> 20:22.620] it does is it fires off a message into an SQS queue. So you could consume that and do whatever [20:22.620 --> 20:27.960] you wanted with it. We're simply using it for an email notification, but with SQS you could go [20:27.960 --> 20:39.940] notify pager duty or some other type of end point. So what it does is it looks at, um, the, uh, [20:39.940 --> 20:45.400] the resource owner in the two, that's defined as part of our mailer configuration. And what we [20:45.400 --> 20:51.300] defined in our mailer configuration was to look for a certain number of tags. And we use owner [20:51.300 --> 20:56.580] email as a tag and we also use owner SNS topic as a tag. So if either of those tags are [20:56.580 --> 21:01.820] defined, it's either going to send an email to the email address that's under owner email, or [21:01.820 --> 21:08.940] it's going to notify an SNS topic that's listed in the owner SNS topic tag. And then there's a [21:08.940 --> 21:14.020] little template for the message that they get. So it'll say an S3 bucket that is unencrypted has [21:14.020 --> 21:20.560] been detected. The bucket has been encrypted. Uh, so we're using custodian for a ton of [21:20.560 --> 21:25.980] things. We're using it for, um, deregistering old AMIs that aren't being used, for [21:25.980 --> 21:32.600] whitelisting AWS services, adding security groups, patching, and adding security group to [21:32.600 --> 21:39.540] patching for running or to running EC2 instances. Let's talk a little bit now about, uh, [21:39.540 --> 21:44.480] scanning and some of the things we've had to do because we are running immutable servers or [21:44.480 --> 21:48.740] servers as cattle where we don't want to fix them, we don't want to patch them, we want to [21:48.740 --> 21:54.160] patch the image and then destroy them and have them come back from a new image. So one of the [21:54.160 --> 21:58.520] issues that this caused for us is that if we defined a bunch of scans that had instances [21:58.520 --> 22:03.980] running, those instances might not be around for very long. Uh, so when they went away, we'd [22:03.980 --> 22:08.900] have to go back and update all of our scans. So we wanted to eliminate any manual effort to [22:08.900 --> 22:15.600] update our scan configurations. We decided to group instances logically by owner, so the host [22:15.600 --> 22:21.220] doesn't matter, the IP doesn't matter, what we, what matters is who owns the instance that's [22:21.220 --> 22:28.200] running at this point in time. And we wanted to support custom scans based on tags. So really [22:28.200 --> 22:35.580] we have two approaches to this and each of them relied on a lambda. Um, in the first case, we [22:35.580 --> 22:41.400] are using, we are integrated with tenable IO for scanning instances and there is a method of [22:41.400 --> 22:45.760] scanning where you scan from your scanner and you have a scanner running which is in the lower [22:45.760 --> 22:50.060] left and again we're running that in an auto scaling group of one so that might go away at any [22:50.060 --> 22:55.400] given time. So what we have to do is we run a lambda every so often to update the scanner on [22:55.400 --> 23:00.380] the scans that are defined. So when this gets destroyed and comes back as a new host, we'll [23:00.380 --> 23:05.040] then go update it on any scans that it was supposed to be defined on and that's all based off [23:05.040 --> 23:12.040] of tags. Likewise with EC2 instances, we have another lambda that based on tags will add them [23:12.040 --> 23:17.940] to appropriate scans. So if we want to do an agent based scan, or sorry, a scanner based scan, [23:17.940 --> 23:24.500] um, we can do that. And we don't have to maintain it. The lambda runs every so often and then the [23:24.500 --> 23:29.040] scan gets updated. Um, and then you see that little, that red box is a security group that's [23:29.040 --> 23:33.920] around those instances. We have a custodian policy that adds the rule so that the scanner can [23:33.920 --> 23:40.100] get in. Uh, so that's one scenario. Uh, another scenario is agent based scanning. We've [23:40.100 --> 23:45.840] updated all of our base images to include a tenable agent so that when new systems get [23:45.840 --> 23:49.340] launched, they'll automatically have the tenable agent installed. So when they come up, [23:49.340 --> 23:54.040] they'll register, they'll show up as an agent in tenable. Um, but we can't add them to a group [23:54.040 --> 23:58.080] or add them directly to a scan because if they get destroyed, it's going to go away and then [23:58.080 --> 24:02.800] they would have to be manually updated. So we did another thing based off of that owner email [24:02.800 --> 24:08.820] tag where we grouped them logically. We created, we created agent groups inside of tenable for [24:08.820 --> 24:17.280] each owned group of servers. And we have a lambda that runs that adds the agents to the relevant [24:17.280 --> 24:22.340] groups. When agents go offline, they automatically get cleaned up after a day or two based on [24:22.340 --> 24:27.920] the tenable configuration. Um, but for any instances that came back after having been [24:27.920 --> 24:32.360] destroyed, the lambda runs and then they get added to the groups. So we're able to define [24:32.360 --> 24:36.780] scans to scan machines that are in agent groups and we don't have to do any maintenance for when [24:36.780 --> 24:44.670] those machines go away. Uh, two other quick things I'm going to touch on are just how we're [24:44.670 --> 24:49.970] using two other products from HashiCorp, Packer for building images and Terraform for launching [24:49.970 --> 24:55.510] our infrastructure. And these are in the vein of that secure by default. Uh, so this is sort [24:55.510 --> 25:00.510] of the start of our platform as a service mentality where we're providing things for people [25:00.510 --> 25:06.050] to consume so that it's easy for them. Um, this is a, a sample Packer build template that we [25:06.050 --> 25:11.150] have for, uh, Amazon Linux and this is our base template that all the teams use. And then [25:11.150 --> 25:15.370] they just pass variables into it. So as a cloud development team, we created this initially [25:15.370 --> 25:19.830] and then all the teams started using it. And a, a few of the security features I have [25:19.830 --> 25:23.870] highlighted that went into the initial version so that any team that consumed this just got [25:23.870 --> 25:27.630] those and they didn't even have to think about what to set them to. Uh, the first is that when [25:27.630 --> 25:33.190] they select a source AMI based off of a filter, it restricts it to just instances or images [25:33.190 --> 25:38.910] that are owned by our accounts. Um, we're also encrypting the boot volume by default and [25:38.910 --> 25:47.330] applying a tagging policy. Uh, with Terraform, we've started, you know, Terraform could be a [25:47.330 --> 25:52.230] talk all by itself, um, but just a one shot here of some of the things we're doing. With [25:52.230 --> 25:57.330] Terraform, you deploy resources and then any group of Terraform code can be used as a [25:57.330 --> 26:01.850] module. So we've defined reusable modules for a lot of things. One of them, this is an [26:01.850 --> 26:07.670] example of us, uh, using our web farm module where a consumer of this just has to specify [26:07.670 --> 26:13.910] some information like which VPC, their service port, min and max size, um, what their health [26:13.910 --> 26:19.490] check path is and then if they want an auto scaling notification, they can pass an ARN. Um, [26:19.490 --> 26:22.770] but what they get from this is all the infrastructure designed as we saw fit to [26:22.770 --> 26:26.570] architect it without having to launch a load balancer. Make sure it was in the public [26:26.570 --> 26:30.270] subnet if they were internet facing. Do all, make sure all their instances are in the [26:30.270 --> 26:36.750] private subnet. Get everything registered with DNS properly. So it does all that for them. Um, [26:36.750 --> 26:41.890] I have some stuff of what, what went not, not so well. I'm running out of time so I will, [26:41.890 --> 26:47.530] I'll, I'll leave this up here for a second and then we can take any questions out into the [26:47.530 --> 26:52.670] hallway. Um, but really it was our pace that made us kind of be, start playing catch up from [26:52.670 --> 26:56.910] the beginning. Um, so we started doing a lot of work before we had custodian deployed. [26:57.050 --> 27:01.970] Teams started rolling their own Terraform before we had modules for everything. Um, so [27:01.970 --> 27:05.310] it's stuff like that. We have a lot of work we still want to do and one of the cool things [27:05.310 --> 27:10.150] about DEF CON is I'm sure everyone has great ideas for me, uh, on how we can take this [27:10.150 --> 27:14.970] further or alternative ideas. So if we could chat about that in the hall, uh, that would be [27:14.970 --> 27:20.490] great. I will hang around for as long as people want to talk. Thank you. [27:23.490 --> 27:26.850] All right. We got five more. Okay. [27:31.370 --> 27:43.450] All right. Thought he was waving me off. So all right in the back. Yeah. So when we, we [27:43.450 --> 27:49.110] automate, we use Chef to build images with Packer. Uh, Packer builds the image and you can, [27:49.110 --> 27:53.830] you do VMware or EBS on Amazon or several other formats. And then there's different [27:53.830 --> 27:59.710] provisioners. So we use Chef. Um, as part of our Chef, we use InSpec to run, uh, tests. So as [27:59.710 --> 28:03.050] part of our image build pipeline, we'll run all of our tests before they get merged back to [28:03.050 --> 28:09.310] master. And then that'll build us our real AMIs. Um, with Terraform, we've had with the [28:09.310 --> 28:13.930] modules, what we'd like to do is run a quick smoke test to stand up an instance of that [28:13.930 --> 28:20.910] module. So a web farm, or, um, we have another one for like, uh, an RDS, uh, Postgres instance. [28:20.950 --> 28:25.210] So we'll have a test to stand that up and then tear it down. There's a lot more that we [28:25.210 --> 28:28.310] could be doing with some of that. Um, but that's just what we've done so far. [28:29.270 --> 28:42.960] Yeah. In the hat. The tags. So our tagging structure, I think, is fairly standard. We use [28:42.960 --> 28:48.280] tags, application for which application it's part of, environment, which environment it's [28:48.280 --> 28:52.640] running in. Um, because in some accounts, we might have more than one environment running, [28:52.640 --> 28:58.220] like QA or integration testing on like a middle tier. Um, and then we have role. So the role [28:58.220 --> 29:03.720] within that application and environment, like database or web server. Uh, so those are the [29:03.720 --> 29:08.760] primary tags we use for grouping things. Um, and then as far as ownership goes, we use [29:08.760 --> 29:16.820] those owner email tags or SNS topics to keep track of who owns what. Um, yeah. [29:19.600 --> 29:31.120] Yeah. You would think so. Um, I have more details out there. It's, it's kind of a long [29:31.120 --> 29:34.860] discussion, but, um, they kind of force us into a mode where we weren't able to take [29:34.860 --> 29:39.040] advantage of some of the stuff like AWS organizations and control tower and some of [29:39.040 --> 29:45.500] that stuff they have. It is. It didn't exist when we, uh, when we first started working [29:45.500 --> 29:49.580] with them. And then they, we just haven't evolved it around. I don't even know if they [29:49.580 --> 29:55.840] support it yet, but we have to work with them on that. Uh, not yet. I got about a minute. [30:03.260 --> 30:12.500] Oh yeah. Well, when teams update the code, if they violate the policy, they're going to, that [30:12.500 --> 30:16.920] action is going to run, which may be turn on encryption if it's not there, but it may be [30:16.920 --> 30:23.760] destroy the resource. And we have had some race conditions with things like, um, if you [30:23.760 --> 30:29.360] deploy a load balancer, we wanted to make sure that you had an HTTPS listener so that you [30:29.360 --> 30:33.420] weren't just rolling an unencrypted web service. So the, but the problem is the load [30:33.420 --> 30:36.820] balancer gets deployed before the listeners. And then the policy was catching that and [30:36.820 --> 30:40.960] destroying things before the whole thing was done. Uh, likewise with tagging on instances, [30:40.960 --> 30:45.780] if we wanted to make sure things were tagged, uh, tagging is a separate operation. That's [30:45.780 --> 30:50.580] when Terraform stands up, uh, an EC2 instance. And that might be because of the AWS API, [30:50.580 --> 30:56.020] uh, but it'll create the instance and then subsequently apply the tag. So if custodian [30:56.020 --> 31:00.180] runs in between those two, it's going to say, you don't have tags. I'm going to destroy you. [31:00.600 --> 31:02.280] Yeah, we can go out in the hall. Yeah.