mirror of https://github.com/MISP/MISP
chg: [tools] Updated misp-backup and misp-wipe to be a bit more late 2018 compliant
parent
f67d4350de
commit
363d00db7a
|
@ -18,7 +18,7 @@ Running
|
|||
|
||||
run the script:
|
||||
````
|
||||
sh misp-backup.sh
|
||||
sudo sh misp-backup.sh
|
||||
````
|
||||
|
||||
Open
|
||||
|
@ -65,6 +65,8 @@ Description
|
|||
Run the script
|
||||
==============
|
||||
|
||||
/!\ This has not been tested on the latest MISP version (2.4.96) - Thread carefully and pack your Banana picker(tm).
|
||||
|
||||
```
|
||||
run ./misp-restore.sh PATH_TO_ARCHIVE.tar.gz
|
||||
sudo sh ./misp-restore.sh PATH_TO_ARCHIVE.tar.gz
|
||||
```
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
## built system. This is not intended as an upgrade script
|
||||
## to move between MISP versions - But it might work ;).
|
||||
##
|
||||
## Tested against MISP 2.4.33
|
||||
## Tested against MISP 2.4.96
|
||||
##
|
||||
## Run the script as the standard user with the command below
|
||||
##
|
||||
|
@ -58,6 +58,7 @@ MISPPath=${MISPPath:-$(locate MISP/app/webroot/index.php|sed 's/\/app\/webroot\/
|
|||
# Output
|
||||
OutputFileName=${OutputFileName:-MISP-Backup}
|
||||
OutputDirName=${OutputDirName:-/tmp}
|
||||
OutputFull="${OutputDirName}/${OutputFileName}-$(date '+%Y%m%d_%H%M%S').tar.gz"
|
||||
# database.php
|
||||
MySQLUUser=$(grep -o -P "(?<='login' => ').*(?=')" $MISPPath/app/Config/database.php)
|
||||
MySQLUPass=$(grep -o -P "(?<='password' => ').*(?=')" $MISPPath/app/Config/database.php)
|
||||
|
@ -75,7 +76,7 @@ GnuPGHomeDir=$(grep -o -P "(?<='homedir' => ').*(?=')" $MISPPath/app/Config/conf
|
|||
GnuPGPass=$(grep -o -P "(?<='password' => ').*(?=')" $MISPPath/app/Config/config.php)
|
||||
# Create backup files
|
||||
TmpDir="$(mktemp --tmpdir=$OutputDirName -d)"
|
||||
cp $GnuPGHomeDir/* $TmpDir/
|
||||
cp -r $GnuPGHomeDir/* $TmpDir/
|
||||
echo "copy of org images and other custom images"
|
||||
cp -r $MISPPath/app/webroot/img/orgs $TmpDir/
|
||||
cp -r $MISPPath/app/webroot/img/custom $TmpDir/
|
||||
|
@ -93,7 +94,9 @@ MySQLRPass=${MySQLRPass:-$MySQLUPass}
|
|||
mysqldump --opt -u $MySQLRUser -p$MySQLRPass $MISPDB > $TmpDir/MISPbackupfile.sql
|
||||
# Create compressed archive
|
||||
cd $TmpDir
|
||||
tar -zcf $OutputDirName/$OutputFileName-$(date "+%Y%m%d_%H%M%S").tar.gz *
|
||||
tar -zcf $OutputFull *
|
||||
cd -
|
||||
rm -rf $TmpDir
|
||||
echo 'MISP Backup Complete!!!'
|
||||
echo "MISP Backup Completed, OutputDir: ${OutputDirName}"
|
||||
echo "FileName: ${OutputFileName}-$(date '+%Y%m%d_%H%M%S').tar.gz"
|
||||
echo "FullName: ${OutputFull}"
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
# - SSL certificates used by the web server
|
||||
#
|
||||
#
|
||||
# run ./misp-restore.sh PATH_TO_ARCHIVE.tar.gz
|
||||
# sudo sh ./misp-restore.sh PATH_TO_ARCHIVE.tar.gz
|
||||
#
|
||||
echo '-- Starting MISP restore process'
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#@IgnoreInspection BashAddShebang
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
##
|
||||
## script to wipe MISP on debian/ubuntu
|
||||
##
|
||||
|
@ -11,21 +11,24 @@
|
|||
##
|
||||
## This script can be used to reset a MISP instance
|
||||
## by clearing all events, orgs and users.
|
||||
## It is highy recommended ## to run misp-backup.sh first!
|
||||
## It is highy recommended to run misp-backup.sh first!
|
||||
##
|
||||
## Tested against MISP 2.4.55
|
||||
## Tested against MISP 2.4.96
|
||||
##
|
||||
## Run the script as the standard user with the command below
|
||||
##
|
||||
## cp misp-wipe.conf.sample misp-wipe.conf
|
||||
## vi misp-wipe.conf # adjust values
|
||||
## sudo sh -x misp-wipe.sh 2>&1 | tee misp-wipe.log
|
||||
## sudo bash -x misp-wipe.sh 2>&1 | tee misp-wipe.log
|
||||
##
|
||||
## /!\ This might fail or create a random '0' file if using ZSH... (Oh-My...Berk)
|
||||
##
|
||||
## Time to set some variables
|
||||
##
|
||||
|
||||
if (( $EUID > 0 ))
|
||||
then
|
||||
LUSER_ID="$(id -u)"
|
||||
|
||||
if [[ "${LUSER_ID}" > "0" ]]; then
|
||||
echo "Please run this as a privileged user"
|
||||
echo "(usually 'sudo !!' will cover you)"
|
||||
exit
|
||||
|
|
Loading…
Reference in New Issue