In order to install Kali Linux on Raspberry Pi, you will need to download the new image for Raspberry Pi 2 version 2.1 from https://www.offensive-security.com/kali-linux-arm-images/ (filename: kali-2.1-rpi2.img.xz).
Many people want to play around with this combination of a Raspberry Pi and Kali Linux, but they do not want to waste any time figuring out why something is not working as it should. This quick setup guide is structured in a way that will allow you to streamline the process and make sure you have your Raspberry Pi up and running within a few minutes.
[Extraction]
The .xz extension (for more info on xz see: http://tukaani.org/xz/) means that the image file is compressed and needs to be extracted. You can download the xz utilities using the command: apt-get install xz-utils
Under Linux, in order to decompress the file you can use the command:
unxz filename.any.xz or the command xz -d filename.any.xz
Since version 9.04 the package p7zip manages xz files and can extract them using the command: 7za e filename.any.xz
[Write Image to SD card]
First of all, it is very important to have a fast micro SD card. The performance of the Paspberry Pi can be dramatically affected if you do not use a fast enough card. I personally suggest the SanDisk Extreme 32 GB microSDHC Class 10 Memory Card up to 90 Mbps with U3 Ratings (Memory Card with SD Adapter).
Under Linux you can use dd to write the bootable image file onto the SD card (link).
Under Windows you can use Win32DiskImager (link).
[First Boot]
Make sure you have a monitor, a keyboard and mouse ready. Once you logon for the first time, it is highly recommended to use the passwd command and change the default password for root. (keep in mind that the default login credentials are: root / toor).
You will need to restart the SSH service (service ssh restart). For safer remote root SSH access, add your public key to the /root/.ssh/authorized_keys file.
To add a non-root user:
[Security]
If you follow these instructions then you should have already changed your Root password and added an non-root user. Another security best practice is to change your SSH host keys as soon as possible as all ARM images are pre-configured with the same keys. In order to do this, run the following commands:
[Disable X at boot time]
I find it very useful to make sure I disable X at boot time. With Kali Linux 2.1 (on Raspberry Pi 2 Model B), this is the only way that works as it should:
[Update]
You will need to update the system. Most of the features that used to come with Kali Linux, in version 2.x will need to be installed during the update process (learn what each command does here). I suggest you run:
To install chkconfig run: apt-get install chkconfig -y
[Metapackages]
Once all updates are completed, then you can either install manually any extra packages you want or you can try one of the metapackages, such as the "Kali Linux Top 10" installation (after installing a metapackage, make sure you update the system once again).
For those who want to keep track of their Raspberry Pi IP address, you can use the Adafruit Pi Finder from a Windows, Mac, or Linux desktop to locate it.
Many people want to play around with this combination of a Raspberry Pi and Kali Linux, but they do not want to waste any time figuring out why something is not working as it should. This quick setup guide is structured in a way that will allow you to streamline the process and make sure you have your Raspberry Pi up and running within a few minutes.
[Extraction]
The .xz extension (for more info on xz see: http://tukaani.org/xz/) means that the image file is compressed and needs to be extracted. You can download the xz utilities using the command: apt-get install xz-utils
Under Linux, in order to decompress the file you can use the command:
unxz filename.any.xz or the command xz -d filename.any.xz
Since version 9.04 the package p7zip manages xz files and can extract them using the command: 7za e filename.any.xz
[Write Image to SD card]
First of all, it is very important to have a fast micro SD card. The performance of the Paspberry Pi can be dramatically affected if you do not use a fast enough card. I personally suggest the SanDisk Extreme 32 GB microSDHC Class 10 Memory Card up to 90 Mbps with U3 Ratings (Memory Card with SD Adapter).
Under Linux you can use dd to write the bootable image file onto the SD card (link).
Under Windows you can use Win32DiskImager (link).
If you want to see an example on how to use dd or Win32DiskImager, you can see this blog post here, which is for the previous version (1.1.0) of Kali Linux on Raspberry Pi.Note: I strongly suggest you format your card before you start using any of the two
methods
to write the image. Once the process is complete, make sure you remove the card safely from the system
.
[First Boot]
Make sure you have a monitor, a keyboard and mouse ready. Once you logon for the first time, it is highly recommended to use the passwd command and change the default password for root. (keep in mind that the default login credentials are: root / toor).
Note: Kali Linux starts in graphical mode by default. If you want to switch to the
console press Ctrl + Alt + F1 and Ctrl + Alt + F7 to go back to the X server.
Use this command to check the services running and more specifically in this case, the SSH service: service --status-all
Note: Kali Linux 2.x takes on the Debian SSH configuration that disallow
root logins.
Effectively, if you want to use your Kali Linux 2.x Raspberry Pi remotely over SSH you will need to either create a non-privileged (non-root) user or edit the configuration file to allow root logins over SSH.
To allow root logins over SSH you will need to edit the following file /etc/ssh/sshd_config where it says PermitRootLogin and change the parameter to "yes" (without the quotes).
To allow root logins over SSH you will need to edit the following file /etc/ssh/sshd_config where it says PermitRootLogin and change the parameter to "yes" (without the quotes).
To add a non-root user:
root@kali:~# useradd -m user01 -G sudo -s /bin/bash
root@kali:~# passwd user01
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@kali:~#
[Security]
If you follow these instructions then you should have already changed your Root password and added an non-root user. Another security best practice is to change your SSH host keys as soon as possible as all ARM images are pre-configured with the same keys. In order to do this, run the following commands:
root@kali:~# rm /etc/ssh/ssh_host_*
root@kali:~# dpkg-reconfigure openssh-server
root@kali:~# service ssh restart
[Disable X at boot time]
I find it very useful to make sure I disable X at boot time. With Kali Linux 2.1 (on Raspberry Pi 2 Model B), this is the only way that works as it should:
root@kali:~# systemctl enable multi-user.target --force
root@kali:~# systemctl set-default multi-user.target
If you want to load the GUI, simple run the startx command.[Update]
You will need to update the system. Most of the features that used to come with Kali Linux, in version 2.x will need to be installed during the update process (learn what each command does here). I suggest you run:
root@kali:~# apt-get update
root@kali:~# apt-get upgrade
root@kali:~# reboot
root@kali:~# apt-get dist-upgrade
If you want to do the above in one line, you can use the following command instead: root@kali:~# apt-get clean && apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y
The following command is not necessary, but it can be useful if you want to update and query runlevel information for system services. To install chkconfig run: apt-get install chkconfig -y
[Metapackages]
Once all updates are completed, then you can either install manually any extra packages you want or you can try one of the metapackages, such as the "Kali Linux Top 10" installation (after installing a metapackage, make sure you update the system once again).
root@kali:~# apt-get install kali-linux-top10
The metapackages allow for easy installation of certain tools in a specific field. For example, you can search for available metapackages using the following command and get a similar output.root@kali:~# apt-cache search kali-linux
kali-linux - Kali Linux base system
kali-linux-all - Kali Linux - all packages
kali-linux-forensic - Kali Linux forensic tools
kali-linux-full - Kali Linux complete system
kali-linux-gpu - Kali Linux GPU tools
kali-linux-nethunter - Kali Linux Nethunter tools
kali-linux-pwtools - Kali Linux password cracking tools
kali-linux-rfid - Kali Linux RFID tools
kali-linux-sdr - Kali Linux SDR tools
kali-linux-top10 - Kali Linux Top 10 tools
kali-linux-voip - Kali Linux VoIP tools
kali-linux-web - Kali Linux webapp assessment tools
kali-linux-wireless - Kali Linux wireless tools
To get the list of the tools included in particular metapackage, use the apt command as follows:root@kali:~# apt-get show kali-linux-top10 | grep Depends
Depends: kali-linux, aircrack-ng, burpsuite, hydra, john, maltegoce, maltego-teeth,
metasploit-framework, nmap, zaproxy, sqlmap, wireshark
As you can see, by installing this particular metapackage, you will get metasploit installed as well. For those who want to keep track of their Raspberry Pi IP address, you can use the Adafruit Pi Finder from a Windows, Mac, or Linux desktop to locate it.
No comments:
Post a Comment