WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Suggestion for potential improvemnt to encypted backup in filetool.sh  (Read 1998 times)

Offline redwolf

  • Newbie
  • *
  • Posts: 20
This suggestion may prove to be controversial, but I think it may be an improvement, so I thought I'd throw it out there.

"By default, bcrypt will compress input files before encryption, remove input files after they are processed (assuming they are processed successfully) and overwrite input files with random data to prevent data recovery."

"The default number of overwrites is 3."

However...there seems to be pretty strong evidence that 1 overwrite is enough, even when using MFM technology...and that the multiple pass idea arose out of misreadings of the 1996 Secure Deletion of Data from Magnetic and Solid-State Memory published paper by Peter Gutmann. 

If 1 overwrite is enough, surely that would result in a faster backup than 3 overwrites...even if only slightly so.  It would also mean less wear on flash drives due to fewer writes with every backup.

This would be as simple as adding -s1 option to the bcrypt command in filetool.sh.

Code: [Select]
blowfish_encrypt(){
KEY=$(cat /etc/sysconfig/bfe)
cat << EOD | sudo /usr/bin/bcrypt -c -s1 "$MOUNTPOINT"/"$FULLPATH"/$1 2>/dev/null
"$KEY"
"$KEY"
EOD
if [ "$?" != 0 ]; then failed; fi
sync
}

References
http://bcrypt.sourceforge.net/ (This is dated 2002)
http://computer-forensics.sans.org/blog/2009/01/15/overwriting-hard-drive-data/ (This is dated 2009)


Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Suggestion for potential improvemnt to encypted backup in filetool.sh
« Reply #1 on: February 19, 2012, 04:55:11 PM »
Filetool.sh should not be overwriting input files, as there is no requirement for an immediate shutdown.
Furthermore, the input files are RAM based anyway.

Offline redwolf

  • Newbie
  • *
  • Posts: 20
Re: Suggestion for potential improvemnt to encypted backup in filetool.sh
« Reply #2 on: February 19, 2012, 05:39:56 PM »
I'm not sure I understand your first point.  I was just quoting the bcrypt documentation re: the default behavior of bcrypt (which is the command filetool.sh uses to encrypt backups).  Without the -r flag (or -o, which implies -r), it removes the input file and overwrites it 3 times. 

Regarding your second point, when I look at the following excerpt from filetool.sh, it looks like the input file to bcrypt is the previously created mydata.tgz file existing in my TCE dir...on disk.  Am I just overlooking something here?

Code: [Select]
  if [ "$PROMPT" ]; then
    sudo tar -C / -T /opt/.filetool.lst -X /opt/.xfiletool.lst  -czvf $MOUNTPOINT/"$FULLPATH"/${MYDATA}.tgz
    echo -n "Press enter to continue:" ; read ans
  else
    echo -n "${BLUE}Backing up files to ${GREEN}$MOUNTPOINT/$FULLPATH/${MYDATA}.tgz ${NORMAL}"
    [ -f /tmp/backup_status ] && sudo rm -f /tmp/backup_status
    sudo tar -C / -T /opt/.filetool.lst -X /opt/.xfiletool.lst  -czf "$MOUNTPOINT/"$FULLPATH"/${MYDATA}.tgz"  2>/tmp/backup_status &
    rotdash $!
    sync
    [ -s /tmp/backup_status ] && sed -i '/socket ignored/d' /tmp/backup_status 2>/dev/null
    [ -s /tmp/backup_status ] && exit 1
    touch /tmp/backup_done
  fi
  if [ -f /etc/sysconfig/bfe ]; then
     echo -n "encrypting .. "
     blowfish_encrypt ${MYDATA}.tgz
  fi
  echo "${GREEN}Done.${NORMAL}"
  clean_up 0
fi

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Suggestion for potential improvemnt to encypted backup in filetool.sh
« Reply #3 on: February 19, 2012, 05:49:45 PM »
Ok, I see your point, I was thinking pipes.