From 31c9819763af7b90ea1ebe205dea74b35afb0d2b Mon Sep 17 00:00:00 2001 From: Greg DiCristofaro <gregd@basistech.com> Date: Thu, 4 Aug 2022 15:07:00 -0400 Subject: [PATCH] updates --- installation/README.md | 3 +- .../scripts/install_application_from_zip.sh | 84 +++++++++++++++++++ .../scripts/install_autopsy_from_zip.sh | 80 ------------------ installation/scripts/install_prereqs_osx.sh | 2 +- unix_setup.sh | 23 +++-- 5 files changed, 101 insertions(+), 91 deletions(-) create mode 100644 installation/scripts/install_application_from_zip.sh delete mode 100644 installation/scripts/install_autopsy_from_zip.sh diff --git a/installation/README.md b/installation/README.md index bb420817eb..8b52d43d42 100644 --- a/installation/README.md +++ b/installation/README.md @@ -121,4 +121,5 @@ - HEIF processing # Known Issues -- On initial run, Autopsy shows a window that can appear behind the splash screen. This looks like Autopsy has stalled during startup. The easiest way to get around this issue for the first run is to run autopsy with the `--nosplash` flag, which will hide the splash screen on startup. There will be a lag where no window appears for a bit, so please be patient. \ No newline at end of file +- On initial run, Autopsy shows a window that can appear behind the splash screen. This looks like Autopsy has stalled during startup. The easiest way to get around this issue for the first run is to run autopsy with the `--nosplash` flag, which will hide the splash screen on startup. There will be a lag where no window appears for a bit, so please be patient. +- If a script fails to run due to operation not permitted or something along those lines, you may need to run `chmod u+x <path to script>` from the command line to allow the script to run. \ No newline at end of file diff --git a/installation/scripts/install_application_from_zip.sh b/installation/scripts/install_application_from_zip.sh new file mode 100644 index 0000000000..35569a94a4 --- /dev/null +++ b/installation/scripts/install_application_from_zip.sh @@ -0,0 +1,84 @@ +#!/bin/bash +# Unzips an application platform zip to specified directory and does setup + +usage() { + echo "Usage: install_application_from_zip.sh [-z zip_path] [-i install_directory] [-j java_home] [-n application_name] [-v asc_file]" 1>&2 + echo "If specifying a .asc verification file (with -v flag), the program will attempt to create a temp folder in the working directory and verify the signature with gpg." 1>&2 +} + +APPLICATION_NAME = "autopsy"; + +while getopts "n:z:i:j:v:" o; do + case "${o}" in + n) + APPLICATION_NAME = ${OPTARG} + ;; + z) + APPLICATION_ZIP_PATH=${OPTARG} + ;; + i) + INSTALL_DIR=${OPTARG} + ;; + v) + ASC_FILE=${OPTARG} + ;; + j) + JAVA_PATH=${OPTARG} + ;; + *) + usage + exit 1 + ;; + esac +done + +if [[ -z "$APPLICATION_ZIP_PATH" ]] || [[ -z "$INSTALL_DIR" ]]; then + usage + exit 1 +fi + +if [[ -n "$ASC_FILE" ]]; then + VERIFY_DIR=$(pwd)/temp + KEY_DIR=$VERIFY_DIR/private + mkdir -p $VERIFY_DIR && + sudo wget -O $VERIFY_DIR/carrier.asc https://sleuthkit.org/carrier.asc && + mkdir -p $KEY_DIR && + sudo chmod 600 $KEY_DIR && + sudo gpg --homedir "$KEY_DIR" --import $VERIFY_DIR/carrier.asc && + sudo gpgv --homedir "$KEY_DIR" --keyring "$KEY_DIR/pubring.kbx" $ASC_FILE $APPLICATION_ZIP_PATH && + sudo rm -r $VERIFY_DIR + if [[ $? -ne 0 ]]; then + echo "Unable to successfully verify $APPLICATION_ZIP_PATH with $ASC_FILE" >>/dev/stderr + exit 1 + fi +fi + +ZIP_FILE_NAME=$(basename -- "$APPLICATION_ZIP_PATH") +ZIP_NAME="${ZIP_FILE_NAME%.*}" +APPLICATION_EXTRACTED_PATH=$INSTALL_DIR/$ZIP_NAME + +if [[ -d $APPLICATION_EXTRACTED_PATH || -f $APPLICATION_EXTRACTED_PATH ]]; then + echo "A file or directory already exists at $APPLICATION_EXTRACTED_PATH" >>/dev/stderr + exit 1 +fi + +echo "Extracting $APPLICATION_ZIP_PATH to $APPLICATION_EXTRACTED_PATH..." +mkdir -p $APPLICATION_EXTRACTED_PATH && + unzip $APPLICATION_ZIP_PATH -d $INSTALL_DIR +if [[ $? -ne 0 ]]; then + echo "Unable to successfully extract $APPLICATION_ZIP_PATH to $INSTALL_DIR" >>/dev/stderr + exit 1 +fi + +echo "Setting up application at $APPLICATION_EXTRACTED_PATH..." +pushd $APPLICATION_EXTRACTED_PATH && + chown -R $(whoami) . && + chmod u+x ./unix_setup.sh && + ./unix_setup.sh -j $JAVA_PATH && + popd +if [[ $? -ne 0 ]]; then + echo "Unable to setup permissions for application binaries" >>/dev/stderr + exit 1 +else + echo "Application setup done." +fi diff --git a/installation/scripts/install_autopsy_from_zip.sh b/installation/scripts/install_autopsy_from_zip.sh deleted file mode 100644 index f195e612c6..0000000000 --- a/installation/scripts/install_autopsy_from_zip.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash -# Unzips an autopsy platform zip to specified directory and does setup - -usage() { - echo "Usage: install_autopsy.sh [-z zip_path] [-i install_directory] [-j java_home] [-v asc_file]" 1>&2 - echo "If specifying a .asc verification file (with -v flag), the program will attempt to create a temp folder in the working directory and verify the signature with gpg." 1>&2 -} - -while getopts "z:i:j:v:" o; do - case "${o}" in - z) - AUTOPSY_ZIP_PATH=${OPTARG} - ;; - i) - INSTALL_DIR=${OPTARG} - ;; - v) - ASC_FILE=${OPTARG} - ;; - j) - JAVA_PATH=${OPTARG} - ;; - *) - usage - exit 1 - ;; - esac -done - -if [[ -z "$AUTOPSY_ZIP_PATH" ]] || [[ -z "$INSTALL_DIR" ]]; then - usage - exit 1 -fi - -if [[ -n "$ASC_FILE" ]]; then - VERIFY_DIR=$(pwd)/temp - KEY_DIR=$VERIFY_DIR/private - mkdir -p $VERIFY_DIR && - sudo wget -O $VERIFY_DIR/carrier.asc https://sleuthkit.org/carrier.asc && - mkdir -p $KEY_DIR && - sudo chmod 600 $KEY_DIR && - sudo gpg --homedir "$KEY_DIR" --import $VERIFY_DIR/carrier.asc && - sudo gpgv --homedir "$KEY_DIR" --keyring "$KEY_DIR/pubring.kbx" $ASC_FILE $AUTOPSY_ZIP_PATH && - sudo rm -r $VERIFY_DIR - if [[ $? -ne 0 ]]; then - echo "Unable to successfully verify $AUTOPSY_ZIP_PATH with $ASC_FILE" >>/dev/stderr - exit 1 - fi -fi - -ZIP_FILE_NAME=$(basename -- "$AUTOPSY_ZIP_PATH") -ZIP_NAME="${ZIP_FILE_NAME%.*}" -AUTOPSY_EXTRACTED_PATH=$INSTALL_DIR/$ZIP_NAME - -if [[ -d $AUTOPSY_EXTRACTED_PATH || -f $AUTOPSY_EXTRACTED_PATH ]]; then - echo "A file or directory already exists at $AUTOPSY_EXTRACTED_PATH" >>/dev/stderr - exit 1 -fi - -echo "Extracting $AUTOPSY_ZIP_PATH to $AUTOPSY_EXTRACTED_PATH..." -mkdir -p $AUTOPSY_EXTRACTED_PATH && - unzip $AUTOPSY_ZIP_PATH -d $INSTALL_DIR -if [[ $? -ne 0 ]]; then - echo "Unable to successfully extract $AUTOPSY_ZIP_PATH to $INSTALL_DIR" >>/dev/stderr - exit 1 -fi - -echo "Setting up autopsy at $AUTOPSY_EXTRACTED_PATH..." -pushd $AUTOPSY_EXTRACTED_PATH && - chown -R $(whoami) . && - chmod u+x ./unix_setup.sh && - ./unix_setup.sh -j $JAVA_PATH && - popd -if [[ $? -ne 0 ]]; then - echo "Unable to setup permissions for autopsy binaries" >>/dev/stderr - exit 1 -else - echo "Autopsy setup done." - echo "Autopsy can be launched at $AUTOPSY_EXTRACTED_PATH/bin/autopsy" -fi diff --git a/installation/scripts/install_prereqs_osx.sh b/installation/scripts/install_prereqs_osx.sh index 7a3e90cc4c..acba010989 100644 --- a/installation/scripts/install_prereqs_osx.sh +++ b/installation/scripts/install_prereqs_osx.sh @@ -2,7 +2,7 @@ echo "Installing dependencies..." # dependencies taken from: https://github.com/sleuthkit/autopsy/pull/5111/files # brew install postgresql gettext cppunit && \ -brew install ant automake libtool afflib libewf libpq testdisk imagemagick gstreamer gst-plugins-base gst-plugins-good +brew install ant automake libtool afflib libewf libpq testdisk gstreamer gst-plugins-base gst-plugins-good if [[ $? -ne 0 ]] then echo "Unable to install necessary dependencies" >> /dev/stderr diff --git a/unix_setup.sh b/unix_setup.sh index 70acd8cd60..a1e570dcff 100644 --- a/unix_setup.sh +++ b/unix_setup.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Verifies programs are installed and copies native code into the Autopsy folder structure +# Verifies programs are installed and copies native code into the Application folder structure # # NOTE: update_sleuthkit_version.pl updates this value and relies @@ -9,11 +9,16 @@ TSK_VERSION=4.11.1 usage() { - echo "Usage: unix_setup.sh [-j java_home]" 1>&2; + echo "Usage: unix_setup.sh [-j java_home] [-n application_name]" 1>&2; } -while getopts "j:" o; do +APPLICATION_NAME = "autopsy"; + +while getopts "j:n:" o; do case "${o}" in + n) + APPLICATION_NAME = ${OPTARG} + ;; j) JAVA_PATH=${OPTARG} ;; @@ -27,7 +32,7 @@ done # In the beginning... echo "---------------------------------------------" -echo "Checking prerequisites and preparing Autopsy:" +echo "Checking prerequisites and preparing ${APPLICATION_NAME}:" echo "---------------------------------------------" # Verify PhotoRec was installed @@ -47,8 +52,8 @@ fi echo -n "Checking for Java..." if [ -n "$JAVA_PATH" ]; then if [ -x "$JAVA_PATH/bin/java" ]; then - sed -Ei '/^#?\s*jdkhome=/d' etc/autopsy.conf - echo "jdkhome=$JAVA_PATH" >> etc/autopsy.conf + sed -Ei '/^#?\s*jdkhome=/d' etc/$(APPLICATION_NAME).conf + echo "jdkhome=$JAVA_PATH" >> etc/$(APPLICATION_NAME).conf else echo "ERROR: Java was not found in $JAVA_PATH." exit 1 @@ -81,7 +86,7 @@ else fi ext_jar_filepath=$PWD/autopsy/modules/ext/sleuthkit-$TSK_VERSION.jar; -echo -n "Copying sleuthkit-$TSK_VERSION.jar into the Autopsy directory..." +echo -n "Copying sleuthkit-$TSK_VERSION.jar into the $APPLICATION_NAME directory..." rm -f "$ext_jar_filepath"; if [ "$?" -gt 0 ]; then #checking if remove operation failed echo "ERROR: Deleting $ext_jar_filepath failed." @@ -105,8 +110,8 @@ chmod u+x autopsy/markmckinnon/parse* chmod -R u+x autopsy/solr/bin # make sure it is executable -find /home/autopsy/src/commander/commander-1.0.0/bin/* -not -name "*.exe" | xargs chmod u+x +chmod u+x bin/$APPLICATION_NAME echo -echo "Autopsy is now configured. You can execute $(find /home/autopsy/src/commander/commander-1.0.0/bin/* -not -name "*.exe") to start it" +echo "Application is now configured. You can execute bin/$APPLICATION_NAME to start it" echo -- GitLab