diff --git a/installation/scripts/install_autopsy_from_zip.sh b/installation/scripts/install_autopsy_from_zip.sh index c1c33a76b7216de544ab4cf1eddcedd84c899250..272a7cd4f2ac63c13bf01606dd5528788b06eed6 100644 --- a/installation/scripts/install_autopsy_from_zip.sh +++ b/installation/scripts/install_autopsy_from_zip.sh @@ -1,26 +1,29 @@ #!/bin/bash # Unzips an autopsy platform zip to specified directory and does setup -# called like: install_autopsy.sh [-z zip_path] [-i install_directory] -usage() { - echo "Usage: install_autopsy.sh [-z zip_path] [-i install_directory] [-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; +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:v:" o; do +while getopts "z:i:j:v:" o; do case "${o}" in - z) - AUTOPSY_ZIP_PATH=${OPTARG} - ;; - i) - INSTALL_DIR=${OPTARG} - ;; - v) ASC_FILE=${OPTARG} - ;; - *) - usage - exit 1 - ;; + z) + AUTOPSY_ZIP_PATH=${OPTARG} + ;; + i) + INSTALL_DIR=${OPTARG} + ;; + v) + ASC_FILE=${OPTARG} + ;; + j) + JAVA_PATH=${OPTARG} + ;; + *) + usage + exit 1 + ;; esac done @@ -29,54 +32,48 @@ if [[ -z "$AUTOPSY_ZIP_PATH" ]] || [[ -z "$INSTALL_DIR" ]]; then exit 1 fi -if [[ -n "$ASC_FILE" ]] -then +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 + 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 +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 +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 && \ -popd -if [[ $? -ne 0 ]] -then - echo "Unable to setup permissions for autopsy binaries" >> /dev/stderr +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." -fi \ No newline at end of file +fi diff --git a/installation/scripts/install_prereqs_osx.sh b/installation/scripts/install_prereqs_osx.sh index 4d22218bc3bb45d1c9a38dd1f4e999de78e82db1..9553631fa0d30f8133a3702b64e71f2728b1e457 100644 --- a/installation/scripts/install_prereqs_osx.sh +++ b/installation/scripts/install_prereqs_osx.sh @@ -18,17 +18,6 @@ then exit 1 fi -# put this in bash_profile -# https://stackoverflow.com/questions/22502759/mac-os-x-10-9-setting-permanent-environment-variables -export JAVA_HOME=$(/usr/libexec/java_home -v 1.8) && \ -echo "Java home is now: $JAVA_HOME" && \ -echo 'export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)' | tee ~/.bash_profile ~/.bashrc -if [[ $? -ne 0 ]] -then - echo "Unable to properly set up JAVA_HOME." >> /dev/stderr - exit 1 -fi - OPEN_JDK_LN=/usr/local/opt/openjdk && \ rm $ && \ ln -s $JAVA_HOME $OPEN_JDK_LN diff --git a/installation/scripts/install_prereqs_ubuntu.sh b/installation/scripts/install_prereqs_ubuntu.sh index b798a9737e7f1c1ddb9e73f22033a5d88f8edd65..6ec2e1534ea8d59e937e8fd854fcca38e88a2687 100644 --- a/installation/scripts/install_prereqs_ubuntu.sh +++ b/installation/scripts/install_prereqs_ubuntu.sh @@ -2,12 +2,10 @@ # this script is designed to install necessary dependencies on debian # this script requires elevated privileges - echo "Turning on all repositories for apt..." sudo sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list -if [[ $? -ne 0 ]] -then - echo "Failed to turn on all repositories" >> /dev/stderr +if [[ $? -ne 0 ]]; then + echo "Failed to turn on all repositories" >>/dev/stderr exit 1 fi @@ -19,30 +17,27 @@ echo "Installing all apt dependencies..." # sudo apt -y install autopoint libsqlite3-dev libcppunit-dev # TODO multi user dependencies? -sudo apt update && \ -sudo apt -y install build-essential autoconf libtool git-core automake git zip wget ant \ -# && -# sudo apt -y build-dep imagemagick libmagickcore-dev libde265 libheif && \ -# sudo apt -y install -imagemagick libde265-dev libheif-dev \ -libpq-dev \ -testdisk libafflib-dev libewf-dev libvhdi-dev libvmdk-dev \ -libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \ -gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x \ -gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio +sudo apt update && + sudo apt -y build-dep imagemagick libmagickcore-dev && + sudo apt -y install build-essential autoconf libtool git-core automake git zip wget ant \ + libde265-dev libheif-dev \ + libpq-dev \ + testdisk libafflib-dev libewf-dev libvhdi-dev libvmdk-dev \ + libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \ + gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x \ + gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio -# if [[ $? -ne 0 ]] -# then -# echo "Failed to install necessary dependencies" >> /dev/stderr -# exit 1 -# fi +if [[ $? -ne 0 ]]; then + echo "Failed to install necessary dependencies" >>/dev/stderr + exit 1 +fi # echo "Cloning source for libde265 and libheif..." # pushd /usr/src/ && \ # sudo git clone https://github.com/strukturag/libde265.git && \ # sudo git clone https://github.com/strukturag/libheif.git && \ # popd -# if [[ $? -ne 0 ]] +# if [[ $? -ne 0 ]] # then # popd # echo "Failed to retrieve libde265 and libheif repos" >> /dev/stderr @@ -56,7 +51,7 @@ gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1. # sudo make && \ # sudo make install && \ # popd -# if [[ $? -ne 0 ]] +# if [[ $? -ne 0 ]] # then # popd # echo "Failed to install libde265" >> /dev/stderr @@ -70,47 +65,44 @@ gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1. # sudo make && \ # sudo make install && \ # popd -# if [[ $? -ne 0 ]] +# if [[ $? -ne 0 ]] # then # popd # echo "Failed to install libheif" >> /dev/stderr # exit 1 # fi -# echo "Installing ImageMagick..." -# pushd /usr/src/ && \ -# sudo wget https://www.imagemagick.org/download/ImageMagick.tar.gz && \ -# sudo tar xf ImageMagick.tar.gz && \ -# pushd ImageMagick-7* && \ -# sudo ./configure --with-heic=yes && \ -# sudo make && \ -# sudo make install && \ -# popd && \ -# popd -# if [[ $? -ne 0 ]] -# then -# popd && popd -# echo "Failed to install ImageMagick" >> /dev/stderr -# exit 1 -# fi +echo "Installing ImageMagick..." +pushd /usr/src/ && + sudo wget https://www.imagemagick.org/download/ImageMagick.tar.gz && + sudo tar xf ImageMagick.tar.gz && + pushd ImageMagick-7* && + sudo ./configure --with-heic=yes && + sudo make && + sudo make install && + popd && + popd +if [[ $? -ne 0 ]]; then + popd && popd + echo "Failed to install ImageMagick" >>/dev/stderr + exit 1 +fi -# sudo ldconfig -# if [[ $? -ne 0 ]] -# then -# echo "ldconfig call failed" >> /dev/stderr -# exit 1 -# fi +sudo ldconfig +if [[ $? -ne 0 ]]; then + echo "ldconfig call failed" >>/dev/stderr + exit 1 +fi echo "Installing bellsoft Java 8..." -pushd /usr/src/ && \ -wget -q -O - https://download.bell-sw.com/pki/GPG-KEY-bellsoft | sudo apt-key add - && \ -echo "deb [arch=amd64] https://apt.bell-sw.com/ stable main" | sudo tee /etc/apt/sources.list.d/bellsoft.list && \ -sudo apt update && \ -sudo apt -y install bellsoft-java8-full && \ -popd -if [[ $? -ne 0 ]] -then - echo "Failed to install bellsoft java 8" >> /dev/stderr +pushd /usr/src/ && + wget -q -O - https://download.bell-sw.com/pki/GPG-KEY-bellsoft | sudo apt-key add - && + echo "deb [arch=amd64] https://apt.bell-sw.com/ stable main" | sudo tee /etc/apt/sources.list.d/bellsoft.list && + sudo apt update && + sudo apt -y install bellsoft-java8-full && + popd +if [[ $? -ne 0 ]]; then + echo "Failed to install bellsoft java 8" >>/dev/stderr exit 1 fi @@ -119,11 +111,11 @@ fi # export JAVA_HOME=/usr/lib/jvm/bellsoft-java8-full-amd64 && \ # echo "Java home is now: $JAVA_HOME" && \ # echo 'export JAVA_HOME=/usr/lib/jvm/bellsoft-java8-full-amd64' | tee ~/.profile ~/.bashrc -# if [[ $? -ne 0 ]] +# if [[ $? -ne 0 ]] # then # echo "Failed to set up JAVA_HOME in bash_rc" >> /dev/stderr # exit 1 # fi # echo "Java version is:" -# java -version \ No newline at end of file +# java -version diff --git a/installation/scripts/install_tsk_from_src.sh b/installation/scripts/install_tsk_from_src.sh index 9858396dbc404ad98fdb1de4df1befcc82da2afa..01a8947047d21b518cbd0d8c9032ebb9f92b95dd 100644 --- a/installation/scripts/install_tsk_from_src.sh +++ b/installation/scripts/install_tsk_from_src.sh @@ -3,22 +3,22 @@ # this script does require sudo privileges # called like: build_tsk.sh -r <repo path to be created or existing> -b <tsk branch to checkout> -usage() { - echo "Usage: build_tsk.sh [-r repo_path] [-b tsk_branch]" 1>&2; +usage() { + echo "Usage: install_tsk_from_src [-r repo_path] [-b tsk_branch]" 1>&2 } while getopts "r:b:" o; do case "${o}" in - r) - SLEUTHKIT_SRC_DIR=${OPTARG} - ;; - b) - TSK_BRANCH=${OPTARG} - ;; - *) - usage - exit 1 - ;; + r) + SLEUTHKIT_SRC_DIR=${OPTARG} + ;; + b) + TSK_BRANCH=${OPTARG} + ;; + *) + usage + exit 1 + ;; esac done @@ -27,47 +27,43 @@ if [[ -z "${SLEUTHKIT_SRC_DIR}" ]] || [[ -z "${TSK_BRANCH}" ]]; then exit 1 fi -if [[ ! -d $SLEUTHKIT_SRC_DIR ]] -then +if [[ ! -d $SLEUTHKIT_SRC_DIR ]]; then TSK_REPO_PATH=$(dirname "$SLEUTHKIT_SRC_DIR") echo "Cloning Sleuthkit to $TSK_REPO_PATH..." - mkdir -p $TSK_REPO_PATH && \ - pushd $TSK_REPO_PATH && \ - git clone https://github.com/sleuthkit/sleuthkit.git && \ - popd - if [[ ! -d $SLEUTHKIT_SRC_DIR ]] - then - echo "Unable to successfully clone Sleuthkit" >> /dev/stderr + mkdir -p $TSK_REPO_PATH && + pushd $TSK_REPO_PATH && + git clone https://github.com/sleuthkit/sleuthkit.git && + popd + if [[ ! -d $SLEUTHKIT_SRC_DIR ]]; then + echo "Unable to successfully clone Sleuthkit" >>/dev/stderr exit 1 fi fi echo "Getting latest of Sleuthkit branch: $TSK_BRANCH..." -pushd $SLEUTHKIT_SRC_DIR && \ -git reset --hard && \ -git checkout $TSK_BRANCH && \ -git pull && \ -popd -if [[ $? -ne 0 ]] -then - echo "Unable to reset Sleuthkit repo and pull latest on $TSK_BRANCH" >> /dev/stderr +pushd $SLEUTHKIT_SRC_DIR && + git reset --hard && + git checkout $TSK_BRANCH && + git pull && + popd +if [[ $? -ne 0 ]]; then + echo "Unable to reset Sleuthkit repo and pull latest on $TSK_BRANCH" >>/dev/stderr exit 1 fi echo "Installing Sleuthkit..." -pushd $SLEUTHKIT_SRC_DIR && \ -# export CPPFLAGS="-I/usr/local/opt/libpq/include" && \ -./bootstrap && \ -./configure && \ -make && \ -sudo make install && \ -popd -if [[ $? -ne 0 ]] -then - echo "Unable to build Sleuthkit." >> /dev/stderr +pushd $SLEUTHKIT_SRC_DIR && + # export CPPFLAGS="-I/usr/local/opt/libpq/include" && \ + ./bootstrap && + ./configure && + make && + sudo make install && + popd +if [[ $? -ne 0 ]]; then + echo "Unable to build Sleuthkit." >>/dev/stderr exit 1 fi JAVA_INSTALLS=/usr/local/share/java echo "Sleuthkit in $JAVA_INSTALLS:" -ls $JAVA_INSTALLS | grep sleuthkit \ No newline at end of file +ls $JAVA_INSTALLS | grep sleuthkit diff --git a/unix_setup.sh b/unix_setup.sh index 68de74fb862f06d4626f7e91ea21d77f82fd5522..79d857a1c1f4a296636c8b5b689911fc3d9d6da0 100644 --- a/unix_setup.sh +++ b/unix_setup.sh @@ -25,13 +25,6 @@ while getopts "j:" o; do done - -if [[ -z "${SLEUTHKIT_SRC_DIR}" ]] || [[ -z "${TSK_BRANCH}" ]]; then - usage - exit 1 -fi - - # In the beginning... echo "---------------------------------------------" echo "Checking prerequisites and preparing Autopsy:" @@ -54,7 +47,8 @@ fi echo -n "Checking for Java..." if [ -n "$JAVA_PATH"]; then if [ -x "$JAVA_PATH/bin/java" ]; then - # TODO + sed -Ei '/^#?\s*jdkhome=/d' etc/autopsy.conf + echo "jdkhome=$JAVA_PATH" >> etc/autopsy.conf else echo "ERROR: Java was not found in $JAVA_PATH." exit 1