LXD Containers: Installing Other Apps

Pi-Hole in LXD

Linux Containers: Installing Other Apps

by Craig Miller

Linux Containers (LXD) are fun to use, typing lxc ls and all, but what about doing something useful? One of the things I really like about LXD is that rather than dedicate your Raspberry Pi to one thing, you can do multiple things, each running in their own container.

Some ideas for other Apps to install on your Pi running LXD:

The nice thing about all the above, is that it was easy to spin-up a new Linux Container, and start playing in the sandbox.

Doing something useful with LXD (Review)

We'll use the MACVLAN interface to connect our new Linux container to the network. As a refresher, the diagram looks like:

Using a Linux MACVLAN

If you are using the LXD Starer SD Card, then the default profile will already be configured to use MACVLAN interfaces. If not see LXD Essentials on how to create a profile for MACVLAN

Picking a distro for your LXD container

I am a big fan of Alpine Linux for containers, however because Alpine starts out bare bones, it is sometimes easier to start out with a distro which has more included in the base OS.

We'll start by installing Kali, a pentesting distro.

lxc launch images:kali my-container

Or if you are using LXDware, first, download an image under Images->+Image

LXDware download image

Then under Containers->+Container select your downloaded image

LXDware download image

Kali is a rolling release, so there is no version, unlike Debian or Ubuntu.

lxc launch images:kali my-container

Configuring the Kali container

You can rename your container by using the following:

lxc stop my-container
lxc rename my-container kali
lxc start kali

Kali comes as a bare-bones distro. The pentesting applications are not pre-installed.

Once your kali container is running, step into the container with the following command:

lxc exec kali bash

Login and change the root password NOW, I'll wait. Also, you should consider creating a non-privileged user account, which you normally login as.

Installing the PenTesting Apps on Kali

Back in 2017, I wrote a review of Kali, and much of the information remains the same. You can find the review of Kali.

Unfortunately katoolin is no longer supported, and can no longer be used.

First we need to install some of the kali apps

apt update
apt install urlcrazy sslscan dhcpig wpscan john

While inside your container, try a few of the Kali programs

# urlcrazy meetup.com   

# wpscan --url vicpimakers.ca

# john --wordlist=/usr/share/john/password.lst --rules  /etc/shadow

# sslscan --ipv6 --show-certificate google.com

The Kali Tools Page is an excellent resource to learn what tools are available on Kali.

Q & A

This is our third Linux Container session. There are other containerization techniques out there, such as VMWare and Virtualbox, but they don't include support for the Raspberry Pi.

I like Linux Containers because they are light weight enough to run on a Pi, and then run them on a faster machine, if you need more power.

Using LXD on a Pi

You can enjoy the advantages of Linux Containers in your own home by installing it on a Pi. While it is cool to just run containers, they can also do useful things, such as development sandboxes, a video conferencing app or even run a Pi-Hole.


Notes:


23 June 2023