Created
July 4, 2020 14:57
-
-
Save bamartin125/aefbf461768289989400663d4e7f97b4 to your computer and use it in GitHub Desktop.
Martin Continuity Plan Installer
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/bash | |
if [ "$EUID" -ne 0 ] | |
then echo "Please run as root (or use sudo)" | |
exit | |
fi | |
echo "installing..." | |
echo "/usr/local/etc/ssss.conf" | |
cat << EOF > /usr/local/etc/ssss.conf | |
level=512 | |
threshold=4 | |
shares=10 | |
EOF | |
echo "/usr/local/bin/splitpass" | |
cat << EOF > /usr/local/bin/splitpass | |
#!/bin/bash | |
export TMPDIR=/dev/shm | |
source /usr/local/etc/ssss.conf | |
ssss-split -q -s \$level -t \$threshold -n \$shares -w martin | awk -v dir="\$TMPDIR" '{a=\$0; NF-=1; n=\$0; print a > dir"/"n".shard"}' FS='-' OFS='-' | |
EOF | |
chmod +x "/usr/local/bin/splitpass" | |
echo "/usr/local/bin/combinepass-test" | |
cat << EOF > /usr/local/bin/combinepass-test | |
#!/bin/bash | |
export TMPDIR=/dev/shm | |
source /usr/local/etc/ssss.conf | |
cat \$TMPDIR/*.shard | ssss-combine -q -t \$threshold | |
EOF | |
chmod +x "/usr/local/bin/combinepass-test" | |
echo "/usr/local/bin/combinepass" | |
cat << EOF > /usr/local/bin/combinepass | |
#!/bin/bash | |
export TMPDIR=/dev/shm | |
source /usr/local/etc/ssss.conf | |
ssss-combine -t \$threshold | |
EOF | |
chmod +x "/usr/local/bin/combinepass" | |
echo "/usr/local/bin/printshards" | |
cat << EOF > /usr/local/bin/printshards | |
#!/bin/bash | |
export TMPDIR=/dev/shm | |
source /usr/local/etc/ssss.conf | |
for f in \$TMPDIR/*.shard; do | |
echo "printing \$f" | |
lp "\$f" | |
done | |
EOF | |
chmod +x "/usr/local/bin/printshards" | |
echo "done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment