Commit 8f4a8b7a authored by rohieb's avatar rohieb
Browse files

genauth.sh: don't overwrite authorized_keys on failure

This leads to inconsistent data.
parent e81300d1
#!/bin/bash
/home/pi/stratumkey/genauth_keys.py > /home/stratumkey/.ssh/authorized_keys
set -e
tmpfile="$(mktemp /tmp/stratumkey-genauth.XXXX)"
if ! /home/pi/stratumkey/genauth_keys.py > $tmpfile; then
exit 127
fi
cat -- "$tmpfile" > /home/stratumkey/.ssh/authorized_keys
wc -l /home/stratumkey/.ssh/authorized_keys
FILES=/home/pi/stratumkey/keys/*.pub
for file in $FILES
......@@ -8,3 +17,4 @@ do
sed 's/.pub//' <<< $(basename $file) > "/home/pi/stratumkey/keys/names/$(ssh-keygen -lf ${file} | awk '{ print $2 }')"
done
rm -- $tmpfile
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment