Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- [ -z "$1" ] && echo -e "USAGE:\n\t-e\n\t-c" && exit 0
- if [ "$(id -u)" != "1000" ]; then
- echo "This script must be run as user"
- exit 1
- fi
- secret="$HOME/.secret_vault"
- secret_p="$HOME/.secret_passphrase"
- if [ "$1" == "-e" ]; then
- touch $secret
- #touch $secret_p
- echo "Enter password:"
- read -r -s pw
- echo "Enter passphrase:"
- read -r -s pp
- echo "$pw" | openssl enc -aes-256-cbc -md sha512 -a -pbkdf2 -iter 100000 -salt -pass pass:"$pp" > "$secret"
- chmod 600 $secret
- echo "$pp" > $secret_p
- chmod 600 $secret_p
- exit
- fi
- if [ "$1" == "-c" ]; then
- #echo "Enter passphrase:"
- #read -r -s passphrase
- cat "$secret" | openssl enc -aes-256-cbc -md sha512 -a -d -pbkdf2 -iter 100000 -salt -pass pass:`cat "$secret_p"`
- fi
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement