Merge branch 'bugfix/KASM-7221-add_cyberbro_workspace_develop' into 'develop'

Add Cyberbro to develop

Closes KASM-7221

See merge request kasm-technologies/internal/workspaces-images!280
This commit is contained in:
Richard Koliser 2025-09-07 05:00:24 +00:00 committed by GitLab
commit b5f2360988
No known key found for this signature in database
8 changed files with 247 additions and 2 deletions

View file

@ -22,6 +22,14 @@ multiImages:
- src/ubuntu/install/gtk/**
- src/ubuntu/install/chromium/**
- src/ubuntu/install/certificates/**
- name: cyberbro
singleapp: true
base: core-ubuntu-noble
dockerfile: dockerfile-kasm-cyberbro
changeFiles:
- dockerfile-kasm-cyberbro
- src/ubuntu/install/firefox/**
- src/ubuntu/install/cyberbro/**
- name: deluge
runset: set-a
singleapp: true

View file

@ -188,7 +188,7 @@ ssh \
ready_check
# Pull tester image
docker pull ${ORG_NAME}/kasm-tester:1.17.0
docker pull ${ORG_NAME}/kasm-tester:bugfix_KASM-7221-fix_cyberbro_tests
# Run test
cp /root/.ssh/id_rsa $(dirname ${CI_PROJECT_DIR})/sshkey
@ -210,7 +210,7 @@ docker run --rm \
-e REPO=workspaces-images \
-e AUTOMATED=true \
-v $(dirname ${CI_PROJECT_DIR})/sshkey:/sshkey:ro ${SLIM_FLAG} \
kasmweb/kasm-tester:1.17.0
kasmweb/kasm-tester:bugfix_KASM-7221-fix_cyberbro_tests
# Shutdown Instances
turnoff

44
dockerfile-kasm-cyberbro Normal file
View file

@ -0,0 +1,44 @@
ARG BASE_TAG="develop"
ARG BASE_IMAGE="core-ubuntu-jammy"
FROM kasmweb/$BASE_IMAGE:$BASE_TAG
USER root
ENV HOME /home/kasm-default-profile
ENV STARTUPDIR /dockerstartup
ENV INST_SCRIPTS $STARTUPDIR/install
WORKDIR $HOME
######### Customize Container Here ###########
# Cyberbro requires a browser, install Firefox
COPY ./src/ubuntu/install/firefox/ $INST_SCRIPTS/firefox/
COPY ./src/ubuntu/install/firefox/firefox.desktop $HOME/Desktop/
RUN bash $INST_SCRIPTS/firefox/install_firefox.sh && rm -rf $INST_SCRIPTS/firefox/
# Install Cyberbro
COPY ./src/ubuntu/install/cyberbro $INST_SCRIPTS/cyberbro/
RUN bash $INST_SCRIPTS/cyberbro/install_cyberbro.sh && rm -rf $INST_SCRIPTS/cyberbro/
COPY ./src/ubuntu/install/cyberbro/custom_startup.sh $STARTUPDIR/custom_startup.sh
RUN chmod +x $STARTUPDIR/custom_startup.sh
RUN chmod 755 $STARTUPDIR/custom_startup.sh
# Update the desktop environment to be optimized for a single application
RUN cp $HOME/.config/xfce4/xfconf/single-application-xfce-perchannel-xml/* $HOME/.config/xfce4/xfconf/xfce-perchannel-xml/
RUN cp /usr/share/backgrounds/bg_kasm.png /usr/share/backgrounds/bg_default.png
RUN apt-get remove -y xfce4-panel
######### End Customizations ###########
#ADD ./src/common/scripts $STARTUPDIR
RUN $STARTUPDIR/set_user_permission.sh $HOME
RUN chown 1000:0 $HOME
ENV HOME /home/kasm-user
WORKDIR $HOME
RUN mkdir -p $HOME && chown -R 1000:0 $HOME
USER 1000

42
docs/cyberbro/README.md Normal file
View file

@ -0,0 +1,42 @@
# About This Image
This Image contains a browser-accessible version of [Cyberbro](https://github.com/stanfrbd/cyberbro).
![Screenshot][Image_Screenshot]
[Image_Screenshot]: https://github.com/user-attachments/assets/f6ffb648-e161-4c59-9359-51183b0b0ca0 "Image Screenshot"
# Environment Variables
## Firefox Configuration
* `APP_ARGS` - Additional arguments to pass to firefox when launched (e.g `--no-sandbox`).
## Cyberbro Configuration
Here is a list of all available environment variables that can be used with examples:
```bash
PROXY_URL=http://127.0.0.1:9000
VIRUSTOTAL=api_key_here
ABUSEIPDB=api_key_here
IPINFO=api_key_here
GOOGLE_SAFE_BROWSING=api_key_here
MDE_TENANT_ID=api_key_here
MDE_CLIENT_ID=api_key_here
MDE_CLIENT_SECRET=api_key_here
SHODAN=api_key_here
OPENCTI_API_KEY=api_key_here
OPENCTI_URL=https://demo.opencti.io
API_PREFIX=my_api
GUI_ENABLED_ENGINES=reverse_dns,rdap,hudsonrock,mde,shodan,opencti,virustotal
CONFIG_PAGE_ENABLED=true
```
You can pass these environment variables to your Cyberbro Workspace with **Docker Run Config Override (JSON)** in your Workspace settings.
> Note: if you set `GUI_ENABLED_ENGINES` to `""` then all engines will be enabled in the GUI. \
> By default, all **free engines** will be enabled in the GUI.
Refer to [Cyberbro Wiki](https://github.com/stanfrbd/cyberbro/wiki) for more information.

9
docs/cyberbro/demo.txt Normal file
View file

@ -0,0 +1,9 @@
# Live Demo
<a href="https://app.kasmweb.com/#/cast/<TO_BE_DEFINED>" target="_blank"><img src="https://5856039.fs1.hubspotusercontent-na1.net/hubfs/5856039/dockerhub/GIFs/<TO_BE_DEFINED>" width="640" height="360"></a>
**Launch a real-time demo in a new browser window:** <a href="https://app.kasmweb.com/#/cast/<TO_BE_DEFINED>" target="_blank">Live Demo</a>.
<a href="https://app.kasmweb.com/#/cast/<TO_BE_DEFINED>" target="_blank"><img src="https://5856039.fs1.hubspotusercontent-na1.net/hubfs/5856039/dockerhub/casting-buttons/<TO_BE_DEFINED>" width="300" height="104"></a>
&lowast;*Note: Demo is limited to 3 minutes and has upload/downloads restricted for security purposes.*

View file

@ -0,0 +1 @@
Cyberbro for Kasm Workspaces

View file

@ -0,0 +1,63 @@
#!/usr/bin/env bash
set -ex
START_COMMAND="cyberbro"
PGREP="firefox"
export MAXIMIZE="true"
export MAXIMIZE_NAME="Mozilla Firefox"
MAXIMIZE_SCRIPT=$STARTUPDIR/maximize_window.sh
DEFAULT_ARGS=""
ARGS=${APP_ARGS:-$DEFAULT_ARGS}
# Check if GUI_ENABLED_ENGINES is set else apply default
if [ -z ${GUI_ENABLED_ENGINES+x} ]; then
# Add all engines by default
GUI_ENABLED_ENGINES=""
fi
# Make GUI_ENABLED_ENGINES an environment variable
export GUI_ENABLED_ENGINES
# Process non-option arguments.
for arg; do
echo "arg! $arg"
done
FORCE=$2
# run with vgl if GPU is available
if [ -f /opt/VirtualGL/bin/vglrun ] && [ ! -z "${KASM_EGL_CARD}" ] && [ ! -z "${KASM_RENDERD}" ] && [ -O "${KASM_RENDERD}" ] && [ -O "${KASM_EGL_CARD}" ] ; then
START_COMMAND="/opt/VirtualGL/bin/vglrun -d ${KASM_EGL_CARD} $START_COMMAND"
fi
kasm_startup() {
if [ -n "$KASM_URL" ] ; then
URL=$KASM_URL
elif [ -z "$URL" ] ; then
URL=$LAUNCH_URL
fi
if [ -z "$DISABLE_CUSTOM_STARTUP" ] || [ -n "$FORCE" ] ; then
echo "Entering process startup loop"
set +x
while true
do
if ! pgrep -x $PGREP > /dev/null
then
/usr/bin/filter_ready
/usr/bin/desktop_ready
set +e
bash ${MAXIMIZE_SCRIPT} &
$START_COMMAND $ARGS $URL
set -e
fi
sleep 1
done
set -x
fi
}
kasm_startup

View file

@ -0,0 +1,78 @@
#!/usr/bin/env bash
set -xe
# Get latest Cyberbro version
CYBERBRO_VERSION=$(curl -sX GET "https://api.github.com/repos/stanfrbd/cyberbro/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]')
# Install Cyberbro
echo "Install Cyberbro"
apt-get update
apt-get install -y python3-pip git virtualenv
CYBERBRO_HOME=/opt/cyberbro
CYBERBRO_SERVER="http://127.0.0.1:5000"
mkdir -p $CYBERBRO_HOME
cd $CYBERBRO_HOME
wget https://github.com/stanfrbd/cyberbro/archive/${CYBERBRO_VERSION}.tar.gz
tar zxvf ${CYBERBRO_VERSION}.tar.gz
rm ${CYBERBRO_VERSION}.tar.gz
cd cyberbro-*
# Enter virtualenv to avoid conflicts with system packages
virtualenv venv
source venv/bin/activate
pip3 install -r requirements.txt
deactivate
# Set appropriate permissions
chown -R 1000:0 $CYBERBRO_HOME
# Create a launch script
LAUNCH_SCRIPT="$CYBERBRO_HOME/cyberbro-launch.sh"
cat <<EOF > "$LAUNCH_SCRIPT"
#!/usr/bin/env bash
set -ex
check_web_server() {
curl -s -o /dev/null ${CYBERBRO_SERVER} && return 0 || return 1
}
# Launch Cyberbro server
cd ${CYBERBRO_HOME}/cyberbro-*
source venv/bin/activate
gunicorn -b 127.0.0.1:5000 app:app &
retries=5
count=0
while ! check_web_server && [ \$count -lt \$retries ]; do
echo "Waiting for web server to start..."
sleep 1
count=\$((count + 1))
done
if ! check_web_server; then
echo "Web server did not start within the expected time."
exit 1
fi
if [[ "\$#" -gt 0 ]]; then
firefox ${CYBERBRO_SERVER} "\$@"
else
firefox ${CYBERBRO_SERVER}
fi
EOF
chmod +x $LAUNCH_SCRIPT
mv $LAUNCH_SCRIPT /usr/local/bin/cyberbro
# Cleanup for app layer
chown -R 1000:0 $HOME
find /usr/share/ -name "icon-theme.cache" -exec rm -f {} \;
if [ -z ${SKIP_CLEAN+x} ]; then
apt-get autoclean
rm -rf \
/var/lib/apt/lists/* \
/var/tmp/* \
/tmp/*
fi