summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2022-05-23 21:20:35 +0200
committerErich Eckner <git@eckner.net>2022-05-23 21:20:35 +0200
commit4b62e4583dfaa8410da7060bc7fc1ea2139da06f (patch)
treebc0b154046fa14ff3fc941df35a456da26d36c3a
parentbfd7c018ea0da172a429fa05f4febef61982716c (diff)
downloadssh-keystore-4b62e4583dfaa8410da7060bc7fc1ea2139da06f.tar.xz
scripts/check-keys: new
-rwxr-xr-xscripts/check-keys17
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/check-keys b/scripts/check-keys
new file mode 100755
index 0000000..ecdbfe6
--- /dev/null
+++ b/scripts/check-keys
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+cd "${0%/*}/.."
+
+host=$(uname -n)
+if [ ! -d "hosts/${host}" ]; then
+ >&2 printf 'no keys for host %s\n' "${host}"
+ exit 1
+fi
+
+user=$(whoami)
+if [ ! -f "hosts/${host}/${user}" ]; then
+ >&2 printf 'no keys for user %s on host %s\n' "${user}" "${host}"
+ exit 1
+fi
+
+diff -u --color "hosts/${host}/${user}" ~/.ssh/authorized_keys