Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/hashbang.sh: Support absent private keys #175

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/hashbang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,13 @@ echo " yourself to systems like this one without ever sending your password ";
echo " over the internet, and thus by nature we won't even know what it is";

for keytype in id_ed25519 id_ecdsa id_rsa id_dsa; do
if [ -e ~/.ssh/${keytype}.pub ] && [ -e ~/.ssh/${keytype} ]; then
if [ -e ~/.ssh/${keytype}.pub ]; then
if ask " We found a public key in [ ~/.ssh/${keytype}.pub ]. Use this key?" Y; then
private_keyfile="${HOME}/.ssh/${keytype}"
public_key="$(cat ~/.ssh/${keytype}.pub)"
break
if [ -e ~/.ssh/${keytype} ] || ask " Are you sure? There is no corresponding private key file." N; then
private_keyfile="${HOME}/.ssh/${keytype}"
public_key="$(cat ~/.ssh/${keytype}.pub)"
break
fi
fi
fi
done
Expand Down
36 changes: 19 additions & 17 deletions static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,13 @@ <h1>#!</h1>
echo " over the internet, and thus by nature we won't even know what it is";

for keytype in id_ed25519 id_ecdsa id_rsa id_dsa; do
if [ -e ~/.ssh/${keytype}.pub ] && [ -e ~/.ssh/${keytype} ]; then
if [ -e ~/.ssh/${keytype}.pub ]; then
if ask " We found a public key in [ ~/.ssh/${keytype}.pub ]. Use this key?" Y; then
private_keyfile="${HOME}/.ssh/${keytype}"
public_key="$(cat ~/.ssh/${keytype}.pub)"
break
if [ -e ~/.ssh/${keytype} ] || ask " Are you sure? There is no corresponding private key file." N; then
private_keyfile="${HOME}/.ssh/${keytype}"
public_key="$(cat ~/.ssh/${keytype}.pub)"
break
fi
fi
fi
done
Expand Down Expand Up @@ -478,17 +480,17 @@ <h1>#!</h1>
exit 0
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEERWK8VmkyzxwW8tfM0sTHTY+qlvUFAmRYcDUACgkQ0sTHTY+q
lvXGIA/+LkArFpMDqdSu5vjhi+LJDYcSxQBZvBQPJDWD82MsL8DYWW7h1rSCgGnR
3rD4tCoE3vLuq2L8xJlrlXSF7Try1d3vjpUm7PY2mAQRs1kblXIOTczbAy8xvu94
CFMI9BnKRXqhxzOtiUqUqhfJKJt5WfIiob5uG3mqZXll6+OmKMdbrCLwnaUXIo1B
xYyivTUVjH8JpHfXcsx7iQqsCC9SA6HABGD8TIE4by4S3MMMWSfs0qhPpwkXSqqu
Zwjn9KVLpztEBOx1dzMAV5sE/SuYOS3xyTddlCmGsIz3rG7bCpwHTywgdKZInMJ+
PnXv+lMqHDFNFXl0o/AjSg7/pWjXrXm0s6IeOHWrZ+yqijMkCs0908xfJcNHcGo5
g2Sb980ZiOwQ+XLTHnkebJhaFYlt1ejIxXLCr1c40ouHunRmhB6b+MRFy9SHHsye
358Zpio7wT57cfflP3z7JjEmXA0fSZkoz0qpwo5Vs9M1nqTBVDW/Udy/tz9OnASb
e4SuJo8OrFpFYX3R2QHxi7o8lxmCBuickwiIy5STEWV+C0DeJCgD1AA7klih0RgT
UkqgnfbqyzMKqDwUzQZc6H9BavR+KpPUvehFaHH0AKGXgC0zOM5hOrlf2mgdoc10
stRKC0b6uzW2zkAYSPwLPwqGV39w+YOnIxAWbHhJ1Pn1KuIwaRI=
=cwVT
iQIzBAEBCgAdFiEERWK8VmkyzxwW8tfM0sTHTY+qlvUFAmRYdwkACgkQ0sTHTY+q
lvVswQ//eR6Eh1rFLthPrtLK8lceHlT9dlzuAYq42WE6/QMbfbDRIZ3tmk192Mpu
oCmlQBzpzEb8Y1ROJK2B13r28RqQm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