summaryrefslogtreecommitdiff
path: root/src/endofossil
diff options
context:
space:
mode:
Diffstat (limited to 'src/endofossil')
-rw-r--r--src/endofossil29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/endofossil b/src/endofossil
new file mode 100644
index 0000000..401806f
--- /dev/null
+++ b/src/endofossil
@@ -0,0 +1,29 @@
1#!/bin/bash
2set -e
3
4
5IFS=/ read n pid uid <<< "$1"
6[ "$pid" ]
7
8authtype=
9while read -d ''
10do
11 case "${REPLY%%=*}" in
12 'SSH_USER_AUTH' ) read authtype keytype keyvalue < "${REPLY#*=}" ;;
13 esac
14done < /proc/$pid/environ
15[ "$authtype" = publickey ]
16
17keyhash=
18while read
19do
20 set -- $REPLY
21 if [ "$3 $5" = 'SSHFP 2' ]
22 then
23 keyhash=$6
24 break
25 fi
26done < <(ssh-keygen -f <(printf '%s\n' "$keytype $keyvalue") -r .)
27[ "$keyhash" ]
28
29printf '%s\n' "$keyhash"