1
00:00:00,090 --> 00:00:01,050
In this demonstration,

2
00:00:01,050 --> 00:00:03,540
we're going to walk through how to create a password

3
00:00:03,540 --> 00:00:06,183
to protect the Grub 2 configurations.

4
00:00:07,140 --> 00:00:09,060
Now the Grub 2 is a bootloader.

5
00:00:09,060 --> 00:00:11,580
And of course the bootloader is what's used initially

6
00:00:11,580 --> 00:00:14,310
to get the operating system up and running.

7
00:00:14,310 --> 00:00:17,040
It locates all the necessary resources required

8
00:00:17,040 --> 00:00:19,440
for our systems to function properly.

9
00:00:19,440 --> 00:00:21,810
So we're going to walk through how to protect this

10
00:00:21,810 --> 00:00:26,520
Grub 2 boot loader by adding a password to it, okay?

11
00:00:26,520 --> 00:00:31,520
First we need to find the grub.cfg file, config file.

12
00:00:32,790 --> 00:00:35,700
Now the thing is, it depends on if you're using a UEFI

13
00:00:35,700 --> 00:00:37,773
or a BIOS firmware.

14
00:00:38,670 --> 00:00:40,470
I'm currently using a BIOS firmware,

15
00:00:40,470 --> 00:00:41,820
which is the older type.

16
00:00:41,820 --> 00:00:43,470
But if you're using UEFI,

17
00:00:43,470 --> 00:00:45,390
then your location of this grub,

18
00:00:45,390 --> 00:00:48,600
that CFG file is going to be in a different location.

19
00:00:48,600 --> 00:00:52,173
So if you're using the UEFI, which most people probably are,

20
00:00:53,610 --> 00:00:54,663
we going to look here.

21
00:00:58,080 --> 00:01:02,010
And this is going to be the location of your grub cfg file,

22
00:01:02,010 --> 00:01:03,540
but mine is going to be in a different location.

23
00:01:03,540 --> 00:01:06,360
If you're using a BIOS system,

24
00:01:06,360 --> 00:01:09,180
it's going to be in boot/grub2.

25
00:01:09,180 --> 00:01:10,500
So we're going to walk through the process

26
00:01:10,500 --> 00:01:13,380
of making a custom configuration file,

27
00:01:13,380 --> 00:01:16,230
that will modify the grub.config file.

28
00:01:16,230 --> 00:01:17,400
Okay, let's go ahead and look and see

29
00:01:17,400 --> 00:01:19,350
what this config file looks like.

30
00:01:19,350 --> 00:01:24,350
sudo, but my mine's in the boot folder, remember,

31
00:01:26,580 --> 00:01:29,523
grub2 grub.cfg.

32
00:01:31,290 --> 00:01:32,970
Okay, a lot of this is a script.

33
00:01:32,970 --> 00:01:34,030
And what's going to happen is,

34
00:01:34,030 --> 00:01:37,020
we're going to run a make feed command here shortly.

35
00:01:37,020 --> 00:01:39,540
It's going to combine all of our custom files

36
00:01:39,540 --> 00:01:42,270
to allow us to customize the menu

37
00:01:42,270 --> 00:01:44,400
and the grub 2, once we reboot.

38
00:01:44,400 --> 00:01:46,770
And we're going to show that a little bit later.

39
00:01:46,770 --> 00:01:50,130
So again, we're about to create a password file,

40
00:01:50,130 --> 00:01:51,810
under a custom file name,

41
00:01:51,810 --> 00:01:54,090
and we're going to put it under our grub.d folder

42
00:01:54,090 --> 00:01:56,040
under the etc directory,

43
00:01:56,040 --> 00:01:58,950
and then it's going to combine everything into this one file

44
00:01:58,950 --> 00:02:01,800
which is the .cfg that we're looking at now.

45
00:02:01,800 --> 00:02:04,293
Okay, so let's go ahead and make this password.

46
00:02:14,130 --> 00:02:16,950
Okay, so we see it created a hash for a password.

47
00:02:16,950 --> 00:02:20,850
And if you were wondering the pbkdf2

