浏览代码

Create a master password for root

Bob Mottram 8 年前
父节点
当前提交
4f752ec349
共有 1 个文件被更改,包括 12 次插入0 次删除
  1. 12
    0
      src/freedombone-pass

+ 12
- 0
src/freedombone-pass 查看文件

277
     fi
277
     fi
278
 fi
278
 fi
279
 
279
 
280
+if [[ "$CURR_USERNAME" == "root" ]]; then
281
+    if [ ! -d /root/.passwords/root ]; then
282
+        mkdir -p /root/.passwords/root
283
+    fi
284
+    if [ ! -f /root/.passwords/root/master ]; then
285
+        MASTER_PASSWORD=$(openssl rand -base64 32 | cut -c1-30)
286
+        echo "$MASTER_PASSWORD" > /root/.passwords/root/master
287
+        chmod 700 /root/.passwords/root/master
288
+    fi
289
+    MASTER_PASSWORD=$(cat /root/.passwords/root/master)
290
+fi
291
+
280
 if [ ${REMOVE_APP} ]; then
292
 if [ ${REMOVE_APP} ]; then
281
     if [ -d ~/.passwords/${CURR_USERNAME}/${REMOVE_APP} ]; then
293
     if [ -d ~/.passwords/${CURR_USERNAME}/${REMOVE_APP} ]; then
282
         shred -zu ~/.passwords/${CURR_USERNAME}/${REMOVE_APP}
294
         shred -zu ~/.passwords/${CURR_USERNAME}/${REMOVE_APP}