BusyBox/Jenkins/Samba/FTP/Apache

Jenkins is a build and continuous integration service. The build server can be combined with Maven for Java and Samba.

Jenkins

jenkins
#!/bin/bash
# Create the appliance in a schroot and
# configures the shellinabox daemon.
# Process edits variable SHELLINABOX_ARGS which
# will be evaluated by the daemon at runtime.
# File descriptors sorted in reverse order

echo Create Jenkins

cat > /etc/apt/sources.list.d/jenkins-ci.list <<-'CAT'
        deb http://pkg.jenkins-ci.org/debian binary/
CAT

wget --no-check-certificate --output-document=- \
        https://pkg.jenkins.io/debian/jenkins.io.key |
apt-key add -

apt update

apt install --yes supermin kvmtool shellinabox || exit 1

DEBIAN_FRONTEND=noninteractive apt install \
        --quiet \
        --assume-yes \
        --option='Acquire::http::AllowRedirect=true' \
        --option='APT::Get::Download-Only=false' \
        at bash dash man mount base-files busybox strace ncurses-term ncurses-bin samba smbclient cifs-utils smbldap-tools ldap-utils udhcpc stow sysvinit-utils util-linux login libc-bin libpam-runtime libpam0g apache2-utils vsftpd sed haveged default-jre || exit 1

        apt --yes install jenkins=2.156 || {
                sed -i /etc/init.d/jenkins \
                        -e /JAVA_ALLOWED_VERSION/s/\"18\"/\"110\ 2019-01-15\"/

                sed -i /etc/default/jenkins -f - <<-'SED'
                        /enable-future-java/b
                        /^JENKINS_ARGS/s/"\(.*\)"/"\1 --enable-future-java"/
                SED
        } &&
        apt --yes install jenkins=2.156

supermin --verbose --prepare --use-installed -o supermin.d at busybox mount bash dash udhcpc strace samba file base-files bsdutils mailutils coreutils tzdata ncurses-bin ncurses-term eudev net-tools hostname elogind smbclient stow sysvinit-utils util-linux login libc-bin libpam-runtime libpam0g apache2-utils vsftpd sed haveged jenkins default-jre || exit 1

init
#!/bin/sh
# https://www.busybox.net/live_bbox/live_bbox.html

export PATH=/bin
export HOME=/
export TERM=vt100

mount -t proc none /proc
mount -t sysfs none /sys
mount -t devpts none /dev/pts
mount -t ramfs none /tmp

stty -F /dev/ttyS0 rows 30

echo
top -mbn1
echo "Type 'busybox' to see the list of available commands."
while true; do
        setsid sh -c 'exec sh </dev/ttyS0 >/dev/ttyS0 2>&1'
done
shellinabox
/usr/bin/shellinaboxd -d -c /var/lib/shellinabox -p 4200 -u shellinabox -g shellinabox --user-css 'Black on White:+/etc/shellinabox/options-enabled/00+Black on White.css,White On Black:-/etc/shellinabox/options-enabled/00_White On Black.css;Color Terminal:+/etc/shellinabox/options-enabled/01+Color Terminal.css,Monochrome:-/etc/shellinabox/options-enabled/01_Monochrome.css' --no-beep --service=/:root:root:HOME:lkvm\ run\ -kappliance.d/kernel\ -iappliance.d/initrd\ -dappliance.d/root\ -p'root=/dev/vda'

Apache

Apache in chroot environment should use a different port.

Proxy http request

shellinabox
# cgi is enabled by default
cat > /etc/apache2/ports.conf <<-'EOF'
        Listen localhost:8001
EOF

# cgi is enabled by default
cat > /etc/apache2/conf-available/cgi-bin <<-'EOF'
        <Directory "/usr/lib/cgi-bin">
                Options ExecCGI
                SetHandler cgi-script
        </Directory>
EOF

# apache proxy
cat > /etc/apache2/conf-available <<-'EOF'
        <Location /shell>
                ProxyPass / http://localhost:4200/
        </Location>
EOF

a2enmod cgid
a2enconf serve-cgi-conf