WEBVTT

1
00:00.000 --> 00:05.790
So friends, in this particular video, what we're going to do is set up SSH keys

2
00:05.790 --> 00:06.160
so that we can

3
00:06.160 --> 00:10.840
authenticate into our managed devices, that is going to be the blue box and

4
00:10.840 --> 00:11.600
yellow box

5
00:11.600 --> 00:17.120
from the Ansible control node without having to enter any passwords. And now it

6
00:17.120 --> 00:18.480
's not just that.

7
00:18.480 --> 00:22.800
What we want to do is on each of our machines, that is the Ansible control node

8
00:22.800 --> 00:23.600
, as well as

9
00:23.600 --> 00:28.320
the managed devices, we want to create a user called Ansible. And this is going

10
00:28.320 --> 00:29.520
to be a dedicated

11
00:29.520 --> 00:34.640
user account for Ansible to operate. Now it's not absolutely essential that you
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

11
00:29.520 --> 00:34.640
user account for Ansible to operate. Now it's not absolutely essential that you

12
00:34.640 --> 00:35.040
create

13
00:35.040 --> 00:39.910
a Ansible user, but realistically for managing things such as security, having

14
00:39.910 --> 00:40.800
this dedicated

15
00:40.800 --> 00:44.730
account really does keep things a lot cleaner. So the very first thing is we

16
00:44.730 --> 00:45.760
will create that

17
00:45.760 --> 00:49.880
Ansible account, we'll say it's sudo user ads dash M, and I will just say Ans

18
00:49.880 --> 00:50.880
ible. And then I

19
00:50.880 --> 00:55.300
will say it's sudo pass wd and then specify the account I want to create the

20
00:55.300 --> 00:56.240
password for,

21
00:56.240 --> 01:00.510
which is Ansible. If I hit enter, now what I'm going to do is specify the
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

21
00:56.240 --> 01:00.510
which is Ansible. If I hit enter, now what I'm going to do is specify the

22
01:00.510 --> 01:01.440
password that I want

23
01:01.440 --> 01:05.520
to use for the Ansible account. Now just to keep things really, really simple,

24
01:05.520 --> 01:06.160
I will alter

25
01:06.160 --> 01:10.120
as call the password Ansible. Okay, once again, not exactly best practices, we

26
01:10.120 --> 01:10.880
can see we're getting

27
01:10.880 --> 01:14.520
a warning that this is a bad password, but nevertheless, let's just stick with

28
01:14.520 --> 01:14.960
the word

29
01:14.960 --> 01:19.420
Ansible again. Okay, so we now have created this Ansible user, let's do the

30
01:19.420 --> 01:20.560
same thing on the

31
01:20.560 --> 01:26.110
other two machines. So I'm here on the blue box, let me just say sudo user ad

32
01:26.110 --> 01:27.680
dash m Ansible,

33
01:27.680 --> 01:31.600
type in the password of password one for super user privileges. And now I will
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

33
01:27.680 --> 01:31.600
type in the password of password one for super user privileges. And now I will

34
01:31.600 --> 01:32.000
create the

35
01:32.000 --> 01:36.500
password for the Ansible user so sudo pass wd Ansible. Again, the password is

36
01:36.500 --> 01:37.520
simply going to be the

37
01:37.520 --> 01:42.450
word Ansible. And let's just confirm that and to enter. Now let's go to the

38
01:42.450 --> 01:43.920
yellow box. Once again,

39
01:43.920 --> 01:48.000
let's just create the Ansible user and we'll give the Ansible user password of

40
01:48.000 --> 01:48.880
Ansible and once

41
01:48.880 --> 01:52.790
again just confirm that password. Now what I also want to do is to give the Ans

42
01:52.790 --> 01:54.160
ible user account

43
01:54.160 --> 01:58.800
access to the sudo command without having to type a password. Once again, we

44
01:58.800 --> 01:59.600
will handle this a

45
01:59.600 --> 02:03.000
little bit different in a real environment, but for simplicity and for the
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

45
01:59.600 --> 02:03.000
little bit different in a real environment, but for simplicity and for the

46
02:03.000 --> 02:03.680
purposes of the

47
02:03.680 --> 02:07.530
examination, we are absolutely fine to do so. So let's just say sudo vice sudo.

48
02:07.530 --> 02:08.640
And if we scroll

49
02:08.640 --> 02:13.140
all the way down just below this part here that says route all equals all, all

50
02:13.140 --> 02:13.680
I'm going to do

51
02:13.680 --> 02:17.320
here is say Ansible, which is the name of the user accounts, and then say all

52
02:17.320 --> 02:18.000
equals a name

53
02:18.000 --> 02:24.140
within parentheses all. And then I would just say no pass wd colon and then the

54
02:24.140 --> 02:25.280
word all. So if I

55
02:25.280 --> 02:29.740
just write and quit, let's do the same thing on blue box and yellow box. So

56
02:29.740 --> 02:31.200
once again, sudo vice
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

56
02:29.740 --> 02:31.200
once again, sudo vice

57
02:31.200 --> 02:35.480
sudo and just type in the exact same information again. Perfect. So colon

58
02:35.480 --> 02:37.360
writing quits. And lastly,

59
02:37.360 --> 02:41.940
on the yellow box machine, we just sudo vice sudo and again, just type in the

60
02:41.940 --> 02:43.680
exact same content.

