]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mkcephfs: make remote temp directory name unique
authorSage Weil <sage@inktank.com>
Fri, 22 Mar 2013 20:25:23 +0000 (13:25 -0700)
committerSage Weil <sage@inktank.com>
Fri, 22 Mar 2013 20:25:23 +0000 (13:25 -0700)
The predictable file name is a security problem.

CVE-2013-1882

Reported-by: Michael Scherer <misc@zarb.org>
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
src/mkcephfs.in

index 9c01cb0f0a6fcd08bc9629462b134129029cd403..1b532c294e51fd78c7ac2f0dfa0e5147fa3a504b 100644 (file)
@@ -476,7 +476,8 @@ if [ $allhosts -eq 1 ]; then
        check_host || continue
 
        if [ -n "$ssh" ]; then
-           rdir="/tmp/mkfs.ceph.$$"
+           unique=`dd if=/dev/urandom bs=16 count=1 2>/dev/null | md5sum | awk '{print $1}'`
+           rdir="/tmp/mkfs.ceph.$unique"
            echo pushing conf and monmap to $host:$rdir
            do_cmd "mkdir -p $rdir"
            scp -q $dir/conf $host:$rdir