From 4e0afc82b9eb18ec949731de7a030f6bc854540a Mon Sep 17 00:00:00 2001 From: Justin Travis Date: Tue, 26 Dec 2023 16:44:31 -0500 Subject: [PATCH 1/6] KASM-5299 Nessus --- ci-scripts/template-vars.yaml | 9 +++ dockerfile-kasm-nessus | 35 +++++++++ docs/nessus/README.md | 11 +++ docs/nessus/demo.txt | 9 +++ docs/nessus/description.txt | 1 + src/ubuntu/install/nessus/custom_startup.sh | 85 +++++++++++++++++++++ src/ubuntu/install/nessus/install_nessus.sh | 28 +++++++ 7 files changed, 178 insertions(+) create mode 100644 dockerfile-kasm-nessus create mode 100644 docs/nessus/README.md create mode 100644 docs/nessus/demo.txt create mode 100644 docs/nessus/description.txt create mode 100644 src/ubuntu/install/nessus/custom_startup.sh create mode 100644 src/ubuntu/install/nessus/install_nessus.sh diff --git a/ci-scripts/template-vars.yaml b/ci-scripts/template-vars.yaml index fe446cc..5e7e50c 100644 --- a/ci-scripts/template-vars.yaml +++ b/ci-scripts/template-vars.yaml @@ -75,6 +75,15 @@ multiImages: changeFiles: - dockerfile-kasm-libre-office - src/ubuntu/install/libre_office/** + - name: nessus + base: core-ubuntu-focal + dockerfile: dockerfile-kasm-nessus + changeFiles: + - dockerfile-kasm-nessus + - src/ubuntu/install/chromium/** + - src/ubuntu/install/nessus/** + - src/ubuntu/install/tools/** + - src/ubuntu/install/cleanup/** - name: opensuse-15-desktop base: core-opensuse-15 dockerfile: dockerfile-kasm-opensuse-15-desktop diff --git a/dockerfile-kasm-nessus b/dockerfile-kasm-nessus new file mode 100644 index 0000000..5f7116b --- /dev/null +++ b/dockerfile-kasm-nessus @@ -0,0 +1,35 @@ +ARG BASE_TAG="develop" +ARG BASE_IMAGE="core-ubuntu-focal" +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 ########### + + +# Install Google Chrome +COPY ./src/ubuntu/install/chromium $INST_SCRIPTS/chromium/ +RUN bash $INST_SCRIPTS/chromium/install_chromium.sh && rm -rf $INST_SCRIPTS/chromium/ + +COPY ./src/ubuntu/install/nessus $INST_SCRIPTS/nessus/ +RUN bash $INST_SCRIPTS/nessus/install_nessus.sh && rm -rf $INST_SCRIPTS/nessus/ + +COPY ./src/ubuntu/install/nessus/custom_startup.sh $STARTUPDIR/custom_startup.sh +RUN chmod +x $STARTUPDIR/custom_startup.sh +RUN chmod 755 $STARTUPDIR/custom_startup.sh + +RUN cp /usr/share/extra/backgrounds/bg_kasm.png /usr/share/extra/backgrounds/bg_default.png + +######### End Customizations ########### + +RUN chown 1000:0 $HOME + +ENV HOME /home/kasm-user +WORKDIR $HOME +RUN mkdir -p $HOME && chown -R 1000:0 $HOME + +USER 1000 diff --git a/docs/nessus/README.md b/docs/nessus/README.md new file mode 100644 index 0000000..6d9ba24 --- /dev/null +++ b/docs/nessus/README.md @@ -0,0 +1,11 @@ +# About This Image + +This Image contains a browser-accessible version of [Tennable Nessus](https://www.tenable.com/products/nessus). + +![Screenshot][Image_Screenshot] + +[Image_Screenshot]: https://5856039.fs1.hubspotusercontent-na1.net/hubfs/5856039/dockerhub/deluge.png "Image Screenshot" + +# Environment Variables + +* `APP_ARGS` - Additional arguments to pass to the application when launched. diff --git a/docs/nessus/demo.txt b/docs/nessus/demo.txt new file mode 100644 index 0000000..86dc6f7 --- /dev/null +++ b/docs/nessus/demo.txt @@ -0,0 +1,9 @@ +# Live Demo + + + +**Launch a real-time demo in a new browser window:** Live Demo. + + + +∗*Note: Demo is limited to 3 minutes and has upload/downloads restricted for security purposes.* diff --git a/docs/nessus/description.txt b/docs/nessus/description.txt new file mode 100644 index 0000000..08d1651 --- /dev/null +++ b/docs/nessus/description.txt @@ -0,0 +1 @@ +Nessus Vulnerability Scanner for Kasm Workspaces diff --git a/src/ubuntu/install/nessus/custom_startup.sh b/src/ubuntu/install/nessus/custom_startup.sh new file mode 100644 index 0000000..696e5fe --- /dev/null +++ b/src/ubuntu/install/nessus/custom_startup.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash +set -ex +START_COMMAND="/opt/nessus/sbin/nessusd start" +PGREP="nessusd" +DEFAULT_ARGS="" +ARGS=${APP_ARGS:-$DEFAULT_ARGS} + +options=$(getopt -o gau: -l go,assign,url: -n "$0" -- "$@") || exit +eval set -- "$options" + +while [[ $1 != -- ]]; do + case $1 in + -g|--go) GO='true'; shift 1;; + -a|--assign) ASSIGN='true'; shift 1;; + -u|--url) OPT_URL=$2; shift 2;; + *) echo "bad option: $1" >&2; exit 1;; + esac +done +shift + +# Process non-option arguments. +for arg; do + echo "arg! $arg" +done + +FORCE=$2 + +kasm_exec() { + if [ -n "$OPT_URL" ] ; then + URL=$OPT_URL + elif [ -n "$1" ] ; then + URL=$1 + fi + + # Since we are execing into a container that already has the browser running from startup, + # when we don't have a URL to open we want to do nothing. Otherwise a second browser instance would open. + if [ -n "$URL" ] ; then + /usr/bin/filter_ready + /usr/bin/desktop_ready + bash ${MAXIMIZE_SCRIPT} & + $START_COMMAND $ARGS $OPT_URL & + sleep 3 + chromium-browser https://localhost:8834 --start-maximized + else + echo "No URL specified for exec command. Doing nothing." + 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 & + sleep 3 + chromium-browser https://localhost:8834 --start-maximized & + set -e + fi + sleep 1 + done + set -x + + fi + +} + +if [ -n "$GO" ] || [ -n "$ASSIGN" ] ; then + kasm_exec +else + kasm_startup +fi diff --git a/src/ubuntu/install/nessus/install_nessus.sh b/src/ubuntu/install/nessus/install_nessus.sh new file mode 100644 index 0000000..260a230 --- /dev/null +++ b/src/ubuntu/install/nessus/install_nessus.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +set -ex + +ARCH=$(arch | sed 's/x86_64/amd64/g') + +apt-get update +apt-get install -y jq + +NESSUS_URL=$(curl --request GET --url https://www.tenable.com/downloads/api/v2/pages/nessus --header 'accept: application/json' | jq -r '.releases.latest[][] | select(.file_url | contains("ubuntu1404")) | .file_url' | grep $ARCH) +NESSUS_UPDATES_URL=$(curl --request GET --url https://www.tenable.com/downloads/api/v2/pages/nessus --header 'accept: application/json' | jq -r '.releases.latest[][] | select(.file_url | contains("nessus-updates-latest")) | .file_url') + +cd /tmp + +curl --request GET \ + --url "${NESSUS_URL}" \ + --output 'nessus.deb' + +curl --request GET \ + --url ${NESSUS_UPDATES_URL} \ + --output 'nessus-updates-latest.tar.gz' + +apt-get install -y ./nessus.deb + +rm nessus.deb + +/opt/nessus/sbin/nessuscli update /tmp/nessus-updates-latest.tar.gz + +rm nessus-updates-latest.tar.gz From b066a8d99a6c7db4871c635371527fff38efd599 Mon Sep 17 00:00:00 2001 From: Justin Travis Date: Tue, 26 Dec 2023 17:10:26 -0500 Subject: [PATCH 2/6] KASM-5299 patchup arm build --- ci-scripts/template-vars.yaml | 1 - dockerfile-kasm-nessus | 3 +++ src/ubuntu/install/nessus/install_nessus.sh | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ci-scripts/template-vars.yaml b/ci-scripts/template-vars.yaml index 5e7e50c..916dd74 100644 --- a/ci-scripts/template-vars.yaml +++ b/ci-scripts/template-vars.yaml @@ -82,7 +82,6 @@ multiImages: - dockerfile-kasm-nessus - src/ubuntu/install/chromium/** - src/ubuntu/install/nessus/** - - src/ubuntu/install/tools/** - src/ubuntu/install/cleanup/** - name: opensuse-15-desktop base: core-opensuse-15 diff --git a/dockerfile-kasm-nessus b/dockerfile-kasm-nessus index 5f7116b..d53ea26 100644 --- a/dockerfile-kasm-nessus +++ b/dockerfile-kasm-nessus @@ -18,6 +18,9 @@ RUN bash $INST_SCRIPTS/chromium/install_chromium.sh && rm -rf $INST_SCRIPTS/chr COPY ./src/ubuntu/install/nessus $INST_SCRIPTS/nessus/ RUN bash $INST_SCRIPTS/nessus/install_nessus.sh && rm -rf $INST_SCRIPTS/nessus/ +COPY ./src/ubuntu/install/cleanup $INST_SCRIPTS/cleanup/ +RUN bash $INST_SCRIPTS/cleanup/cleanup.sh && rm -rf $INST_SCRIPTS/cleanup/ + COPY ./src/ubuntu/install/nessus/custom_startup.sh $STARTUPDIR/custom_startup.sh RUN chmod +x $STARTUPDIR/custom_startup.sh RUN chmod 755 $STARTUPDIR/custom_startup.sh diff --git a/src/ubuntu/install/nessus/install_nessus.sh b/src/ubuntu/install/nessus/install_nessus.sh index 260a230..156f432 100644 --- a/src/ubuntu/install/nessus/install_nessus.sh +++ b/src/ubuntu/install/nessus/install_nessus.sh @@ -6,7 +6,7 @@ ARCH=$(arch | sed 's/x86_64/amd64/g') apt-get update apt-get install -y jq -NESSUS_URL=$(curl --request GET --url https://www.tenable.com/downloads/api/v2/pages/nessus --header 'accept: application/json' | jq -r '.releases.latest[][] | select(.file_url | contains("ubuntu1404")) | .file_url' | grep $ARCH) +NESSUS_URL=$(curl --request GET --url https://www.tenable.com/downloads/api/v2/pages/nessus --header 'accept: application/json' | jq -r '.releases.latest[][] | select(.file_url | contains("ubuntu")) | .file_url' | grep $ARCH) NESSUS_UPDATES_URL=$(curl --request GET --url https://www.tenable.com/downloads/api/v2/pages/nessus --header 'accept: application/json' | jq -r '.releases.latest[][] | select(.file_url | contains("nessus-updates-latest")) | .file_url') cd /tmp From eb17cce4953168e5cf7bccb75789651fd1e81b82 Mon Sep 17 00:00:00 2001 From: Justin Travis Date: Mon, 1 Jan 2024 11:19:40 -0500 Subject: [PATCH 3/6] KASM-5299 Cleanup --- docs/nessus/README.md | 2 +- docs/nessus/demo.txt | 6 +-- src/ubuntu/install/nessus/custom_startup.sh | 45 +-------------------- 3 files changed, 5 insertions(+), 48 deletions(-) diff --git a/docs/nessus/README.md b/docs/nessus/README.md index 6d9ba24..0e57f3d 100644 --- a/docs/nessus/README.md +++ b/docs/nessus/README.md @@ -4,7 +4,7 @@ This Image contains a browser-accessible version of [Tennable Nessus](https://ww ![Screenshot][Image_Screenshot] -[Image_Screenshot]: https://5856039.fs1.hubspotusercontent-na1.net/hubfs/5856039/dockerhub/deluge.png "Image Screenshot" +[Image_Screenshot]: https://5856039.fs1.hubspotusercontent-na1.net/hubfs/5856039/dockerhub/image-screenshots/nessus.png "Image Screenshot" # Environment Variables diff --git a/docs/nessus/demo.txt b/docs/nessus/demo.txt index 86dc6f7..ef43ce5 100644 --- a/docs/nessus/demo.txt +++ b/docs/nessus/demo.txt @@ -1,9 +1,9 @@ # Live Demo - + -**Launch a real-time demo in a new browser window:** Live Demo. +**Launch a real-time demo in a new browser window:** Live Demo. - + ∗*Note: Demo is limited to 3 minutes and has upload/downloads restricted for security purposes.* diff --git a/src/ubuntu/install/nessus/custom_startup.sh b/src/ubuntu/install/nessus/custom_startup.sh index 696e5fe..db03989 100644 --- a/src/ubuntu/install/nessus/custom_startup.sh +++ b/src/ubuntu/install/nessus/custom_startup.sh @@ -5,47 +5,8 @@ PGREP="nessusd" DEFAULT_ARGS="" ARGS=${APP_ARGS:-$DEFAULT_ARGS} -options=$(getopt -o gau: -l go,assign,url: -n "$0" -- "$@") || exit -eval set -- "$options" - -while [[ $1 != -- ]]; do - case $1 in - -g|--go) GO='true'; shift 1;; - -a|--assign) ASSIGN='true'; shift 1;; - -u|--url) OPT_URL=$2; shift 2;; - *) echo "bad option: $1" >&2; exit 1;; - esac -done -shift - -# Process non-option arguments. -for arg; do - echo "arg! $arg" -done - FORCE=$2 -kasm_exec() { - if [ -n "$OPT_URL" ] ; then - URL=$OPT_URL - elif [ -n "$1" ] ; then - URL=$1 - fi - - # Since we are execing into a container that already has the browser running from startup, - # when we don't have a URL to open we want to do nothing. Otherwise a second browser instance would open. - if [ -n "$URL" ] ; then - /usr/bin/filter_ready - /usr/bin/desktop_ready - bash ${MAXIMIZE_SCRIPT} & - $START_COMMAND $ARGS $OPT_URL & - sleep 3 - chromium-browser https://localhost:8834 --start-maximized - else - echo "No URL specified for exec command. Doing nothing." - fi -} - kasm_startup() { if [ -n "$KASM_URL" ] ; then URL=$KASM_URL @@ -78,8 +39,4 @@ kasm_startup() { } -if [ -n "$GO" ] || [ -n "$ASSIGN" ] ; then - kasm_exec -else - kasm_startup -fi +kasm_startup From 84f1fd24ccb9330da70f1c06dc894ea5633a9f3b Mon Sep 17 00:00:00 2001 From: Justin Travis Date: Wed, 3 Jan 2024 06:27:24 -0500 Subject: [PATCH 4/6] KASM-5299 Typo Fix --- dockerfile-kasm-nessus | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfile-kasm-nessus b/dockerfile-kasm-nessus index d53ea26..4c54b3c 100644 --- a/dockerfile-kasm-nessus +++ b/dockerfile-kasm-nessus @@ -11,7 +11,7 @@ WORKDIR $HOME ######### Customize Container Here ########### -# Install Google Chrome +# Install Chromium COPY ./src/ubuntu/install/chromium $INST_SCRIPTS/chromium/ RUN bash $INST_SCRIPTS/chromium/install_chromium.sh && rm -rf $INST_SCRIPTS/chromium/ From 5c93e65401e62900883701ebd4fb2c40c2adff06 Mon Sep 17 00:00:00 2001 From: Justin Travis Date: Fri, 5 Jan 2024 15:05:03 -0500 Subject: [PATCH 5/6] KASM-5299 Background location change --- dockerfile-kasm-nessus | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfile-kasm-nessus b/dockerfile-kasm-nessus index 4c54b3c..2dc25fc 100644 --- a/dockerfile-kasm-nessus +++ b/dockerfile-kasm-nessus @@ -25,7 +25,7 @@ COPY ./src/ubuntu/install/nessus/custom_startup.sh $STARTUPDIR/custom_startup.sh RUN chmod +x $STARTUPDIR/custom_startup.sh RUN chmod 755 $STARTUPDIR/custom_startup.sh -RUN cp /usr/share/extra/backgrounds/bg_kasm.png /usr/share/extra/backgrounds/bg_default.png +RUN cp /usr/share/backgrounds/bg_kasm.png /usr/share/backgrounds/bg_default.png ######### End Customizations ########### From d9cc219711777c67de9df0077e47142ec51e135e Mon Sep 17 00:00:00 2001 From: Justin Travis Date: Mon, 29 Jan 2024 06:01:36 -0500 Subject: [PATCH 6/6] KASM-5299 Add Single App Flag --- ci-scripts/template-vars.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/ci-scripts/template-vars.yaml b/ci-scripts/template-vars.yaml index 34dde71..b2ff688 100644 --- a/ci-scripts/template-vars.yaml +++ b/ci-scripts/template-vars.yaml @@ -86,6 +86,7 @@ multiImages: - dockerfile-kasm-libre-office - src/ubuntu/install/libre_office/** - name: nessus + singleapp: false base: core-ubuntu-focal dockerfile: dockerfile-kasm-nessus changeFiles: