Gilles.is

/Today/20210119-Vandaag-19-January-2021

Toggle Light


By Gilles Trenson
this is a 1 minutes read
18 paragraphs

Vandaag 19 January 2021

Kali linux on Raspberry Pi - Part 1

#kali#avahi#ssh#kalisetup#systemctl#firstboot

Bonjour which I found out is build around mDNS won't start on wakeup. They are disabled in /usr/sbin/update-rc.d. Services as the avahi-daemon which enables mDNS, ssh and postgresql are disabled by default. For more information, see Kali networking.

Enable avahi-daemon

Make kali.local discoverable

avahi-daemon is included in the default configuration. However, it's not configured.

sudo systemctl start avahi-daemon # Start the agent right away
sudo systemctl enable avahi-daemon # Start it on every reboot

We still need to adapt the update-rc.d file so the service will be enabled on startup.

sudo sed -i 's/avahi-daemon.*/avahi-daemon enabled/' /usr/sbin/update-rc.d

Enable ssh

Enabling the ssh agent involves the same steps required to enable avahi.

sudo systemctl start ssh # Start the agent right away
sudo systemctl enable ssh # Start it on every reboot

However, Kali Linux will prevent the service to restart despite we enabled it. To allow the service to start automatically, we're required to enable it in the /usr/sbin/update-rc.d file.

sudo sed -i 's/ssh.*/ssh enabled/' /usr/sbin/update-rc.d

And if everything went right, you'll should get ssh enabled back when running: cat /usr/sbin/update-rc.d | grep ssh.

DANGER: Change default ssh key to avoid a MITM attack

By defaults, some keys are generated and stored in the /etc/ssh/ directory. Move the keys and generate a new one.

cd /etc/ssh/ && sudo mkdir default_kali_keys
sudo mv ssh_host_* default_kali_keys/

Next, we generate a new keys using:

sudo dpkg-reconfigure openssh-server # Generate some new ssh keys

MOTD - Message Of The Day

Say something nice to your users

Enable HEADLESS mode

We'll configure kali to run headless, to save power and memory. This can be enabled using:

sudo systemctl set-default multi-user.target # opposite of graphical.target
sudo systemctl get-default # shows new default mode
reboot