summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-03-22 13:25:23 -0700
committerSage Weil <sage@inktank.com>2013-03-22 17:46:04 -0700
commitdd670afccfd3ae58c03ea3b4c213dd8db22f618e (patch)
treefbfbe6dead0841c13680c750c738ed443096dedd
parent1cd51eb63a91fa0aa395c41572cfee4d53fbc7f5 (diff)
downloadceph-dd670afccfd3ae58c03ea3b4c213dd8db22f618e.tar.gz
mkcephfs: make remote temp directory name unique
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> (cherry picked from commit f463ef78d77b11b5ad78b31e9a3a88d0a6e62bca)
-rw-r--r--src/mkcephfs.in3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mkcephfs.in b/src/mkcephfs.in
index 446d56872e8..93a5fa6c1c1 100644
--- a/src/mkcephfs.in
+++ b/src/mkcephfs.in
@@ -475,7 +475,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