40DeleteSSHKeys.in 704 Bytes
Newer Older
1
#! /bin/bash
Nikos Skalkotos's avatar
Nikos Skalkotos committed
2
3
4

### BEGIN TASK INFO
# Provides:		DeleteSSHKeys
Nikos Skalkotos's avatar
Nikos Skalkotos committed
5
# Requires:             MountImage
Nikos Skalkotos's avatar
Nikos Skalkotos committed
6
# Short-Description:	Remove ssh keys if present.
7
### END TASK INFO
Nikos Skalkotos's avatar
Nikos Skalkotos committed
8
9

set -e
10
. "@commondir@/common.sh"
Nikos Skalkotos's avatar
Nikos Skalkotos committed
11

12
13
14
if [ ! -d "$SNF_IMAGE_TARGET" ]; then
    log_error "Target dir: \`$SNF_IMAGE_TARGET' is missing."
fi
Nikos Skalkotos's avatar
Nikos Skalkotos committed
15

16
17
18
19
20
21
if [ "$SNF_IMAGE_TYPE" = "extdump" ]; then
    HOST_KEY="/etc/ssh/ssh_host_key"
    RSA_KEY="/etc/ssh/ssh_host_rsa_key"
    DSA_KEY="/etc/ssh/ssh_host_dsa_key"

    for key in $HOST_KEY $RSA_KEY $DSA_KEY ; do
22
23
        if [ -f "$SNF_IMAGE_TARGET/$key" ] ; then
            rm -f "$SNF_IMAGE_TARGET"/$key*
24
25
        fi
    done
Nikos Skalkotos's avatar
Nikos Skalkotos committed
26
27
28
29
30
31
32
33
fi

cleanup
trap - EXIT

exit 0

# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :