|
clsync-0.4.2-alt2.x86_64 |
unsafe-tmp-usage-in-scripts |
info |
The test discovered scripts with errors which may be used by a user for damaging important system files. For example if a script uses in its work a temp file which is created in /tmp directory, then every user can create symlinks with the same name (pattern) in this directory in order to destroy or rewrite some system or another user's files. Scripts _must_ _use_ mktemp/tempfile or must use $TMPDIR. mktemp/tempfile is safest. $TMPDIR is safer than /tmp/ because libpam-tmpdir creates a subdirectory of /tmp that is only accessible by that user, and then sets TMPDIR and other variables to that. Hence, it doesn't matter nearly as much if you create a non-random filename, because nobody but you can access it. Found error in /usr/share/doc/clsync/examples/production/etc/clsync/synchandler/lxc/brother.sh: $ grep -A5 -B5 /tmp/ /usr/share/doc/clsync/examples/production/etc/clsync/synchandler/lxc/brother.sh # if mount | grep "$BROTHERMNT" > /dev/null; then if ping -w 1 -qc 5 -i 0.1 $BROTHERNAME > /dev/null; then #if [ ! -d "$TO" ]; then # mkdir -p "$TO" #fi exec rsync --password-file="/etc/rsyncd.pass" -aH --timeout=3600 --inplace --delete-before $STATICEXCLUDE "$excludefrom" --include-from="${LISTFILE}" --exclude='*' "$FROM"/ "$TO"/ 2>/tmp/clsync-rsync-"$LABEL"-brother.err else sleep $[ 3600 + $RANDOM % 1800 ] exit 128 fi # else Found error in /usr/share/doc/clsync/examples/production/etc/clsync/synchandler/lxc/backup.sh: $ grep -A5 -B5 /tmp/ /usr/share/doc/clsync/examples/production/etc/clsync/synchandler/lxc/backup.sh # if mount | grep "$BACKUPMNT" > /dev/null; then if ping -w 1 -qc 5 -i 0.1 $BACKUPHOST > /dev/null; then #if [ ! -d "$BACKUPDECR" ]; then # mkdir -p "$BACKUPDECR" #fi exec rsync --password-file="/etc/backup.pass" -aH --timeout=3600 --inplace --delete-before $STATICEXCLUDE "$excludefrom" --include-from="${LISTFILE}" --exclude='*' --backup --backup-dir="$BACKUPDECR"/ "$FROM"/ "$BACKUPMIRROR"/ 2>/tmp/clsync-rsync-"$LABEL"-backup.err else sleep $[ 3600 + $RANDOM % 1800 ] return 128 fi # else |