From charlesreid1

KaliPi.jpg

This is a guide to the post-installation process, after connecting to a freshly-installed headless Kali Linux Raspberry Pi.

Info on setting up the headless Raspberry Pi with Kali Linux 2.0: Kali Raspberry Pi/Headless Walkthrough

General info about running Kali on the Pi here: Kali Raspberry Pi

More info about all-things Kali Linux: Kali

(older, outdated information is also on the wiki at the RaspberryPi/First_Steps page.)

Post-Installation Procedure

The post-installation procedure that will be covered by the guide includes:

  • update and install software
  • set startup services
  • set configuration for programs

Change Your Password

Kali installations use a default password of "toor". Change this IMMEDIATELY. Use the passwd command.

Software Update

(If you're connecting the Pi to a computer via a crossover ethernet cable, you won't have internet access and so you won't be able to do any software updates. If you connect the Pi to a router that is connected to the internet, you will (should) have an internet connection.)

Kali uses aptitude as a software manager. Update all your packages, and upgrade your distribution:

apt-get update
apt-get -y dist-upgrade
apt-get install -y build-essential

Install Pi Toolbox

apt-get install -y vim
apt-get install -y tshark
apt-get install -y tcpdump

Python stuff to get pip onboard:

apt-get install -y python-dev
wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
python get-pip.py

Now "which pip" should return:

# which pip
/usr/local/bin/pip

Numpy?

Be wary of loading up your Pi with lots of bells and whistles. While Numpy is a big library, with lots of bells and whistles, its usefulness outweighs any downside.

Have some patience: installing numpy will take a while.

pip install numpy

You can open another window and SSH into the Pi and run top to keep an eye on things.

Fix SSH Keys

OpenSSH server should be installed, but if it isn't:

apt-get install openssh-server

Remove any existing startup SSH service, and set the SSH service to run at SSH's default runlevel (that is, to run on boot):

update-rc.d -f ssh remove
update-rc.d -f ssh defaults

Next you will want to replace the default SSH keys provided on the SD card image. Move the old SSH keys somewhere else:

cd /etc/ssh/
mkdir insecure_original_default_kali_keys
mv ssh_host_* insecure_original_default_kali_keys/

And finally, make new SSH keys for this machine.

dpkg-reconfigure openssh-server

Non-Root User

Disable the ability to SSH as root, reducing risk of hijacking. (You did change the default root password, didn't you?) Make a non-root user who can sudo:

useradd charles
adduser charles sudo

Print info:

id charles

Next, disable root login via SSH.


Script It

Script post-install.sh:

#!/bin/bash

apt-get update
apt-get -y dist-upgrade
apt-get install -y build-essential

apt-get install -y vim
apt-get install -y tshark
apt-get install -y tcpdump

apt-get install -y python-dev
wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
python get-pip.py

apt-get install openssh-server

update-rc.d -f ssh remove
update-rc.d -f ssh defaults
cd /etc/ssh/
rm -f ssh_host_*
dpkg-reconfigure openssh-server