ecd139ea00d2aa58b1e25c838dcd16733d8caf8e
6 ## The key types are adorned with bit lengths. Work out the raw key type
9 for kt
in $keytypes; do
10 rawkeytypes
="$rawkeytypes ${kt%:*}"
13 ## Start a new output directory.
16 exec 3<etc
/hosts
4>publish.new
/hosts.list
17 echo ":certificate-authority" >&4
18 for kt
in $rawkeytypes; do
19 cp ca
/ca-
$kt.pub publish.new
/
20 read pub
<ca
/ca-
$kt.pub
21 echo "@cert-authority $scope $pub" |
22 tee publish.new
/ca-
$kt.entry
>&4
23 ssh-keygen
-lv
-fca
/ca-
$kt.pub |
sed 's,^,| ,' >&4
26 ## Sign the various host keys.
28 while read line
<&3; do
30 ## Ignore comments and empty lines.
32 "#"* |
"") continue ;;
37 ## Read the host line.
43 ## If this is a different host, then start a new section of the list.
46 *) { echo; echo ":host $host"; } >&4 ;;
50 ## Build a list of names for the host.
53 .
*) for h
in $nicks; do names
=${names:+$names,}$h$n.
$domain; done ;;
54 *.
* |
*:*) names
=${names:+$names,}$n ;;
55 *) nicks
=${nicks:+$nicks }$n names
=${names:+$names,}$n.
$domain ;;
60 for kt
in $rawkeytypes; do
61 if [ ! -f
host/$host-$kt.pub
]; then continue; fi
62 cp host/$host-$kt.pub publish.new
/
63 ssh-keygen
-q
-tv00
-sca
/ca-
$kt \
64 -h
-I
"$cacomment:$host.$domain" -n
$names \
66 publish.new
/$host-$kt.pub
67 mv publish.new
/$host-$kt-cert.pub \
68 publish.new
/$host-$kt.cert
69 { printf "%s " $names; cat host/$host-$kt.pub
; } >&4
70 ssh-keygen
-lv
-fhost
/$host-$kt.pub |
sed 's,^,| ,' >&4
76 run_gpg
--armor
-o publish.new
/hosts.asc \
77 --clearsign publish.new
/hosts.list
78 rm publish.new
/hosts.list
80 ## Include a copy of the public key.
81 run_gpg
--export --armor
-o publish.new
/ca-gnupg.asc
84 if [ -d publish
]; then
86 mv publish publish.old
88 mv publish.new publish