Friday, October 2, 2009

More security with ZSH

Don't save commands in history while a secure device is mounted. The mounted device must have .secure file in order to disable history file while the device mounted.

zshaddhistory() {
DIRS=`cat /proc/mounts | rgrep -P '(fuse|ext3|ext2|ext4|fat)' | cut -f2 -d' '`
FLAG=`for dir in ${=DIRS} ; do test -f "$dir/.secure" && echo secure; done`
echo $FLAG | grep secure 2>/dev/null >/dev/null && return -1 || return 0

No comments:

Post a Comment