61
02:43.680 --> 02:48.400
Once again, saving with a wq. So if on my main machine, I just type ipadder, we

62
02:48.400 --> 02:49.520
can see the ip address

63
02:49.520 --> 02:56.450
happens to be 192168160.133. And we want to be able to reach the blue box and

64
02:56.450 --> 02:57.760
yellow box. So

65
02:57.760 --> 03:02.160
let's see what their IP addresses are. So once again, we just do ipadder on the
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

65
02:57.760 --> 03:02.160
let's see what their IP addresses are. So once again, we just do ipadder on the

66
03:02.160 --> 03:02.800
blue box, we can

67
03:02.800 --> 03:11.450
see this is 192168160.134. And over on the yellow box, we are on 160.135. What

68
03:11.450 --> 03:12.320
I actually want to do

69
03:12.320 --> 03:16.720
now is to create some SSH keys for login. Now what I'm going to do is I'm going

70
03:16.720 --> 03:17.680
to create these keys

71
03:17.680 --> 03:22.420
as the answerable user sources, sudo su hyphen answerable and I enter, we can

72
03:22.420 --> 03:23.440
now see the username

73
03:23.440 --> 03:28.830
has changed to answerable right here. And what I'm going to do is say SSH hyp

74
03:28.830 --> 03:29.920
hen key gen and

75
03:29.920 --> 03:33.440
enter. That's going to tell me the file where it's going to save automatically.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

75
03:29.920 --> 03:33.440
enter. That's going to tell me the file where it's going to save automatically.

76
03:33.440 --> 03:34.080
That is fine. So

77
03:34.080 --> 03:38.090
I'll just hit enter. It's going to ask me for a passphrase. Now in the real

78
03:38.090 --> 03:39.360
world, once again,

79
03:39.360 --> 03:43.330
we absolutely want to be adding a passphrase but for simplicity for the

80
03:43.330 --> 03:44.160
examination.

81
03:44.160 --> 03:47.870
Absolutely find you to leave this blank. So let's just hit enter and enter

82
03:47.870 --> 03:49.280
again. And now we have

83
03:49.280 --> 03:54.160
automatically generated our SSH key pair, the public key as well as the private

84
03:54.160 --> 03:54.960
key. Now what

85
03:54.960 --> 04:00.010
we want to be able to do is to share the public key with the blue box and the
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

85
03:54.960 --> 04:00.010
we want to be able to do is to share the public key with the blue box and the

86
04:00.010 --> 04:01.360
yellow box. This

87
04:01.360 --> 04:05.730
is going to allow us to authenticate in as the answerable user to those devices

88
04:05.730 --> 04:06.480
without having to

89
04:06.480 --> 04:10.230
type in the password answerable, which is going to be much, much better for us

90
04:10.230 --> 04:11.280
when working an

91
04:11.280 --> 04:17.240
in automated fashion. So all I will say is SSH hyphen copy ID. And then I will

92
04:17.240 --> 04:18.720
say answerable at

93
04:18.720 --> 04:25.490
192.168.168.134, which is the first machine the blue box machine. If I enter, I

94
04:25.490 --> 04:26.640
will say yes.

95
04:26.640 --> 04:29.520
And I will type in the password of answerable the very first time I'm doing

96
04:29.520 --> 04:30.640
this authentication.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

96
04:29.520 --> 04:30.640
this authentication.

97
04:30.640 --> 04:35.120
Perfect. We have now added the key to that particular machine for the blue box.

98
04:35.120 --> 04:40.550
And similarly, if I arrow up and do 135, I answer, I now say yes to add the

99
04:40.550 --> 04:42.080
fingerprint. I type in

100
04:42.080 --> 04:47.450
answerable again. I now log into the yellow box and transfer my public key over

101
04:47.450 --> 04:48.800
to that particular

102
04:48.800 --> 04:52.940
device. So now moving forward whilst I'm on the red box itself, the answerable

103
04:52.940 --> 04:53.760
control node,

104
04:53.760 --> 04:57.620
if I now just want to authenticate into that particular device, say for example

105
04:57.620 --> 04:58.720
, the blue box,

106
04:58.720 --> 05:05.630
I can just say SSH, answerable, and then type in the IP address of 192.168.134.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

106
04:58.720 --> 05:05.630
I can just say SSH, answerable, and then type in the IP address of 192.168.134.

107
05:05.630 --> 05:06.640
And to enter,

108
05:06.640 --> 05:10.070
notice we authenticate straight away without having to type in the passphrase.

109
05:10.070 --> 05:10.640
I'm now on the

110
05:10.640 --> 05:15.650
blue box. See that right there? And again, if I exit out, arrow up, type 135, I

111
05:15.650 --> 05:16.320
enter,

112
05:16.320 --> 05:20.020
automatically, we just slide directly into the yellow box without having to

113
05:20.020 --> 05:20.800
type the password.

114
05:20.800 --> 05:24.140
That is exactly what we want. So now we have the basic setup of our lab

115
05:24.140 --> 05:25.520
environments. We have

116
05:25.520 --> 05:29.920
our three virtual machines. We have now created a dedicated answerable user for

117
05:29.920 --> 05:31.200
all three devices
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

117
05:29.920 --> 05:31.200
all three devices

118
05:31.200 --> 05:36.400
and have now configured passwordless SSH key authentication. With that now done

119
05:36.400 --> 05:36.400
,

120
05:36.400 --> 05:39.440
we are ready to begin talking about answerable.
