Hello and welcome to this. Cali fundamentals lesson.
I'm very excited to be here with you today. So
we're getting ready to jump into services and
some of the default configurations when you first turn
on Kali Linux. So if you've been asking yourself, how exactly
do I go about getting SSH to work
right notice that I don't have anything listening. When I do that netstat
command at the the beginning of booting up. Well,
the good news is today. We're going to get into a high
level understanding of initial service settings in Cali, we're
gonna understand and walk away with some service
and and process management techniques and we're
gonna have a high level understanding of how to configure services.
So I'm going to go ahead and pull our lab
environment over and I'm using the host data
Integrity baseline lab. I'm using the Cali machine that they
have there to do these exercises and show you some of
the things we're going to learn today.
So let's start off with a quick net stat. So we talked about
that in the last lesson and that a
ntp. So you'll notice here that we don't have anything listening. There's
really nothing going on. And so what we
want to do is by default HTTP services like
Apache and SSH aren't enabled in Cali
Linux and that's because if you're going to do a pin test
or you're doing some type of forensics, you're doing something to that nature. You don't
want your system to be very noisy and
you don't want anything to pick it up on the network. If
you've got a threat actor or something like that going around and
sniffing things and so we can quickly do a
service. So typically you start with service and then
the name of the service so we'll do a patchy too for HTTP services
and we'll do start.
And that'll start our Apache services and
then we'll do service SSH start.
And that will start our SSH services. So now
when we do that netstat entp command, you'll
see here that we've got some things listing. So there's the SSH Services.
There's the Apache 2 which will
be your web server. So or the web services and
so you can see now that we've got some stuff listening that we may not
want to have listening by default.
So very interesting stuff there. So you may be asking well, that's
neat, you know, and you can use that service method so
service the service name and
then start stop and that will stop a service. So if
I do service, you know the Apache 2
and I do stop.
You'll see here.
Then it's no longer listening. So you may be asking well, I
want SSH to start up by default when I
boot up my machine. I want to use it, you know every day and I need
I need that for management person purposes so you can do an update our
CD.
dot d there SSH enable
And now whenever you reboot the system or whatever the
case may be SSH should be started by default. But
if you don't make that change SSH and the
Apache Services upon a reboot should not be up and running.
Now you might be wondering how do I manage, you
know processes and things of that nature much like you do in Windows.
So let's say that I start ice weasel here.
And okay, it's up. Now. Let's say I've been working in it and it
freezes. Well, you can do a PS for process
and an ox and that'll show you everything that's pretty noisy.
You can see down here that there's ice weasel and the process
ID number now, let's say you had
a longer list than that and you want it to know it down so
you can do a PS ox and then you can do
a pipe here and then you can do grab which
allows you to get information out
of files or or outputs. And so when
I do PSX
And then I do this pipe and grip it's going to feed that
output through this grip command essentially and
I can do ice.
And bang now, I've got it kind of narrowed down
to these few things that are associated with
ice and I can see I squeezle here pretty easy. Now.
Let's say I want to kill that so you'll see down here that we're still running
Ice weasel. So if I do kill which'll kill
a process and then our process ID here
is three three six three
It's done. It killed the process. So that's a
very high level overview of how to kind of, you know,
look for processes how to kill processes if they're giving you trouble
and you know, you can move through that as you
learn the ropes and continue to Adventure into
some of that.
Now let's do this command again the net stat a ntp
now looking here. We see
that SSH is still running and the program name over here
is sshd. Well, let's say that I don't want it to
run off that default Port of of 22 there. So there are
config files this we had discussed for each of these services. So if
I do let's see a CD
and I need to go to Etsy SSH which is where the config file
is. You'll see here that we have a config file
for sshd. Okay. So if I do Nano sshd
config
I can now see a number of
different things here each of these kind of hashtag or pound
symbols essentially comments out or makes it invalid input.
So if I were to do something like this, it would essentially make
it to where that Port wasn't running. But what
we can do is let's say I want my new port to be
2212. Okay, so I do an o
or a control o and that'll save the
output to that config file. I'll do control X
to exit.
All right now.
You'll notice it's still running on 22 and that's because I have to restart
the service in order for it to take effect the
new configuration.
So I can do service SSH restart.
It will restart.
And then you'll notice that my port that I'm
running that SSH service off now is 2212 and
that's what it's listening on for connections. So at a
high level, you know, that's how we're going to be able to
manage services and that's how we're going to be able to start and stop services
using that service command. There are other commands
that you can use to manage services managing processes
and config files and things of that nature to make changes to
different services. So don't limit that to just what we
look at that here today. You can do that with any number of config
files or other services when you're troubleshooting or
trying to customize your instance and it's configuration.
So with all of that in mind, let's do a quick
check on learning. So how would you enable SSH automatically upon
boot? Well, we talked about each of these
Auto SSH. We didn't even discuss that that's not a
valid Choice here service SSH start
just starts the service but it does not do so upon
a boot you have to do this manually netstat SSH
isn't a valid combination of commands. So
that's not a valid answer. So remember we have
to do the update Dash RC dot d SSH enable
command in order to start SSH Services when
we reboot a system or something of that nature.
So in summary today in this brief lesson, we looked
at how to start the services how to manipulate Services
how to kill processes and check processes
that are running on our instance and how to
modify configuration files. And so I want
to thank you for your time today. Thank you for joining me and I look forward
to seeing you again soon.