1 00:00:00,240 --> 00:00:05,930 In the last video you initialized a new get repository for the web server project. 2 00:00:05,940 --> 00:00:11,730 You also added a couple of commits and now we can take those comments and send them off to these third 3 00:00:11,730 --> 00:00:13,580 party services we want to use. 4 00:00:13,590 --> 00:00:17,760 Get hub and Heroku so they can access our latest code. 5 00:00:17,760 --> 00:00:18,710 That's how we get hub. 6 00:00:18,720 --> 00:00:25,950 We'll be able to host our project and how Heroku we'll be able to deploy the latest version of our application. 7 00:00:25,950 --> 00:00:32,340 Now the question is how do we transfer the code between our machine and the other third party services 8 00:00:32,460 --> 00:00:34,170 servers in a secure way. 9 00:00:34,410 --> 00:00:42,900 And the answer is to use S S H SS H stands for secure shell and it gives us a means of securely communicating 10 00:00:42,900 --> 00:00:44,080 with another machine. 11 00:00:44,100 --> 00:00:48,520 And in this video we're going to set up what's known as an SS H key pair. 12 00:00:48,570 --> 00:00:54,510 This is a set of two files which we'll be using to facilitate this secure communication. 13 00:00:54,510 --> 00:00:59,590 Now to actually generate these files all we need to do is run some commands from the terminal. 14 00:00:59,640 --> 00:01:05,450 Then in the next two videos we'll actually set things up with both get hub and Heroku. 15 00:01:05,460 --> 00:01:10,230 Now if you're on mac or on Linux you can stick with your standard terminal. 16 00:01:10,230 --> 00:01:15,570 If you are on Windows you need to use the get bash program. 17 00:01:15,720 --> 00:01:21,240 So remember when we first installed get I said that if you're on Windows as you move through the installation 18 00:01:21,240 --> 00:01:26,070 process you want to check that box that says install get bash. 19 00:01:26,100 --> 00:01:28,920 This is when we're actually going to use that program. 20 00:01:28,920 --> 00:01:34,340 The commands we're gonna run are not available to you from these standard windows command prompt. 21 00:01:34,350 --> 00:01:37,530 You need to use get bash to access them. 22 00:01:37,530 --> 00:01:43,950 Now if you didn't install get bash when you installed it you can always grab the installer again rerun 23 00:01:43,950 --> 00:01:49,620 it adding the option to install get bash then you can continue on with the lesson. 24 00:01:49,680 --> 00:01:55,740 So once again Windows users crack open get bash Mac and Linux users you can stick with your terminal 25 00:01:55,800 --> 00:01:58,490 right inside of Visual Studio code. 26 00:01:58,560 --> 00:02:04,050 Now the first thing we're going to do is see if we already have SS keys on our machine. 27 00:02:04,050 --> 00:02:08,670 It's possible you have them from another project you were working on the command we're going to run 28 00:02:08,700 --> 00:02:15,270 is L S now less allows us to list out the contents of a directory and this is going to allow us to check 29 00:02:15,270 --> 00:02:22,060 for existing keys so that's going to list out all of the files and folders inside of a given directory. 30 00:02:22,170 --> 00:02:29,100 We're gonna be running this with the a flag the a flag makes sure that even hidden files and folders 31 00:02:29,130 --> 00:02:36,900 show up these would be ones that start with a dot also known as DOT files and we'll also use the L flag. 32 00:02:36,900 --> 00:02:40,350 This is just gonna make the format a bit easier for us to read. 33 00:02:40,410 --> 00:02:45,600 It's gonna list everything out top to bottom instead of trying to use columns where we have things side 34 00:02:45,600 --> 00:02:52,050 to side and the last thing we need to provide is the path to the folder of which we are trying to print 35 00:02:52,050 --> 00:02:53,190 its contents. 36 00:02:53,190 --> 00:03:00,110 Now for us that is going to be the following It is Tilde forward slash dot SS H. 37 00:03:00,210 --> 00:03:06,260 So Tilde is a shortcut for your user directory then we're looking for the DOT SSA folder. 38 00:03:06,330 --> 00:03:10,820 Now there's a chance you don't even have this folder in which case the command is going to fail. 39 00:03:10,830 --> 00:03:12,180 That is okay. 40 00:03:12,300 --> 00:03:18,150 It's perfectly fine if you get an error something along the lines of directory not found in this case 41 00:03:18,150 --> 00:03:19,060 when I run it. 42 00:03:19,200 --> 00:03:22,440 The folder does indeed exist but there's nothing inside of it. 43 00:03:22,500 --> 00:03:28,080 I have dot which represents the directory and I have dot dot which represents the parent directory. 44 00:03:28,110 --> 00:03:35,520 There are no files inside of the dot SSA folder which means that I don't have any SSA age kids. 45 00:03:35,550 --> 00:03:44,890 Now if you have a file called I d underscore RSA and another called I d underscore RSA dot Pub. 46 00:03:44,970 --> 00:03:51,900 That means you do already have a set of SSA keys and you could choose to use those instead of creating 47 00:03:51,930 --> 00:03:52,590 new ones. 48 00:03:52,590 --> 00:03:57,390 There is no need to create new ones if you already have some in place. 49 00:03:57,480 --> 00:04:02,910 Now if you are seeing what I'm seeing and you have no files or you don't even have the folder it's time 50 00:04:02,970 --> 00:04:09,540 to run a couple other commands to create some SSA keys that we can use the command we're gonna use as 51 00:04:09,540 --> 00:04:15,360 SSA H hyphen key gen which is going to allow us to generate this SSA H key pair. 52 00:04:15,490 --> 00:04:20,750 The first argument of three we'll be providing is t which stands for type. 53 00:04:20,760 --> 00:04:27,600 There are various protocols we can use we'll be using the very popular and very secure RSA protocol. 54 00:04:27,600 --> 00:04:32,550 Now RSA doesn't stand for anything in particular related to software development. 55 00:04:32,550 --> 00:04:38,150 It's actually just the last name initial for the three creators of the algorithm. 56 00:04:38,190 --> 00:04:45,840 So after RSA we're going to specify B for bits we want to specify how many bits for this key we want 57 00:04:45,840 --> 00:04:47,350 enough to be secure. 58 00:04:47,370 --> 00:04:55,350 The most common value is forty ninety six so four thousand and ninety six bits for the key last up hyphen 59 00:04:55,410 --> 00:04:59,320 capital C make sure it's capital and not lower case. 60 00:04:59,420 --> 00:05:04,850 This is where we can provide a comment for the key what you can think of as a label and it's common 61 00:05:04,850 --> 00:05:09,570 to just use your email address inside of here and that's what I'm gonna do right here. 62 00:05:09,590 --> 00:05:10,580 Perfect. 63 00:05:10,580 --> 00:05:15,130 Now that we have this in place we can go ahead and hit enter to run the command. 64 00:05:15,140 --> 00:05:21,230 This is gonna bring us through a little wizard which is going to ask us a few more questions enter a 65 00:05:21,230 --> 00:05:28,640 file in which to save the key and by default you can see it storing it in that dot SSA directory inside 66 00:05:28,640 --> 00:05:34,320 of my user profiles folder and the file name is I d underscore RSA. 67 00:05:34,430 --> 00:05:41,040 I do want to use that default so I'll just hit enter to accept the default value shown in parentheses. 68 00:05:41,120 --> 00:05:43,310 Next up enter a passphrase. 69 00:05:43,310 --> 00:05:49,730 We're not gonna provide a passphrase so we can hit enter to use the default pass rage wishes no passphrase 70 00:05:50,750 --> 00:05:57,800 after that we hit enter again to accept our passphrase and then right here the key has been created. 71 00:05:57,800 --> 00:06:05,210 Now what we're gonna do is run that same Ellis command so I'm gonna use the up arrow key twice hit enter 72 00:06:05,570 --> 00:06:14,810 run it and now I can see I have two files I have I.D. RSA an I.D. RSA dot pub The first one is a secret 73 00:06:14,810 --> 00:06:19,250 file which we're gonna keep on our machine and we're never gonna share with anyone. 74 00:06:19,250 --> 00:06:23,600 The other is a public file and this is something we're gonna share with both. 75 00:06:23,600 --> 00:06:29,690 Get hub and her Roku so they can secure the communication between our machine and their servers. 76 00:06:29,690 --> 00:06:35,720 The last thing left to do is to make sure that our SSA key pair is actually used the next time we set 77 00:06:35,720 --> 00:06:40,360 up an SSA connection which we will be doing in the next two videos. 78 00:06:40,370 --> 00:06:45,530 The first thing we need to do is make sure the program is running and then after that we're going to 79 00:06:45,530 --> 00:06:48,770 register our new private key file. 80 00:06:48,830 --> 00:06:52,010 So right here altogether we're gonna run the following command. 81 00:06:52,010 --> 00:06:53,620 It is e Val. 82 00:06:53,690 --> 00:06:59,140 Now if you are on Windows you're going to leave the next character off if you're on mac or linux. 83 00:06:59,150 --> 00:07:05,430 You add the quote in after that it is dollar sign open and close parentheses. 84 00:07:05,450 --> 00:07:08,830 Then once again on windows nothing on Mac and Linux. 85 00:07:08,840 --> 00:07:17,120 Add that quote in then inside of the parentheses the command which would be SS H agent asked to start 86 00:07:17,180 --> 00:07:18,260 that up. 87 00:07:18,260 --> 00:07:23,990 So all this command is going to do is that's going to try to start up SS H agent if it's already running 88 00:07:24,020 --> 00:07:29,450 it's going to simply tell us that by printing the process I.D. if you're on Windows you should have 89 00:07:29,450 --> 00:07:32,700 this command minus those two quotes. 90 00:07:32,780 --> 00:07:34,020 I'm gonna go ahead and run it. 91 00:07:34,040 --> 00:07:34,970 And what do I get. 92 00:07:35,060 --> 00:07:42,110 I get Agent PD 8 7 4 3 which means that things are already running after running this command. 93 00:07:42,110 --> 00:07:48,190 The last thing to do is to register the file that's SS H hyphen at now. 94 00:07:48,230 --> 00:07:53,540 If you're on a Mac you have to use the hyphen capital K a flag. 95 00:07:53,540 --> 00:07:56,990 This is going to make sure that things get added correctly. 96 00:07:56,990 --> 00:08:03,490 If you're on Linux or Windows you do not want to use that hyphen capital K as it'll cause a problem. 97 00:08:03,530 --> 00:08:10,550 From here we simply provide the path to that private key file dot pub is the public one the other one 98 00:08:10,550 --> 00:08:21,020 is the private one that is Tilde forward slash dot SS H forward slash I d underscore R S A when we run 99 00:08:21,020 --> 00:08:27,860 that command we can see the identity has been added now when we try to facilitate an SS H communication 100 00:08:28,070 --> 00:08:31,880 we'll be able to do it securely using our key pair. 101 00:08:31,880 --> 00:08:37,430 Now at this point we haven't actually used the key pair to do anything in the next video we're going 102 00:08:37,430 --> 00:08:42,270 to address that by getting our code pushed up to the github servers. 103 00:08:42,320 --> 00:08:46,670 I'm excited to get to that let's go ahead and jump right in to the next video.