瀏覽代碼

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,6 +277,18 @@ if [ ! -d /home/$CURR_USERNAME ]; then
277 277
     fi
278 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 292
 if [ ${REMOVE_APP} ]; then
281 293
     if [ -d ~/.passwords/${CURR_USERNAME}/${REMOVE_APP} ]; then
282 294
         shred -zu ~/.passwords/${CURR_USERNAME}/${REMOVE_APP}