View | Details | Raw Unified | Return to bug 14969
Collapse All | Expand All

(-)ltsp-update-sshkeys (-7 / +7 lines)
Lines 1-9 Link Here
1
#!/bin/sh
1
#!/bin/sh
2
2
3
test -z "$clients" && clients=$(find /opt/ltsp/. -mindepth 1 -maxdepth 1 -type d 2>/dev/null)
3
test -z "$clients" && clients=$(find /var/lib/ltsp5 -mindepth 1 -maxdepth 1 -type d 2>/dev/null)
4
hostname=$(hostname)
4
hostname=$(hostname)
5
ips=$(ip -o addr show | awk '$3 == "inet" && $4 !~ /^127\./ { print $4 }' | sed -e 's,/[0-9][0-9]*\>,,g')
5
ips=$(ip -o addr show | awk '$3 == "inet" && $4 !~ /^127\./ { print $4 }' | sed -e 's,/[0-9][0-9]*\>,,g')
6
output=$(tempfile)
6
output=$(mktemp -t $(basename $0)-output.XXXXXXXX)
7
enc="dsa rsa"
7
enc="dsa rsa"
8
8
9
names="$hostname $ips"
9
names="$hostname $ips"
Lines 17-24 Link Here
17
17
18
for name in $names; do
18
for name in $names; do
19
    for encryption in $enc; do
19
    for encryption in $enc; do
20
		if [ -f /etc/ssh/ssh_host_${encryption}_key.pub ]; then
20
		if [ -f /etc/openssh/ssh_host_${encryption}_key.pub ]; then
21
			echo $(echo $name $(cat /etc/ssh/ssh_host_${encryption}_key.pub|awk '{split ($0, a, " "); print a[1]" "a[2]" "}')) >> $output
21
			echo $(echo $name $(cat /etc/openssh/ssh_host_${encryption}_key.pub|awk '{split ($0, a, " "); print a[1]" "a[2]" "}')) >> $output
22
			logger -f $logfile -t ltsp "# Creating ${encryption}-hostkey for $name"
22
			logger -f $logfile -t ltsp "# Creating ${encryption}-hostkey for $name"
23
		else
23
		else
24
			logger -f $logfile -t ltsp "No ${encryption} key found for ${name}, please configure your ssh server correctly"
24
			logger -f $logfile -t ltsp "No ${encryption} key found for ${name}, please configure your ssh server correctly"
Lines 31-40 Link Here
31
fi
31
fi
32
32
33
for client in $clients; do
33
for client in $clients; do
34
    if [ -d $client/etc/ssh ]; then
34
    if [ -d $client/etc/openssh ]; then
35
        install -m 644 $output $client/etc/ssh/ssh_known_hosts
35
        install -m 644 $output $client/etc/openssh/ssh_known_hosts
36
    else
36
    else
37
        echo "WARNING: $client/etc/ssh not found. skipping..."
37
        echo "WARNING: $client/etc/openssh not found. skipping..."
38
    fi
38
    fi
39
done
39
done
40
40

Return to bug 14969