| 123456789101112131415161718192021222324252627282930 |
- #!/bin/bash
- # Licence : GPL v3
- # Author: Laurent HUBERT
- #
- # Renews the ssh server keys if they exist
- #
- cat <<EOF
- ##################################
- # Renewing SSH server keys #
- ##################################
- EOF
- status=0
- renew_ssh_keys(){
- rm /etc/ssh/ssh_host_*key*
- dpkg-reconfigure openssh-server
- status=$?
- }
- ls /etc/ssh/ssh_host_*key* > /dev/null 2>&1 && renew_ssh_keys || status=1
- if [ 0 -ne "$status" ]
- then
- # Exit with non zero status
- echo "Error renewing SSH keys"
- exit 1
- else
- cat <<-EOF
- # Renewing SSH server keys: OK #
- ##################################
- EOF
- fi
|