48
00:02:20,850 --> 00:02:24,660
that's a hashing function that's still currently used.

49
00:02:24,660 --> 00:02:29,580
it's similar to SHA-1, SHA-256 SHA-128

50
00:02:29,580 --> 00:02:32,010
all of those different type of hashing algorithms,

51
00:02:32,010 --> 00:02:34,260
but we're going to use this one for our grub 2 file,

52
00:02:34,260 --> 00:02:35,510
that's the preferred one.

53
00:02:36,390 --> 00:02:38,970
Okay, so now we're going to adjust this config file,

54
00:02:38,970 --> 00:02:40,050
and we're going to make sure

55
00:02:40,050 --> 00:02:42,033
that it requires the password, okay.

56
00:02:43,230 --> 00:02:45,420
So we're going to go ahead and modify that custom file

57
00:02:45,420 --> 00:02:46,533
we just created.

58
00:02:49,140 --> 00:02:50,193
use the vim editor,

59
00:02:53,760 --> 00:02:56,343
better remove this entire line right here,

60
00:02:59,520 --> 00:03:01,320
both three and the password as well.

61
00:03:04,530 --> 00:03:06,130
Then we're just going to edit this.

62
00:03:13,950 --> 00:03:16,980
We're going to put a little note here, pretty much,

63
00:03:16,980 --> 00:03:18,347
password for jkelly,

64
00:03:27,510 --> 00:03:30,273
and I'm going to set myself as a super user, okay.

65
00:03:35,160 --> 00:03:36,480
Okay, so once you finish,

66
00:03:36,480 --> 00:03:38,423
your screen should look something like this.

67
00:03:39,330 --> 00:03:42,859
Now we're going to make the configuration file

68
00:03:42,859 --> 00:03:44,790
and it's going to update the current one that we already have

69
00:03:44,790 --> 00:03:46,260
with all the information that's in that

70
00:03:46,260 --> 00:03:48,483
etc grub d folder,

71
00:03:52,050 --> 00:03:55,043
the o options are specifying which file we're going to look at.

72
00:03:58,770 --> 00:04:02,160
Okay, now so again, just remember I'm using bios,

73
00:04:02,160 --> 00:04:05,100
if you're using UEFI your location

74
00:04:05,100 --> 00:04:05,933
will be somewhere different,

75
00:04:05,933 --> 00:04:10,710
it should be boot efi then slash capital EFI

76
00:04:10,710 --> 00:04:12,630
and then probably centos,

77
00:04:12,630 --> 00:04:15,633
and then you're going to use the grub.cfg.

78
00:04:18,600 --> 00:04:20,820
Okay, so let's just reboot this really quick

79
00:04:20,820 --> 00:04:23,010
and just make sure that we're going to be prompted

80
00:04:23,010 --> 00:04:25,410
for a password when we try to get into the grub.

81
00:04:26,880 --> 00:04:29,010
All right, going to click the escape,

82
00:04:29,010 --> 00:04:30,210
so that'll stop the timer.

83
00:04:30,210 --> 00:04:31,800
We're going to do e for edit.

84
00:04:31,800 --> 00:04:33,900
And you see it prompts me for my password.

85
00:04:35,460 --> 00:04:37,020
Now be very careful with this password

86
00:04:37,020 --> 00:04:39,720
because if you mess up, there's no way to come back,

87
00:04:39,720 --> 00:04:41,850
it's not a redo type of situation.

88
00:04:41,850 --> 00:04:44,940
So, all right, now we're in here.

89
00:04:44,940 --> 00:04:46,980
Again, all we did was go through,

90
00:04:46,980 --> 00:04:49,290
and we figured out how to put restrictions

91
00:04:49,290 --> 00:04:53,070
by adding a password authentication, to access the grub 2

92
00:04:53,070 --> 00:04:56,133
to protect some of our valuable boot up instructions.

93
00:04:57,000 --> 00:04:58,500
That concludes this lesson,

94
00:04:58,500 --> 00:05:00,153
and I'll see you in the next one.

