-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathec2_loghostkey
37 lines (30 loc) · 854 Bytes
/
ec2_loghostkey
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh
# PROVIDE: ec2_loghostkey
# REQUIRE: sshd
# Define ec2_loghostkey_enable in /etc/rc.conf to enable printing of the
# SSH host keys in the EC2 console output format.
#
: ${ec2_loghostkey_enable=NO}
. /etc/rc.subr
name="ec2_loghostkey"
rcvar=ec2_loghostkey_enable
start_cmd="ec2_loghostkey_run"
stop_cmd=":"
ec2_loghostkey_generate()
{
# Print the SSH host keys in EC2-standard format.
echo '#############################################################'
echo '-----BEGIN SSH HOST KEY FINGERPRINTS-----'
for F in /etc/ssh/ssh_host_*key.pub; do
ssh-keygen -l -f $F
done
echo '-----END SSH HOST KEY FINGERPRINTS-----'
echo '#############################################################'
}
ec2_loghostkey_run()
{
# Prefix everything with "ec2:"
ec2_loghostkey_generate | lam -s "ec2: " -
}
load_rc_config $name
run_rc_command "$1"