Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
Add Firefox to Ubuntu Docker image
James Murdza03b23a3fe7a9
diff --git a/libs/kasm/Dockerfile b/libs/kasm/Dockerfileindex c3a4c79534..526d2a7fc8 100644--- a/libs/kasm/Dockerfile+++ b/libs/kasm/Dockerfile@@ -18,6 +18,12 @@ gnome-screenshot wmctrl ffmpeg socat xclipRUN pip install cua-computer-server+# Install Firefox+ENV DEBIAN_FRONTEND=noninteractive \+ INST_DIR=$STARTUPDIR/install+COPY ./src/ $INST_DIR+RUN bash ${INST_DIR}/ubuntu/install/firefox/install_firefox.sh+# Disable SSL requirementRUN sed -i 's/require_ssl: true/require_ssl: false/g' /usr/share/kasmvnc/kasmvnc_defaults.yamlRUN sed -i 's/-sslOnly//g' /dockerstartup/vnc_startup.shdiff --git a/libs/kasm/LICENSE b/libs/kasm/LICENSEnew file mode 100644index 0000000000..d0838e6b3f--- /dev/null+++ b/libs/kasm/LICENSE@@ -0,0 +1,24 @@+# LICENSE++MIT License++Copyright (c) 2025 Cua AI, Inc.+Portions Copyright (c) 2022 Kasm Technologies Inc.++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.\ No newline at end of filediff --git a/libs/kasm/src/ubuntu/install/firefox/custom_startup.sh b/libs/kasm/src/ubuntu/install/firefox/custom_startup.shnew file mode 100644index 0000000000..943d5dd389--- /dev/null+++ b/libs/kasm/src/ubuntu/install/firefox/custom_startup.sh@@ -0,0 +1,89 @@+#!/usr/bin/env bash+set -ex+START_COMMAND="firefox"+PGREP="firefox"+export MAXIMIZE="true"+export MAXIMIZE_NAME="Mozilla Firefox"+MAXIMIZE_SCRIPT=$STARTUPDIR/maximize_window.sh+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++# 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_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+ 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+ set -e+ fi+ sleep 1+ done+ set -x++ fi++}++if [ -n "$GO" ] || [ -n "$ASSIGN" ] ; then+ kasm_exec+else+ kasm_startup+fidiff --git a/libs/kasm/src/ubuntu/install/firefox/firefox.desktop b/libs/kasm/src/ubuntu/install/firefox/firefox.desktopnew file mode 100644index 0000000000..e8362412d8--- /dev/null+++ b/libs/kasm/src/ubuntu/install/firefox/firefox.desktop@@ -0,0 +1,221 @@+[Desktop Entry]+Version=1.0+Name=Firefox Web Browser+Name[ar]=متصفح الويب فَيَرفُكْس+Name[ast]=Restolador web Firefox+Name[bn]=ফায়ারফক্স ওয়েব ব্রাউজার+Name[ca]=Navegador web Firefox+Name[cs]=Firefox Webový prohlížeč+Name[da]=Firefox - internetbrowser+Name[el]=Περιηγητής Firefox+Name[es]=Navegador web Firefox+Name[et]=Firefoxi veebibrauser+Name[fa]=مرورگر اینترنتی Firefox+Name[fi]=Firefox-selain+Name[fr]=Navigateur Web Firefox+Name[gl]=Navegador web Firefox+Name[he]=דפדפן האינטרנט Firefox+Name[hr]=Firefox web preglednik+Name[hu]=Firefox webböngésző+Name[it]=Firefox Browser Web+Name[ja]=Firefox ウェブ・ブラウザ+Name[ko]=Firefox 웹 브라우저+Name[ku]=Geroka torê Firefox+Name[lt]=Firefox interneto naršyklė+Name[nb]=Firefox Nettleser+Name[nl]=Firefox webbrowser+Name[nn]=Firefox Nettlesar+Name[no]=Firefox Nettleser+Name[pl]=Przeglądarka WWW Firefox+Name[pt]=Firefox Navegador Web+Name[pt_BR]=Navegador Web Firefox+Name[ro]=Firefox – Navigator Internet+Name[ru]=Веб-браузер Firefox+Name[sk]=Firefox - internetový prehliadač+Name[sl]=Firefox spletni brskalnik+Name[sv]=Firefox webbläsare+Name[tr]=Firefox Web Tarayıcısı+Name[ug]=Firefox توركۆرگۈ+Name[uk]=Веб-браузер Firefox+Name[vi]=Trình duyệt web Firefox+Name[zh_CN]=Firefox 网络浏览器+Name[zh_TW]=Firefox 網路瀏覽器+Comment=Browse the World Wide Web+Comment[ar]=تصفح الشبكة العنكبوتية العالمية+Comment[ast]=Restola pela Rede+Comment[bn]=ইন্টারনেট ব্রাউজ করুন+Comment[ca]=Navegueu per la web+Comment[cs]=Prohlížení stránek World Wide Webu+Comment[da]=Surf på internettet+Comment[de]=Im Internet surfen+Comment[el]=Μπορείτε να περιηγηθείτε στο διαδίκτυο (Web)+Comment[es]=Navegue por la web+Comment[et]=Lehitse veebi+Comment[fa]=صفحات شبکه جهانی اینترنت را مرور نمایید+Comment[fi]=Selaa Internetin WWW-sivuja+Comment[fr]=Naviguer sur le Web+Comment[gl]=Navegar pola rede+Comment[he]=גלישה ברחבי האינטרנט+Comment[hr]=Pretražite web+Comment[hu]=A világháló böngészése+Comment[it]=Esplora il web+Comment[ja]=ウェブを閲覧します+Comment[ko]=웹을 돌아 다닙니다+Comment[ku]=Li torê bigere+Comment[lt]=Naršykite internete+Comment[nb]=Surf på nettet+Comment[nl]=Verken het internet+Comment[nn]=Surf på nettet+Comment[no]=Surf på nettet+Comment[pl]=Przeglądanie stron WWW+Comment[pt]=Navegue na Internet+Comment[pt_BR]=Navegue na Internet+Comment[ro]=Navigați pe Internet+Comment[ru]=Доступ в Интернет+Comment[sk]=Prehliadanie internetu+Comment[sl]=Brskajte po spletu+Comment[sv]=Surfa på webben+Comment[tr]=İnternet'te Gezinin+Comment[ug]=دۇنيادىكى توربەتلەرنى كۆرگىلى بولىدۇ+Comment[uk]=Перегляд сторінок Інтернету+Comment[vi]=Để duyệt các trang web+Comment[zh_CN]=浏览互联网+Comment[zh_TW]=瀏覽網際網路+GenericName=Web Browser+GenericName[ar]=متصفح ويب+GenericName[ast]=Restolador Web+GenericName[bn]=ওয়েব ব্রাউজার+GenericName[ca]=Navegador web+GenericName[cs]=Webový prohlížeč+GenericName[da]=Webbrowser+GenericName[el]=Περιηγητής διαδικτύου+GenericName[es]=Navegador web+GenericName[et]=Veebibrauser+GenericName[fa]=مرورگر اینترنتی+GenericName[fi]=WWW-selain+GenericName[fr]=Navigateur Web+GenericName[gl]=Navegador Web+GenericName[he]=דפדפן אינטרנט+GenericName[hr]=Web preglednik+GenericName[hu]=Webböngésző+GenericName[it]=Browser web+GenericName[ja]=ウェブ・ブラウザ+GenericName[ko]=웹 브라우저+GenericName[ku]=Geroka torê+GenericName[lt]=Interneto naršyklė+GenericName[nb]=Nettleser+GenericName[nl]=Webbrowser+GenericName[nn]=Nettlesar+GenericName[no]=Nettleser+GenericName[pl]=Przeglądarka WWW+GenericName[pt]=Navegador Web+GenericName[pt_BR]=Navegador Web+GenericName[ro]=Navigator Internet+GenericName[ru]=Веб-браузер+GenericName[sk]=Internetový prehliadač+GenericName[sl]=Spletni brskalnik+GenericName[sv]=Webbläsare+GenericName[tr]=Web Tarayıcı+GenericName[ug]=توركۆرگۈ+GenericName[uk]=Веб-браузер+GenericName[vi]=Trình duyệt Web+GenericName[zh_CN]=网络浏览器+GenericName[zh_TW]=網路瀏覽器+Keywords=Internet;WWW;Browser;Web;Explorer+Keywords[ar]=انترنت;إنترنت;متصفح;ويب;وب+Keywords[ast]=Internet;WWW;Restolador;Web;Esplorador+Keywords[ca]=Internet;WWW;Navegador;Web;Explorador;Explorer+Keywords[cs]=Internet;WWW;Prohlížeč;Web;Explorer+Keywords[da]=Internet;Internettet;WWW;Browser;Browse;Web;Surf;Nettet+Keywords[de]=Internet;WWW;Browser;Web;Explorer;Webseite;Site;surfen;online;browsen+Keywords[el]=Internet;WWW;Browser;Web;Explorer;Διαδίκτυο;Περιηγητής;Firefox;Φιρεφοχ;Ιντερνετ+Keywords[es]=Explorador;Internet;WWW+Keywords[fi]=Internet;WWW;Browser;Web;Explorer;selain;Internet-selain;internetselain;verkkoselain;netti;surffaa+Keywords[fr]=Internet;WWW;Browser;Web;Explorer;Fureteur;Surfer;Navigateur+Keywords[he]=דפדפן;אינטרנט;רשת;אתרים;אתר;פיירפוקס;מוזילה;+Keywords[hr]=Internet;WWW;preglednik;Web+Keywords[hu]=Internet;WWW;Böngésző;Web;Háló;Net;Explorer+Keywords[it]=Internet;WWW;Browser;Web;Navigatore+Keywords[is]=Internet;WWW;Vafri;Vefur;Netvafri;Flakk+Keywords[ja]=Internet;WWW;Web;インターネット;ブラウザ;ウェブ;エクスプローラ+Keywords[nb]=Internett;WWW;Nettleser;Explorer;Web;Browser;Nettside+Keywords[nl]=Internet;WWW;Browser;Web;Explorer;Verkenner;Website;Surfen;Online+Keywords[pt]=Internet;WWW;Browser;Web;Explorador;Navegador+Keywords[pt_BR]=Internet;WWW;Browser;Web;Explorador;Navegador+Keywords[ru]=Internet;WWW;Browser;Web;Explorer;интернет;браузер;веб;файрфокс;огнелис+Keywords[sk]=Internet;WWW;Prehliadač;Web;Explorer+Keywords[sl]=Internet;WWW;Browser;Web;Explorer;Brskalnik;Splet+Keywords[tr]=İnternet;WWW;Tarayıcı;Web;Gezgin;Web sitesi;Site;sörf;çevrimiçi;tara+Keywords[uk]=Internet;WWW;Browser;Web;Explorer;Інтернет;мережа;переглядач;оглядач;браузер;веб;файрфокс;вогнелис;перегляд+Keywords[vi]=Internet;WWW;Browser;Web;Explorer;Trình duyệt;Trang web+Keywords[zh_CN]=Internet;WWW;Browser;Web;Explorer;网页;浏览;上网;火狐;Firefox;ff;互联网;网站;+Keywords[zh_TW]=Internet;WWW;Browser;Web;Explorer;網際網路;網路;瀏覽器;上網;網頁;火狐+Exec=firefox %u+Terminal=false+X-MultipleArgs=false+Type=Application+Icon=/usr/lib/firefox/browser/chrome/icons/default/default128.png+Categories=GNOME;GTK;Network;WebBrowser;+MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;application/x-xpinstall;+StartupNotify=true+Actions=NewWindow;NewPrivateWindow;++[Desktop Action NewWindow]+Name=Open a New Window+Name[ar]=افتح نافذة جديدة+Name[ast]=Abrir una ventana nueva+Name[bn]=Abrir una ventana nueva+Name[ca]=Obre una finestra nova+Name[cs]=Otevřít nové okno+Name[da]=Åbn et nyt vindue+Name[de]=Ein neues Fenster öffnen+Name[el]=Άνοιγμα νέου παραθύρου+Name[es]=Abrir una ventana nueva+Name[fi]=Avaa uusi ikkuna+Name[fr]=Ouvrir une nouvelle fenêtre+Name[gl]=Abrir unha nova xanela+Name[he]=פתיחת חלון חדש+Name[hr]=Otvori novi prozor+Name[hu]=Új ablak nyitása+Name[it]=Apri una nuova finestra+Name[ja]=新しいウィンドウを開く+Name[ko]=새 창 열기+Name[ku]=Paceyeke nû veke+Name[lt]=Atverti naują langą+Name[nb]=Åpne et nytt vindu+Name[nl]=Nieuw venster openen+Name[pt]=Abrir nova janela+Name[pt_BR]=Abrir nova janela+Name[ro]=Deschide o fereastră nouă+Name[ru]=Новое окно+Name[sk]=Otvoriť nové okno+Name[sl]=Odpri novo okno+Name[sv]=Öppna ett nytt fönster+Name[tr]=Yeni pencere aç+Name[ug]=يېڭى كۆزنەك ئېچىش+Name[uk]=Відкрити нове вікно+Name[vi]=Mở cửa sổ mới+Name[zh_CN]=新建窗口+Name[zh_TW]=開啟新視窗+Exec=firefox -new-window+OnlyShowIn=Unity;++[Desktop Action NewPrivateWindow]+Name=Open a New Private Window+Name[ar]=افتح نافذة جديدة للتصفح الخاص+Name[ca]=Obre una finestra nova en mode d'incògnit+Name[de]=Ein neues privates Fenster öffnen+Name[es]=Abrir una ventana privada nueva+Name[fi]=Avaa uusi yksityinen ikkuna+Name[fr]=Ouvrir une nouvelle fenêtre de navigation privée+Name[he]=פתיחת חלון גלישה פרטית חדש+Name[hu]=Új privát ablak nyitása+Name[it]=Apri una nuova finestra anonima+Name[nb]=Åpne et nytt privat vindu+Name[ru]=Новое приватное окно+Name[sl]=Odpri novo okno zasebnega brskanja+Name[tr]=Yeni bir pencere aç+Name[uk]=Відкрити нове вікно у потайливому режимі+Name[zh_TW]=開啟新隱私瀏覽視窗+Exec=firefox -private-window+OnlyShowIn=Unity;diff --git a/libs/kasm/src/ubuntu/install/firefox/install_firefox.sh b/libs/kasm/src/ubuntu/install/firefox/install_firefox.shnew file mode 100644index 0000000000..bad5c0606c--- /dev/null+++ b/libs/kasm/src/ubuntu/install/firefox/install_firefox.sh@@ -0,0 +1,236 @@+#!/usr/bin/env bash+set -xe++# Add icon+if [ -f /dockerstartup/install/ubuntu/install/firefox/firefox.desktop ]; then+ mv /dockerstartup/install/ubuntu/install/firefox/firefox.desktop $HOME/Desktop/+fi++ARCH=$(arch | sed 's/aarch64/arm64/g' | sed 's/x86_64/amd64/g')++set_desktop_icon() {+ sed -i -e 's!Icon=.\+!Icon=/usr/share/icons/hicolor/48x48/apps/firefox.png!' "$HOME/Desktop/firefox.desktop"+}++echo "Install Firefox"+if [[ "${DISTRO}" == @(oracle8|rockylinux9|rockylinux8|oracle9|rhel9|almalinux9|almalinux8|fedora39|fedora40) ]]; then+ dnf install -y firefox p11-kit+elif [ "${DISTRO}" == "opensuse" ]; then+ zypper install -yn p11-kit-tools MozillaFirefox+elif grep -q Jammy /etc/os-release || grep -q Noble /etc/os-release; then+ if [ ! -f '/etc/apt/preferences.d/mozilla-firefox' ]; then+ add-apt-repository -y ppa:mozillateam/ppa+ echo '+Package: *+Pin: release o=LP-PPA-mozillateam+Pin-Priority: 1001+' > /etc/apt/preferences.d/mozilla-firefox+ fi+ apt-get install -y firefox p11-kit-modules+elif grep -q "ID=kali" /etc/os-release; then+ apt-get update+ apt-get install -y firefox-esr p11-kit-modules+ rm -f $HOME/Desktop/firefox.desktop+ cp \+ /usr/share/applications/firefox-esr.desktop \+ $HOME/Desktop/+ chmod +x $HOME/Desktop/firefox-esr.desktop+elif grep -q "ID=debian" /etc/os-release || grep -q "ID=parrot" /etc/os-release; then+ if [ "${ARCH}" == "amd64" ]; then+ install -d -m 0755 /etc/apt/keyrings+ wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- > /etc/apt/keyrings/packages.mozilla.org.asc+ echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" > /etc/apt/sources.list.d/mozilla.list+echo '+Package: *+Pin: origin packages.mozilla.org+Pin-Priority: 1000+' > /etc/apt/preferences.d/mozilla+ apt-get update+ apt-get install -y firefox p11-kit-modules+ else+ apt-get update+ apt-get install -y firefox-esr p11-kit-modules+ rm -f $HOME/Desktop/firefox.desktop+ cp \+ /usr/share/applications/firefox-esr.desktop \+ $HOME/Desktop/+ chmod +x $HOME/Desktop/firefox-esr.desktop+ fi+else+ apt-mark unhold firefox || :+ apt-get remove firefox+ apt-get update+ apt-get install -y firefox p11-kit-modules+fi++# Add Langpacks+FIREFOX_VERSION=$(curl -sI https://download.mozilla.org/?product=firefox-latest | awk -F '(releases/|/win32)' '/Location/ {print $2}')+RELEASE_URL="https://releases.mozilla.org/pub/firefox/releases/${FIREFOX_VERSION}/win64/xpi/"+LANGS=$(curl -Ls ${RELEASE_URL} | awk -F '(xpi">|</a>)' '/href.*xpi/ {print $2}' | tr '\n' ' ')+EXTENSION_DIR=/usr/lib/firefox-addons/distribution/extensions/+mkdir -p ${EXTENSION_DIR}+for LANG in ${LANGS}; do+ LANGCODE=$(echo ${LANG} | sed 's/\.xpi//g')+ echo "Downloading ${LANG} Language pack"+ curl -o \+ ${EXTENSION_DIR}langpack-${LANGCODE}@firefox.mozilla.org.xpi -Ls \+ ${RELEASE_URL}${LANG}+done++# Cleanup and install flash if supported+if [[ "${DISTRO}" == @(oracle8|rockylinux9|rockylinux8|oracle9|rhel9|almalinux9|almalinux8|fedora39|fedora40) ]]; then+ if [ -z ${SKIP_CLEAN+x} ]; then+ dnf clean all+ fi+elif [ "${DISTRO}" == "opensuse" ]; then+ if [ -z ${SKIP_CLEAN+x} ]; then+ zypper clean --all+ fi+else+ if [ "$ARCH" == "arm64" ] && [ "$(lsb_release -cs)" == "focal" ] ; then+ echo "Firefox flash player not supported on arm64 Ubuntu Focal Skipping"+ elif grep -q "ID=debian" /etc/os-release || grep -q "ID=kali" /etc/os-release || grep -q "ID=parrot" /etc/os-release; then+ echo "Firefox flash player not supported on Debian"+ elif grep -q Focal /etc/os-release; then+ # Plugin to support running flash videos for sites like vimeo+ apt-get update+ apt-get install -y browser-plugin-freshplayer-pepperflash+ apt-mark hold firefox+ if [ -z ${SKIP_CLEAN+x} ]; then+ apt-get autoclean+ rm -rf \+ /var/lib/apt/lists/* \+ /var/tmp/*+ fi+ fi+fi++if [[ "${DISTRO}" != @(oracle8|rockylinux9|rockylinux8|oracle9|rhel9|almalinux9|almalinux8|opensuse|fedora39|fedora40) ]]; then+ # Update firefox to utilize the system certificate store instead of the one that ships with firefox+ if grep -q "ID=debian" /etc/os-release || grep -q "ID=kali" /etc/os-release || grep -q "ID=parrot" /etc/os-release && [ "${ARCH}" == "arm64" ]; then+ rm -f /usr/lib/firefox-esr/libnssckbi.so+ ln /usr/lib/$(arch)-linux-gnu/pkcs11/p11-kit-trust.so /usr/lib/firefox-esr/libnssckbi.so+ elif grep -q "ID=kali" /etc/os-release && [ "${ARCH}" == "amd64" ]; then+ rm -f /usr/lib/firefox-esr/libnssckbi.so+ ln /usr/lib/$(arch)-linux-gnu/pkcs11/p11-kit-trust.so /usr/lib/firefox-esr/libnssckbi.so+ else+ rm -f /usr/lib/firefox/libnssckbi.so+ ln /usr/lib/$(arch)-linux-gnu/pkcs11/p11-kit-trust.so /usr/lib/firefox/libnssckbi.so+ fi+fi++if [[ "${DISTRO}" == @(oracle8|rockylinux9|rockylinux8|oracle9|rhel9|almalinux9|almalinux8|fedora39|fedora40) ]]; then+ if [[ "${DISTRO}" == @(fedora39|fedora40) ]]; then+ preferences_file=/usr/lib64/firefox/browser/defaults/preferences/firefox-redhat-default-prefs.js+ else+ preferences_file=/usr/lib64/firefox/browser/defaults/preferences/all-redhat.js+ fi+ sed -i -e '/homepage/d' "$preferences_file"+elif [ "${DISTRO}" == "opensuse" ]; then+ preferences_file=/usr/lib64/firefox/browser/defaults/preferences/firefox.js+elif grep -q "ID=kali" /etc/os-release; then+ preferences_file=/usr/lib/firefox-esr/defaults/pref/firefox.js+elif grep -q "ID=debian" /etc/os-release || grep -q "ID=parrot" /etc/os-release; then+ if [ "${ARCH}" == "amd64" ]; then+ preferences_file=/usr/lib/firefox/defaults/pref/firefox.js+ else+ preferences_file=/usr/lib/firefox-esr/defaults/pref/firefox.js+ fi+else+ preferences_file=/usr/lib/firefox/browser/defaults/preferences/firefox.js+fi++# Disabling default first run URL for Debian based images+if [[ "${DISTRO}" != @(oracle8|rockylinux9|rockylinux8|oracle9|rhel9|almalinux9|almalinux8|opensuse|fedora39|fedora40) ]]; then+cat >"$preferences_file" <<EOF+pref("datareporting.policy.firstRunURL", "");+pref("datareporting.policy.dataSubmissionEnabled", false);+pref("datareporting.healthreport.service.enabled", false);+pref("datareporting.healthreport.uploadEnabled", false);+pref("trailhead.firstrun.branches", "nofirstrun-empty");+pref("browser.aboutwelcome.enabled", false);+EOF+fi++if [[ "${DISTRO}" == @(oracle8|rockylinux9|rockylinux8|oracle9|rhel9|almalinux9|almalinux8|opensuse|fedora39|fedora40) ]]; then+ # Creating a default profile+ chown -R root:root $HOME+ firefox -headless -CreateProfile "kasm $HOME/.mozilla/firefox/kasm"+ # Generate a certdb to be detected on squid start+ HOME=/root firefox --headless &+ mkdir -p /root/.mozilla+ CERTDB=$(find /root/.mozilla* -name "cert9.db")+ while [ -z "${CERTDB}" ] ; do+ sleep 1+ echo "waiting for certdb"+ CERTDB=$(find /root/.mozilla* -name "cert9.db")+ done+ sleep 2+ kill $(pgrep firefox)+ CERTDIR=$(dirname ${CERTDB})+ mv ${CERTDB} $HOME/.mozilla/firefox/kasm/+ rm -Rf /root/.mozilla+else+ # Creating Default Profile+ chown -R 0:0 $HOME+ firefox -headless -CreateProfile "kasm $HOME/.mozilla/firefox/kasm"+fi++# Silence Firefox security nag "Some of Firefox's features may offer less protection on your current operating system".+echo 'user_pref("security.sandbox.warn_unprivileged_namespaces", false);' > $HOME/.mozilla/firefox/kasm/user.js+chown 1000:1000 $HOME/.mozilla/firefox/kasm/user.js++if [[ "${DISTRO}" == @(oracle8|rockylinux9|rockylinux8|oracle9|rhel9|almalinux9|almalinux8|opensuse|fedora39|fedora40) ]]; then+ set_desktop_icon+fi++# Starting with version 67, Firefox creates a unique profile mapping per installation which is hash generated+# based off the installation path. Because that path will be static for our deployments we can assume the hash+# and thus assign our profile to the default for the installation+if grep -q "ID=kali" /etc/os-release; then+cat >>$HOME/.mozilla/firefox/profiles.ini <<EOL+[Install3B6073811A6ABF12]+Default=kasm+Locked=1+EOL+elif grep -q "ID=debian" /etc/os-release || grep -q "ID=parrot" /etc/os-release; then+ if [ "${ARCH}" != "amd64" ]; then+ cat >>$HOME/.mozilla/firefox/profiles.ini <<EOL+[Install3B6073811A6ABF12]+Default=kasm+Locked=1+EOL+ else+ cat >>$HOME/.mozilla/firefox/profiles.ini <<EOL+ [Install4F96D1932A9F858E]+ Default=kasm+ Locked=1+EOL+ fi+elif [[ "${DISTRO}" != @(oracle8|rockylinux9|rockylinux8|oracle9|rhel9|almalinux9|almalinux8|opensuse|fedora39|fedora40) ]]; then+cat >>$HOME/.mozilla/firefox/profiles.ini <<EOL+[Install4F96D1932A9F858E]+Default=kasm+Locked=1+EOL+elif [[ "${DISTRO}" == @(oracle8|rockylinux9|rockylinux8|oracle9|rhel9|almalinux9|almalinux8|opensuse|fedora39|fedora40) ]]; then+cat >>$HOME/.mozilla/firefox/profiles.ini <<EOL+[Install11457493C5A56847]+Default=kasm+Locked=1+EOL+fi++# Desktop Icon FIxes+if [[ "${DISTRO}" == @(rockylinux9|oracle9|rhel9|almalinux9|fedora39|fedora40) ]]; then+ sed -i 's#Icon=/usr/lib/firefox#Icon=/usr/lib64/firefox#g' $HOME/Desktop/firefox.desktop+fi++# Cleanup for app layer+chown -R 1000:0 $HOME+find /usr/share/ -name "icon-theme.cache" -exec rm -f {} \;+if [ -f $HOME/Desktop/firefox.desktop ]; then+ chmod +x $HOME/Desktop/firefox.desktop+fi+chown -R 1000:1000 $HOME/.mozilla+