Skip to content

Instantly share code, notes, and snippets.

@bamartin125
Created July 4, 2020 14:57
Show Gist options
  • Save bamartin125/aefbf461768289989400663d4e7f97b4 to your computer and use it in GitHub Desktop.
Save bamartin125/aefbf461768289989400663d4e7f97b4 to your computer and use it in GitHub Desktop.
Martin Continuity Plan Installer
#!/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