|
@@ -277,18 +277,6 @@ 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
|
|
-
|
292
|
280
|
if [ ${REMOVE_APP} ]; then
|
293
|
281
|
if [ -d ~/.passwords/${CURR_USERNAME}/${REMOVE_APP} ]; then
|
294
|
282
|
shred -zu ~/.passwords/${CURR_USERNAME}/${REMOVE_APP}
|
|
@@ -301,9 +289,21 @@ if [ ! $CURR_APP ]; then
|
301
|
289
|
exit 3
|
302
|
290
|
fi
|
303
|
291
|
|
|
292
|
+if [[ "$CURR_USERNAME" == "root" ]]; then
|
|
293
|
+ if [ ! -d /root/.passwords/root ]; then
|
|
294
|
+ mkdir -p /root/.passwords/root
|
|
295
|
+ fi
|
|
296
|
+ if [ ! -f /root/.passwords/root/master ]; then
|
|
297
|
+ echo "$(openssl rand -base64 32 | cut -c1-30)" > /root/.passwords/root/master
|
|
298
|
+ chmod 700 /root/.passwords/root/master
|
|
299
|
+ fi
|
|
300
|
+ MASTER_PASSWORD=$(cat /root/.passwords/root/master)
|
|
301
|
+fi
|
|
302
|
+
|
304
|
303
|
if [ ${#CURR_PASSWORD} -eq 0 ]; then
|
305
|
304
|
# retrieve password
|
306
|
305
|
if [ ! -f ~/.passwords/$CURR_USERNAME/$CURR_APP ]; then
|
|
306
|
+ MASTER_PASSWORD=
|
307
|
307
|
echo ""
|
308
|
308
|
exit 4
|
309
|
309
|
else
|
|
@@ -314,6 +314,7 @@ else
|
314
|
314
|
# store password
|
315
|
315
|
if [ -f $NO_PASSWORD_STORE_FILE ]; then
|
316
|
316
|
if [[ "$CURR_USERNAME" != 'root' ]]; then
|
|
317
|
+ MASTER_PASSWORD=
|
317
|
318
|
exit 0
|
318
|
319
|
fi
|
319
|
320
|
fi
|
|
@@ -323,8 +324,10 @@ else
|
323
|
324
|
# padding helps to ensure than nothing can be learned from the length of the cyphertext
|
324
|
325
|
pad_string "${CURR_PASSWORD}" | gpg -ca --cipher-algo AES256 --passphrase "$MASTER_PASSWORD" > ~/.passwords/$CURR_USERNAME/$CURR_APP
|
325
|
326
|
if [ ! -f ~/.passwords/$CURR_USERNAME/$CURR_APP ]; then
|
|
327
|
+ MASTER_PASSWORD=
|
326
|
328
|
exit 5
|
327
|
329
|
fi
|
328
|
330
|
fi
|
329
|
331
|
|
|
332
|
+MASTER_PASSWORD=
|
330
|
333
|
exit 0
|