All right. Thanks a lot. And thank you all for filling this arguably a little bit small room. But it's cool. I'll tell everyone the room was full and not how many people were in it. So thank you for coming. I work at DirectSupply. I'm a technical fellow and chief software architect. And I'm here to talk to you about scaling security in the cloud today. Our company, DirectSupply, we do services and solutions for the long‑term care industry. 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. So we've been undergoing a journey to migrate into the cloud for about the past two years. I've been interested in going in that direction for longer than that. But it was only about two years ago when we decided to do this. 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. Now, I do have a lot to talk about. I will stay out in the hall for questions afterwards. So if you would just hold them to the end, that would be great. I have some slides I was going to maybe have to skip over, but hopefully I won't have to. But I wanted to talk about first our company's cloud vision and strategy that I was part of putting together. 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. We didn't want to just take our applications as they were running and then shift them to run on EC2 instances in AWS. An argument you might hear is that, well, you don't own the infrastructure. And that's true. We don't own the infrastructure, but we can architect for not owning the infrastructure. So part of the strategy included things like immutable servers. If you've heard of this, this is the idea that once you run a server, you're not going to change it. If you want to change it, you will tear that server down and relaunch from a new image that you've built. We wanted to embrace infrastructure as code. 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. Like version control, peer review, automated deployments and automated testing. Which takes me to automated deployments. We wanted to make sure that our deployments as we ran them in different accounts and in different environments were the same. And the best way to do that is through automation. 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. 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. 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. 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. 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. So I want to start by just talking about the programmability of the cloud and some of the things that it can get you. And it kind of hit me that there's pretty much four layers of making use of programmability with your infrastructure. The first is you have no automation. You do things by hand and you have people that really like doing things by hand. Eventually you start to script up some of your work. If you've worked against a traditional infrastructure like a VMware, some of those have been a lot more difficult to automate. And part of the programmability of the cloud, it makes that a lot easier and a lot more reproducible. As you begin to progress, you'll get into DevOps and continuous delivery. And again, now we're fully taking advantage of the cloud for our deployment reasons. But the final level of taking advantage of cloud programmability is using it for evil. So I'm going to hit with just one quick thing. We had an accidental commit to GitHub of some AWS access keys. And I don't know if anyone's experienced that, but what do you think happened? GitHub, it was public. You don't get to answer because you know what happened. 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. Destroy all of your infrastructure. 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. So there was really no damages. There weren't any damages to our infrastructure. Amazon noticed this within a few minutes and disabled the account and it was a development account. So it wasn't our production account that was disabled. But it's kind of that idea that if you're not ruthless enough in attacking someone else is going to take that place. And there was a very small window of opportunity where somebody could do damage. 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. So in the end it wasn't that bad. But I just wanted to point out that you can use the same programmability of the cloud for both good and evil. 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. And I don't mean do more, like do less security. We wanted to do more security. 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. So we have to start spreading some of that out across the teams. 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. And also solve a number of our other security issues in the cloud. And the first is a product from HashiCorp called Vault. I don't work for them. I'm a huge fan and their open source product gets you a lot of things you wouldn't even expect. Like companies that do open source sometimes will save the LDAP integration or the UI for the commercial versions. But they've got so much in their open source that it's almost unbelievable. 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. So it does a lot of stuff. And they kind of flag it as security as a service. You've got this very secure box that does all these things for you. We're not using it for all of its uses. We are using it, uh, for these use cases. We're using it to store static secrets. Things using its key value secrets engine. And these would be things like passwords to back end services. If we had like access to a third party API and we needed to store some sort of key. Um, that's a piece of information that does not change. We need to store and access that securely. Vault also has the potential to deal with dynamic secrets. And these are things that can change. And the idea of them changing is interesting because it allows you to lease them for a certain amount of time. First that we, the first, uh, dynamic secret engine that we use is one for Postgres. 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. And then when users needed to get access to those databases, we granted, you know, put them in roles based on their domain account. 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. 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. 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. 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. And it's good for a certain amount of time. So it gets us effectively the same thing without the database having to be tied to our domain. 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. 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. And there's a maximum. I have an example of how we do this. Um, but then if that key got leaked, that would further limit the usefulness of the how, what you could do with it. Um, and the third thing that we're using it for right now is one time password to log into EC2 instances. It can do the same thing for, uh, Linux servers that it can do for like Postgres. It can generate a username and password that you can use to log in and it's only good for so long. Okay, so authentication to Vault, um, all of the components to Vault are pluggable. So you can authenticate to it different ways. We use LDAP for our user accounts and then with systems that are running in AWS, they'll use IAM to authenticate. Um, you can also use username and password or GitHub or any other mechanism, but it's all pluggable. 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. 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. In a few seconds, it comes back. It issues me a token. That's good for, according to the output, 60 minutes. And at the bottom, you can see the policies that I have access to. 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. 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. Uh, there's the EC2 user OTP for one time passwords to let me generate one time passwords. Uh, this is the admin level, so this would be to any EC2 instance. And secrets read write allows me to get access to the key value store. You can make these policies as granular as you wish and they can be specific to just one path involved. 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. Uh, but these policies are pretty broad, uh, since I am an admin on this, uh, tier. Uh, the next piece is just an example of how you interact with the key value secrets engine. In this case, I'm issuing a vault KV get command. I'm asking for a specific field because what we store at those keys are JSON documents. So you can have any number of, uh, key values within that one document. 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. Um, and then the output is simply the secret. 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. 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. So at no point do we need to build these secrets into our images. We request them at runtime or at start time and then they become part of the environment for whatever process needs them. A quick example of how we generate secrets for Postgres. This look, the syntax is a little bit different, but in this case we have a databases secrets engine for a specific database. So it would be databases slash myDB. And then when you configure it, you define policies within there for like read only or read write. And then that ties back to the permissions that the Postgres users have on your underlying database. 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. After an hour, it's expired and does not work anymore. 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. And the way this manifests is then I will assume an engineer role within AWS. 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. 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. And it did issue me a one hour, it was maxed at one hour lease. 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. 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. So I'm showing them at DEF CON. Get a picture. It will be in the slides. 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. 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. So then you can just do a regular username password SSH onto that EC2 box. Nothing to clean up after an hour. So that's kind of a lot of what we're doing with vault. The next thing I want to talk about is something that we've deployed in order to enforce policies against our AWS configuration itself. 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. But with teams owning their own infrastructure, we have deployed a product from Capital One, that's open source called Cloud Custodian. Yeah. Right. Well, maybe they do. Maybe they don't have their policies defined correctly. But what we're getting from Cloud Custodian is the configuration governance. Again, it's policy as code. We get automated checking and enforcement of infrastructure that gets deployed. And we're running multiple AWS accounts. 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. But that happens in our development account, which is before it would get up to production, theoretically. It does get us policy as code. So again, we have automated deployments of our policy. We have peer review of our policy and we have version control. And it also supports notifications for notifying owners of systems. Again, if you're operating in a DevOps mode, teams are owning their own systems and infrastructure. So we have been tagging resources in AWS with who owns what. 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. 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. 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. If you just get a list of all the problems, then you have to go do all that work. And it would be much more preferable if you could instead have it automatically take some action where it makes sense. And I want to show you what one of the example policies would look like before I talk too much more about that. But they're all defined with YAML. There's quite a lot on here. But effectively, this is a policy that we have written for unencrypted S3 buckets. We wanted to just encrypt everything so we didn't have to deal with figuring out what type of data was in there. So we wanted to make sure that buckets were encrypted. So there's a resource type, which is AWS S3, ensure that S3 buckets are encrypted. And then there's a mode. And what's interesting about Custodian is when you deploy it, you can run it several different ways. You can run it as a batch job from a CLI. It's just a Python module that can be run as a batch task. It can deploy automatically into AWS Lambda to run scheduled Lambdas or Lambdas that are triggered by CloudTrail events. Or it can generate CloudTrail rules inside of AWS. The method that we're using for most things is to do periodic scheduled Lambdas, hence the rate of five minutes. So this will run every five minutes. So again, it's reactionary. 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. Any buckets that are not encrypted, it's going to execute the actions for. And in this case, the action we have is type set bucket encryption. 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. 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. So in this case, it will get encrypted and then owners will get notified. So how the notification works, it has a mailer component that is part of it. And the mailer component, you give it a little template for like an email message. 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. So you could consume that and do whatever you wanted with it. 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. 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. And what we defined in our mailer configuration was to look for a certain number of tags. And we use owner email as a tag and we also use owner SNS topic as a tag. 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. And then there's a little template for the message that they get. So it'll say an S3 bucket that is unencrypted has been detected. The bucket has been encrypted. Uh, so we're using custodian for a ton of things. 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. 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. 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. Uh, so when they went away, we'd have to go back and update all of our scans. So we wanted to eliminate any manual effort to update our scan configurations. 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. And we wanted to support custom scans based on tags. So really we have two approaches to this and each of them relied on a lambda. 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. So what we have to do is we run a lambda every so often to update the scanner on the scans that are defined. 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. Likewise with EC2 instances, we have another lambda that based on tags will add them to appropriate scans. So if we want to do an agent based scan, or sorry, a scanner based scan, um, we can do that. And we don't have to maintain it. The lambda runs every so often and then the scan gets updated. Um, and then you see that little, that red box is a security group that's around those instances. We have a custodian policy that adds the rule so that the scanner can get in. Uh, so that's one scenario. Uh, another scenario is agent based scanning. 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. So when they come up, they'll register, they'll show up as an agent in tenable. 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. So we did another thing based off of that owner email tag where we grouped them logically. We created, we created agent groups inside of tenable for each owned group of servers. And we have a lambda that runs that adds the agents to the relevant groups. When agents go offline, they automatically get cleaned up after a day or two based on the tenable configuration. Um, but for any instances that came back after having been destroyed, the lambda runs and then they get added to the groups. 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. 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. And these are in the vein of that secure by default. 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. 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. And then they just pass variables into it. So as a cloud development team, we created this initially and then all the teams started using it. 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. 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. Um, we're also encrypting the boot volume by default and applying a tagging policy. 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. With Terraform, you deploy resources and then any group of Terraform code can be used as a module. So we've defined reusable modules for a lot of things. 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, they can pass an ARN. 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. Make sure it was in the public subnet if they were internet facing. Do all, make sure all their instances are in the private subnet. Get everything registered with DNS properly. So it does all that for them. Um, I have some stuff of what, what went not, not so well. 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. Um, but really it was our pace that made us kind of be, start playing catch up from the beginning. Um, so we started doing a lot of work before we had custodian deployed. Teams started rolling their own Terraform before we had modules for everything. Um, so it's stuff like that. 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. So if we could chat about that in the hall, uh, that would be great. I will hang around for as long as people want to talk. Thank you. All right. We got five more. Okay. All right. Thought he was waving me off. So all right in the back. Yeah. So when we, we automate, we use Chef to build images with Packer. Uh, Packer builds the image and you can, you do VMware or EBS on Amazon or several other formats. And then there's different provisioners. So we use Chef. Um, as part of our Chef, we use InSpec to run, uh, tests. So as part of our image build pipeline, we'll run all of our tests before they get merged back to master. And then that'll build us our real AMIs. 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. So a web farm, or, um, we have another one for like, uh, an RDS, uh, Postgres instance. So we'll have a test to stand that up and then tear it down. There's a lot more that we could be doing with some of that. Um, but that's just what we've done so far. Yeah. In the hat. The tags. So our tagging structure, I think, is fairly standard. We use tags, application for which application it's part of, environment, which environment it's running in. Um, because in some accounts, we might have more than one environment running, like QA or integration testing on like a middle tier. Um, and then we have role. So the role within that application and environment, like database or web server. Uh, so those are the primary tags we use for grouping things. Um, and then as far as ownership goes, we use those owner email tags or SNS topics to keep track of who owns what. Um, yeah. Yeah. You would think so. Um, I have more details out there. 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. It is. It didn't exist when we, uh, when we first started working with them. And then they, we just haven't evolved it around. I don't even know if they support it yet, but we have to work with them on that. Uh, not yet. I got about a minute. Oh yeah. 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. 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. So the, but the problem is the load balancer gets deployed before the listeners. And then the policy was catching that and destroying things before the whole thing was done. Uh, likewise with tagging on instances, if we wanted to make sure things were tagged, uh, tagging is a separate operation. That's when Terraform stands up, uh, an EC2 instance. And that might be because of the AWS API, uh, but it'll create the instance and then subsequently apply the tag. So if custodian runs in between those two, it's going to say, you don't have tags. I'm going to destroy you. Yeah, we can go out in the hall. Yeah.