Created
March 7, 2020 12:47
-
-
Save zozs/4a4ef1fc4b7e027f89daa8168c838de6 to your computer and use it in GitHub Desktop.
Simplest credential manager you can think of :)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
# path of fifo, must be unique for this instance. | |
# so if you want several daemons running you need to fix this. | |
FIFO_PATH=/tmp/credmanager.sock | |
# read passphrase from user and store in var | |
echo -n "Enter passphrase: " | |
read -r passphrase | |
echo "Passphrase stored. Daemon ready." | |
# repeat passphrase infinity times to named pipe | |
while true; do | |
# create fifo | |
rm -f "${FIFO_PATH}" | |
mkfifo -m 600 "${FIFO_PATH}" | |
# actually write passphrase to pipe | |
echo "${passphrase}" > "${FIFO_PATH}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment