Latest / Blue Security / Secure Authentication to Azure VMs
Transcript
- 0:06Welcome to the blue security podcast, a weekly podcast for
- 0:10information security Defenders, where we bring you two sessions
- 0:13on best practices, tools and implementation for Enterprise
- 0:17security. Now here are your hosts for
- 0:19today's show, Andy jaw and Adam Brewer.
- 0:22Welcome to another episode of the blue security podcast.
- 0:25I'm Andy your host. I'm Adam your co-host this week.
- 0:28We're going to talk about security our authentication to
- 0:31Azure virtual machines. Now, the majority of the show is
- 0:35going to be focused on Linux VMS because I think traditionally
- 0:39those have been harder to figure out how to manage secure
- 0:43authentication, but we will touch on Windows as well.
- 0:46So the issues that a lot of organizations face is that you
- 0:50know you're starting to use infrastructure in clouds with
- 0:54VMS that are usually Linux. Right?
- 0:56Linux is probably the majority of VM In most organizations
- 1:01today for running servers web apps and other loads that are
- 1:06out there. And so, when you try to connect
- 1:09to Linux machines, the secure method is certificate,
- 1:12authentication, there are other ways to authenticate to Linux
- 1:15machines like using a username and password like the root
- 1:18username and password is usually the most common and easiest way
- 1:22to log in but it is very insecure.
- 1:24Some orgs can use like a password manager to secure
- 1:28usernames and passwords but that is probably not the best way to
- 1:31do it. Now Linux has methods to
- 1:33implement multi-factor authentication so it is possible
- 1:37to use like the Google auth to use a multi factor for a Linux
- 1:41machine. However that is not necessarily
- 1:44complex but you have to be careful because if you somehow
- 1:47mess up the MFA or lose it, you will lock yourself out of that
- 1:51machine forever. So, take that with a grain of
- 1:53salt. The more common way that most it
- 1:57orgs secureauth to Linux machine.
- 2:00Is using SSH keys, but that does require you to store the private
- 2:04key somewhere. Sometimes you can store it
- 2:06locally, which is not recommended.
- 2:08You could store it in like, a cloud sharing site, like,
- 2:12OneDrive SharePoint box, I've seen people do that.
- 2:16You could put it in a password Vault, but there are other like
- 2:19V that can systematically pull keys, and secrets, something
- 2:23like Hashi Corp. I've seen orgs use or as your
- 2:26key Vault, those are probably the best ways to do them because
- 2:29then you can role-based access those keys to certain people and
- 2:35integrate with other identity solutions to say you have access
- 2:38to these keys and you have access to these secrets.
- 2:41So that's the main issue with Linux and then with Windows
- 2:44traditionally, the protocol is remote desktop protocol so RDP.
- 2:48And those sometimes orgs control those through.
- 2:51Just, the administrative role, like the local administrator has
- 2:55access to our DP or the remote desktop users group within
- 2:59Windows. You can Control that through GPO
- 3:01or just locally. Add those people to those
- 3:04groups. And so that's one way to do it
- 3:06for Windows. Another way to get more secure
- 3:09is to use like a smart card policy and certificate trust
- 3:12with Windows. Hello for business.
- 3:13So that's a way that we've discussed where you do have to
- 3:16have a little bit more infrastructure in place.
- 3:19Like you have to have certificate issued to users but
- 3:23that does give you that method. So with Windows especially with
- 3:26an Azure and we'll talk more about Azure because Adam and I
- 3:29by are more familiar with Azure, but there's methods that you can
- 3:33deploy virtual machines that allow you to use Azure active
- 3:36directory, identity to authenticate to them.
- 3:39And so that's important. Because if you do that, you can
- 3:42apply conditional access policies to those
- 3:44authentications. So require like a compliant
- 3:47device or require MFA before you can RDP to this Windows
- 3:51computer. And there's also a method called
- 3:53Bastion which we will talk about later in the show and that is
- 3:56another method to authenticate securely to Machines.
- 4:00But for the most part, we're going to dive into Linux
- 4:03machines as far as secureauth and I'll talk about the first
- 4:06method and then Adam, I'll ask you if you have some thoughts
- 4:09but this was recently released that you could authenticate to a
- 4:14Linux machine in Azure ad using Azure active directory identity,
- 4:18which is huge. Like, that is something that has
- 4:21not been a capability in the past.
- 4:24And so the benefits of that is that you don't have to issue out
- 4:26a key, right? Normally, you have a private key
- 4:29that you have to Issue out to your users in order to use SSH
- 4:32authentication certificate based authentication but in this case
- 4:35you don't have to issue out those keys.
- 4:36It Is escrowed by Azure active directory and you don't have to
- 4:40have a local administrator account, you can are back those
- 4:43policies. You can you apply conditional
- 4:45access? I mean it's a major major
- 4:47Improvement in authentication to Linux machines by just using
- 4:51your Azure active directory identity.
- 4:53Any thoughts on that? Adam, I want to know more.
- 4:56So one of the things you said I can confirm at least, for azure
- 5:00So I assume this is even more. So in other clouds, we talked
- 5:03frequently how in Azure over half of the virtual machines
- 5:06there are Linux. So you said you suspect that the
- 5:09majority of VMS and public Cloud, our Linux VMS, at least
- 5:12for Azure. I can confirm that as true and
- 5:14has been for many years where Linux machines, outnumber
- 5:18Windows machines. So that's why it's so important
- 5:20to have a effective solution. No, Linux, really, you know,
- 5:23when a lot of deployment scenarios just doesn't have a
- 5:26great like Network, you know, identity kind of Model to sign
- 5:30in with, it's all very local. And so this is really neat and
- 5:33I'm kind of curious to learn more along with our listeners.
- 5:36Yeah. So it's not very difficult to
- 5:39implement. Now, for VMS, that you already
- 5:42have like local users with and you don't have a certificate
- 5:46based off. You're not going to be able to
- 5:48convert them unless you install a certificate base.
- 5:51And so the easiest way is to just start with newer VMS and
- 5:56when you create a Linux VM with in Azure you have to check off,
- 5:59The box to number one, user certificate to authenticate to
- 6:03it and then to allow a charade e authentication.
- 6:07So that's a new check, mark, or option when you create a Linux
- 6:10machine within a. Sure.
- 6:12And once that machine has been created, you can grant rights to
- 6:16that machine by granting a role within, either the subscription
- 6:20or the resource Group and allow virtual machine login.
- 6:24So, there's three different roles within Azure to allow
- 6:28access to these Virtual machines one is administrator, login.
- 6:32One is contributor. And then the last one is user
- 6:34login. And so the users that you want
- 6:36assigned and have access to these machines have to have that
- 6:39role and then simply you have to have a tool to SSH to them that
- 6:43allows openssh certificate authentication.
- 6:47The easiest way to do it is through Azure CLI or the Azure
- 6:51Cloud command prompt and so those are going to be the
- 6:55easiest way to do it. You do have to install tools on
- 6:59the machine or VM that you're trying to access, right?
- 7:02And so this there's a additional things I think when we start
- 7:05talking about pros and cons with the next method with Bastian,
- 7:08like, in this case, you're assuming that you are going to
- 7:11SSH to that machine from a managed machine, right?
- 7:14Is what I would expect it to be and you can apply conditional
- 7:18access to do that in the next one.
- 7:20You can do that without having to install any additional tools
- 7:23because it's all done in the browser.
- 7:25Now, with this method, you can have the Azure VM be a Assigned
- 7:30a public IP or a private IP. If you assign it, a private IP,
- 7:34obviously you have to have network connectivity from
- 7:37wherever your SSH into, right? So a VPN or whatever, be on the
- 7:41local network, in order to access it.
- 7:43That's a key thing. If it's a public IP, you're
- 7:46actually going to be SSH over a public IP you know, you have to
- 7:49open up Port 22 to the internet in order to SSH to it, even
- 7:54though you're authenticating it with your Azure active directory
- 7:57account and you're using certificate based
- 7:59Authentication, And you still have to open up that port to the
- 8:01Internet, so that's a risk for sure.
- 8:03And so that's I would consider that to be less secure.
- 8:06I would implement this solution in more of a private Cloud where
- 8:10you have to have network connectivity of some sort.
- 8:13And there are a few distributions that are
- 8:16supported, so not every single distribution Under the Sun, but
- 8:19most of the main ones like sent to us Debian redhat Ubuntu and
- 8:24then it is supported in the commercial Cloud, the government
- 8:27cloud and the Chinese cloud. And then one other thing which I
- 8:31thought was really interesting is that is enabled for Azure Arc
- 8:35servers. We talked about Azure Ark before
- 8:37in our patching episode, but that means if you have a server
- 8:41that is prime or sitting in a third party Cloud, you could
- 8:45possibly use this to authenticate to those machines
- 8:49as well. So the other method is called as
- 8:51your Bastion and I think we've mentioned as your Bastion on the
- 8:55show before but it is a service that I like to think of as like
- 8:59a jump Says a service. And so typically a jump box it's
- 9:03in like a DMZ or something like that and you would use that.
- 9:06It's a hardened end point that you have to maintain and then
- 9:10it's exposed to the internet and then you use that to then jump
- 9:13into your internal Network to gain access to internal
- 9:16resources. I don't know if as your Bastion
- 9:19would apply to everything in your environment, maybe things
- 9:23that you need exposed without connectivity because that is one
- 9:26of the main benefits is that you don't need a public IP.
- 9:29P at all, and then you're able to access that resource from
- 9:33anywhere, using your Azure active directory credentials.
- 9:35So you're just signing in over the cloud.
- 9:38Now, of course, you can apply conditional access policies to
- 9:41that. But, you know, if you allowed
- 9:43it, you could then use as your Bastion through the browser and
- 9:46get access either SSH or RDP to resources that are in Azure.
- 9:51I like to think of this as more for companies that have
- 9:55regulations that they have to follow that, they cannot have
- 9:57any public IPS exposed but then they Of a business, requirement
- 10:01to access that from somewhere else, right?
- 10:03Without network connectivity, perhaps to the internal Network,
- 10:06you can integrate that with Azure Ki V for secure Key
- 10:10Management. So, that is a super easy way to
- 10:14manage keys, without having to issue out keys to every single
- 10:18user, you're just storing the key with in kyiv, alt, and then
- 10:21are backing those keys within key Vault and other private
- 10:25clouds have similar capabilities, like AWS has
- 10:29something called System session, manager and AWS Transit that
- 10:32uses a similar type of concept where it's like a jump box as a
- 10:37service and Google Cloud uses something called, a cloud,
- 10:40identity aware proxy. And so these are all like
- 10:43essentially the idea is a jump box as a service where you're
- 10:47not necessarily having to maintain a hardened and point in
- 10:50a DMZ that is exposed to the internet, but you're accessing
- 10:53your resources in a private Cloud through a service that is
- 10:57provided for you without having to maintain any.
- 10:59National infrastructure which is really nice.
- 11:02Any thoughts on that? Adam, it's just kind of cool to
- 11:04walk through and I think you did a good job of delineating kind
- 11:08of the two different options here and when you would want to
- 11:11use each one I think in general, we talked on the show a lot
- 11:15around doing the little things and this is one of those things
- 11:19I think could really help because identity is so
- 11:22fundamental to overall security. And if we can just bring some
- 11:27common sense to how we sign into Linux, X machines or how we
- 11:31already pssh different machines with Azure Bastion or the AWS
- 11:35and gcp. Equivalents those can be really
- 11:38helpful because those are very, very common attack vectors.
- 11:41So, you know, sometimes this stuff seems like, oh, this is,
- 11:44you know, really, really specific show tonight, guys.
- 11:48But these are the sorts of things that really make the
- 11:51difference. I think, at the end of the day,
- 11:52more than bringing in a whole bunch of tools or anything else,
- 11:55it's getting the small stuff, right?
- 11:56It's sweating the small stuff. So I think these are two really
- 11:59Add call-outs for modernizing the identity and access for your
- 12:04virtual machines, and that is helpful.
- 12:06Yeah. I just think about like Linux in
- 12:08general, like one, you know, security teams don't necessarily
- 12:11interact, sometimes, with the cloud infrastructure Engineers,
- 12:15right? There's traditional Engineers
- 12:17that are doing the on-prem stuff and because I'm Prem has been
- 12:21around for a long time. We're pretty good on like
- 12:24domain, join servers and managing credentials and all
- 12:27that, right? But for Linux, let's say you You
- 12:29have 100 Linux servers. Well you're either maintaining a
- 12:34hundred different credentials right or your you know hopefully
- 12:38not having one root user in one shared password among all of
- 12:43those but that's a pain to manage all of that.
- 12:46And even with a password manager, right?
- 12:48Like a credential manager that can be really complex and
- 12:51difficult and you just adding different entries into their or
- 12:55you using a root cert in issuing out different keys from there,
- 12:59and then I mean to maintain your keys and it's not easy for you
- 13:03know certain people to log on to Linux servers using a
- 13:06certificate. Like it's you have to have a
- 13:08pass key or passphrase usually for those certificates.
- 13:11So that is then stored in a password Vault on top of that so
- 13:15it gets very complex to try to maintain credentials for them
- 13:18and then if somebody leaves right if they have, you know,
- 13:21that passphrase saved somewhere and they have that certificate
- 13:24saved locally, then you have to go through like revocation and
- 13:28all that. And so this is Is just
- 13:30modernizing that and simplifying it, where you don't have to
- 13:34worry about maintaining a password.
- 13:35You don't have to worry about maintaining keys anywhere.
- 13:38It is all just done as a service for you.
- 13:41I think the Azure active directory signed in, I think
- 13:44that is super easy, especially for most users because then you
- 13:47know, as soon as you disabled, you know, either their on-prem
- 13:50identity that's sync to the cloud, or their Cloud identity,
- 13:53they lose access to everything. Yeah.
- 13:55Right. Right.
- 13:56So it's just think, it's a common thing that security teams
- 13:59met Not have a ton of insight on, and a lot of companies are
- 14:03moving so fast these days and just spinning up servers and
- 14:05they're not really thinking about authentication and how
- 14:09that works, right? So anyways, I thought this was a
- 14:12good topic to talk about. I did actually write a blog
- 14:14article on it this week as well which I'll link if you prefer
- 14:17reading through and seeing some screenshots on how to do it as
- 14:20well as a documentation in there.
- 14:22So that will walk you through. If you guys are interested in
- 14:25spinning up your own to test it, and that's our show for this
- 14:29week. Week.
- 14:30Thanks for watching and listening.
- 14:32Our contact information will be in the show notes.
- 14:34If you have any questions or topics you want to stop by.
- 14:36Thanks, we'll talk to you guys next week.
- 14:38Thank you for listening to the blue security podcast.
- 14:40Please check out the show notes. Catch up on episodes.
- 14:43You may have missed and subscribe so you don't miss any
- 14:45future episodes. Find Andy, on Twitter at age 0,
- 14:480, and Adam at AJ Brewer. See you at our next episode?