summaryrefslogtreecommitdiff
path: root/bin/usbpubkeys
blob: 4c25e5f3f1d4a08458a961f1af73973a6fb597c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash

# update cache of ssh and https host keys for USB drives

OUTPUT=$HOME/lib/annex/big/skel/usb/lib/host_keys.txt
OUTPUT_OPENSSH=$HOME/lib/annex/big/skel/usb/lib/known_hosts

(
    echo -n "Generated by ~/bin/usbpubkeys "
    date
    echo
    echo -n "ma.sdf.org's SSH key fingerprint:          "
    # assume that we've already got it in known_hosts locally
    ssh -o ControlMaster=no -o ControlPath=/dev/null -v ma /bin/true 2>&1 \
        | grep "Server host key:" | cut -d' ' -f 5-6
    # don't assume our connection is safe; ssh to ma first
    echo -n "ma.sdf.org's web SSL key SHA1 fingerprint: "
    echo -n | ssh ma openssl s_client -connect ma:443 2>/dev/null | \
        openssl x509  -noout -fingerprint | cut -f2 -d'='
        
) > $OUTPUT
unix2dos $OUTPUT

ssh-keyscan -t rsa ma.sdf.org > $OUTPUT_OPENSSH