4 hours 53 minutes
it's time to use vault in this video. We're going to start a local instance on your machine.
Get a little introduction to the concept of token authentication with vault.
Play around with some very simple commands using the command line interface as well as the http Rest interface Explorer vaults Web user interface and review important information about the command line interface as well as the rest A P I.
Before we get going, a little bit of a disclaimer were running vault locally for exploring and learning the tool. The Dev mode makes it very easy to get up and running, but it is not set up for production. There's a lot of hardening, a lot of additional configurations on a vault server you'd want to put in place before he went prime time,
and we will discuss many of those later in this course.
But for now, this is great. This is easy to get really a good understanding with a minimal amount of overhead
to begin. We're gonna take a look at the get up site for this training course because it has a lot of commands that you're gonna want toe refer to as we move along, Um, broken down into different directories for the different modules of the training course or module three. Right now, Secret storage on. We're talking about launching the death server. So
this is the first command we're going to run from the command line. So go ahead, open your terminal
and it should be loaded. It vulture being your path. We set that up in the last course and let's launch vault. It's evolved server, and then we're passing the Dev flag to do it in Devon mode. With server now running,
we want to access it and interact with it. So we're gonna open up a different tab
that will be used for our client invocation and interactions.
I'm gonna run the most simple command from vault
involved. Version just to make sure I have everything installed. This is using 131 But let's take a look and see what is the status of the server. And so when I run this command the first time, you'll notice it fails, and it's talking about https local host. Ah, loop back. You are Ellie, 2 to 0, and it's saying I'm not getting any sort of response.
If I school up
and look at the output produced when I launched the death Server. I see a variety of warnings and disclaimers, but I also see you may need to set up the following environment variable. And the reason is because this dev mode version of vault
it's not, um, running under SSL. It's not TLS, right? It's unencrypted. That's fine, because we're just doing everything locally. Obviously, in a production environment, you wouldn't want to do that. So I'm gonna go ahead. I'm gonna take the advice I'm going to set the vault addresses is a special environment variable that the vault command line looks at,
which will override
it's default assumption that you're using TLS for your interactions with vault.
Now we'll run vault status again. There it is. We're very happy and pleased to see that it is indeed initialized and things are up and running. And he also noticed that it talks about when the command failed. Http response to an https client and all this kind of stuff,
even though we were just running a command line utility
because under the covers, most of the interactions that happen with vault are done through vaults AP I exposed over http. Right? A rest a p I.
And when you're creating software programs and using other applications, that's going to be the mechanism that they interact and communicate with. Vault is over, Http. By and large, so what I want to do is run a particular curl command,
which is a curls a utility to perform http interactions so that we can take a little closer looking and remove this layer of the vault Cielo client CLI client and actually start diving into seeing
the actual internals vaults, communication protocols and in AP eyes at a lower level.
Before doing that, we need to set up a new environment variable for the route token. So another thing when vault launched on our local system in death mode, it automatically spits out this route token. And the token is the way that the client I
identifies itself and authenticates with vault,
which then allows it to be authorized to perform certain interactions. And the route token is is super user. It is the root account like you would have on any Lennox machine, So the CLI interface and was automatically set up when the devil had launched
this is the route token because there's a super secret file that was created on my file system that the seal and her face looked at to identify the token. But when we're using Curl, it's not gonna know where that file is. It has no idea what vault is, so I want to just go ahead and I'm gonna export.
The vault have created an environment variable that has that token just for future use in simplicity in our few in our next and up and coming curl command. So now let's go ahead. I'm copying and pasting the curl command from the get Hub website so you don't have toe type it all in there manually.
You can t
um, let's run it and kind of see what happens. Here's the one thing to note is that I asked it to include me, the headers and beaver boasts, especially in this first time so we can understand what's going on so that the TCP client, ever extremely the Curl client, opened its TCP connection and made a connection
two on port A 2002 local host.
It issued the http get command and it's calling V one cyst host information, right? And then that one thing of note included in the request header was the vault tokens. So this X vault token, that's a header parameter that you need to include. And that's what involved looks at to identify who I am and authenticate me and and say, Yes,
I do have the rights and I do have business
giving and or rather receiving all the host information from this source of about the server. And then it goes ahead. It returns a 200 code. It's good, everything's okay and saying content type is going to be Jason and then we have the days and then we have, ah, bunch of output. It formatted in Jason. So
that's a bit messy toe look at. If you installed the Jake you
utility, particularly on Lenox, think windows that will work as well. And of course, Mac. That's nice to help get that response, which is in adjacent format, but it's kind of all bundled together and just put it in a nice little format in mechanism. So I piped it over to Jake, you
Andi here we can see this is really what the response was
when I issued the inquiry of system information.
So spend the time you want reviewing the system information output. You may find some things interesting. You may find some things not so interesting.
I'm gonna move now and we're gonna pop back over to our get up page because what I want to do is connect to this local vault server. But I want to do it through the third mechanism of interacting with Bolt, and that is the Web user interface.
So I navigate to the Web user interface and you'll notice right away. It's asking me to authenticate myself. In this particular case, there's a variety of authentication methods will get into those throughout. The training at this point token is all that's enabled. And we just talked about the route token. So what I want to do is I'm gonna paste the route token that was provided
in the vault console
when the whole process booted up over here and we got the server going so that we sign in and we are now route were the super User. We can do all sorts of activities.
Go ahead and explore the web interface as you see fit
secrets, engines, different access methods, configuring policies, which control who can do what and a few utilities you also noticed. There is a nice built in command line interface. So using the Web, you can actually perform command line commands as if you had that vault command line utility.
And the reason for this because there's
Onley so much you can do through the Web interface. Ultimately, you can do everything through the http AP I see there's a link to the http documentation that hash corpus published everything you wanted to know about that a p I
including some nice things, like the client libraries, because when you're developers are working on things, even when you're making scripts are working with danceable,
you're probably not gonna be creating curl command yourself. More often than not, you're going to be using one of these libraries that will simplify the amount of interaction parsing the Jason responses and so forth.
And then, of course, from the get hub page, we have a link to the CLI documents, which are a little more thorough and extensive than just running the dash H argument in the passing the S H argument to your command line that will provide you some output. But this documentation and reference utility is great
because we're not gonna be able to cover everything
in this training. So some of these things you're gonna want to come back to both of these resource is when you're starting to use vault in the real world
to summarize this lesson.
What did we dio? We start involved.
We learned about token authentication.
We ran some commands using both C Ally as well is interacting with the http rest ap I using the curl utility. We explored the web ap I and we took a look. A valuable resource is the reference documentation for both the cli and
the http rest a p I.