Building Shellinabox inside a RockyLinux 9 Container on Raspberry Pi4

Author: Ananda Kammampati

Dated: September 2022

 

Goal:

  • To run the program 'Shellinabox' on Raspberry Pi4 running RockyLinux 9

Approach:

  • Build the program inside a RockyLinux 9 Container to avoid installing the required packeges on the Host OS

Steps:

  • Create a rockylinux 9 container, install the prerequisites and build shellinabox inside the container
  • Create the required systemd service file on the Host OS
  • Run it, Enable it

Note:

  • The prompt rl9-host# denotes commands executed on the Host OS
  • The prompt ctr# denotes commands executed inside the Container
  • The IP Address 192.168.1.10 is shown only as an example. Change it according to your setup

Out of Scope:

  • Installation of Docker

References:

Raspberry Pi4
rl9-host# uname -a
Linux management 5.15.55-v8.1.el9.altarch #1 SMP PREEMPT Tue Jul 26 04:16:30 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

rl9-host# cat /etc/*release
NAME="Rocky Linux"
VERSION="9.0 (Blue Onyx)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.0"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Rocky Linux 9.0 (Blue Onyx)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:9::baseos"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-9"
ROCKY_SUPPORT_PRODUCT_VERSION="9.0"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.0"
Rocky Linux release 9.0 (Blue Onyx)
Rocky Linux release 9.0 (Blue Onyx)
Rocky Linux release 9.0 (Blue Onyx)

rl9-host# docker run --name rl9 -ti -v /usr/local:/usr/local arm64v8/rockylinux:9 /bin/bash

ctr# dnf -y update

ctr# dnf -y upgrade

ctr# dnf -y install git openssl-devel pam-devel zlib-devel autoconf automake libtool diffutils

ctr# git clone https://github.com/shellinabox/shellinabox.git && cd shellinabox

ctr# autoreconf -i

ctr# ./configure LIBS="-lssl -lcrypto" --prefix=/usr/local/shellinabox

ctr# make

ctr# make install

ctr# ls -lR /usr/local/shellinabox

ctr# exit 

rl9-host# export PATH=/usr/local/shellinabox/bin:$PATH

rl9-host# shellinaboxd --help

rl9-host# docker stop rl9 ; docker rm rl9

rl9-host# docker rmi -f arm64v8/rockylinux:9

rl9-host# vi /etc/sysconfig/shellinaboxd
-----
PORT=4200
OPTS="--disable-ssl-menu -s /:SSH:192.168.1.10" 
-----

rl9-host# vi /etc/systemd/system/shellinaboxd.service
-----
[Unit]
Description=Shellinaboxd

[Service]
ExecStart=/usr/local/shellinabox/bin/shellinaboxd -q

[Install]
WantedBy=multi-user.target
----

rl9-host# systemctl daemon-reload

rl9-host# systemctl start shellinaboxd

rl9-host# systemctl status -l shellinaboxd

rl9-host# systemctl enable shellinaboxd

To SSH using browser:

Visit http://192.168.1.10:4200


shellinabox-rl9