diff options
author | Darren Tucker <dtucker@zip.com.au> | 2013-11-09 00:19:22 +1100 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2013-11-09 00:19:22 +1100 |
commit | aff7ef1bb8b7c1eeb1f4812129091c5adbf51848 (patch) | |
tree | 96ba9aafa62cd81bf18c108179b8619b6989c98e /contrib/cygwin/ssh-host-config | |
parent | 882abfd3fb3c98cfe70b4fc79224770468b570a5 (diff) |
- (dtucker) [contrib/cygwin/ssh-host-config] Simplify host key generation:
rather than testing and generating each key, call ssh-keygen -A.
Patch from vinschen at redhat.com.
Diffstat (limited to 'contrib/cygwin/ssh-host-config')
-rw-r--r-- | contrib/cygwin/ssh-host-config | 52 |
1 files changed, 2 insertions, 50 deletions
diff --git a/contrib/cygwin/ssh-host-config b/contrib/cygwin/ssh-host-config index c542d5cb6..05efd3b3b 100644 --- a/contrib/cygwin/ssh-host-config +++ b/contrib/cygwin/ssh-host-config | |||
@@ -68,54 +68,6 @@ password_value= | |||
68 | opt_force=no | 68 | opt_force=no |
69 | 69 | ||
70 | # ====================================================================== | 70 | # ====================================================================== |
71 | # Routine: create_host_keys | ||
72 | # ====================================================================== | ||
73 | create_host_keys() { | ||
74 | local ret=0 | ||
75 | |||
76 | if [ ! -f "${SYSCONFDIR}/ssh_host_key" ] | ||
77 | then | ||
78 | csih_inform "Generating ${SYSCONFDIR}/ssh_host_key" | ||
79 | if ! /usr/bin/ssh-keygen -t rsa1 -f ${SYSCONFDIR}/ssh_host_key -N '' > /dev/null | ||
80 | then | ||
81 | csih_warning "Generating ${SYSCONFDIR}/ssh_host_key failed!" | ||
82 | let ++ret | ||
83 | fi | ||
84 | fi | ||
85 | |||
86 | if [ ! -f "${SYSCONFDIR}/ssh_host_rsa_key" ] | ||
87 | then | ||
88 | csih_inform "Generating ${SYSCONFDIR}/ssh_host_rsa_key" | ||
89 | if ! /usr/bin/ssh-keygen -t rsa -f ${SYSCONFDIR}/ssh_host_rsa_key -N '' > /dev/null | ||
90 | then | ||
91 | csih_warning "Generating ${SYSCONFDIR}/ssh_host_key failed!" | ||
92 | let ++ret | ||
93 | fi | ||
94 | fi | ||
95 | |||
96 | if [ ! -f "${SYSCONFDIR}/ssh_host_dsa_key" ] | ||
97 | then | ||
98 | csih_inform "Generating ${SYSCONFDIR}/ssh_host_dsa_key" | ||
99 | if ! /usr/bin/ssh-keygen -t dsa -f ${SYSCONFDIR}/ssh_host_dsa_key -N '' > /dev/null | ||
100 | then | ||
101 | csih_warning "Generating ${SYSCONFDIR}/ssh_host_key failed!" | ||
102 | let ++ret | ||
103 | fi | ||
104 | fi | ||
105 | |||
106 | if [ ! -f "${SYSCONFDIR}/ssh_host_ecdsa_key" ] | ||
107 | then | ||
108 | csih_inform "Generating ${SYSCONFDIR}/ssh_host_ecdsa_key" | ||
109 | if ! /usr/bin/ssh-keygen -t ecdsa -f ${SYSCONFDIR}/ssh_host_ecdsa_key -N '' > /dev/null | ||
110 | then | ||
111 | csih_warning "Generating ${SYSCONFDIR}/ssh_host_key failed!" | ||
112 | let ++ret | ||
113 | fi | ||
114 | fi | ||
115 | return $ret | ||
116 | } # --- End of create_host_keys --- # | ||
117 | |||
118 | # ====================================================================== | ||
119 | # Routine: update_services_file | 71 | # Routine: update_services_file |
120 | # ====================================================================== | 72 | # ====================================================================== |
121 | update_services_file() { | 73 | update_services_file() { |
@@ -719,8 +671,8 @@ then | |||
719 | let ++warning_cnt | 671 | let ++warning_cnt |
720 | fi | 672 | fi |
721 | 673 | ||
722 | # host keys | 674 | # generate missing host keys |
723 | create_host_keys || let warning_cnt+=$? | 675 | /usr/bin/ssh-keygen -A || let warning_cnt+=$? |
724 | 676 | ||
725 | # handle ssh_config | 677 | # handle ssh_config |
726 | csih_install_config "${SYSCONFDIR}/ssh_config" "${SYSCONFDIR}/defaults" || let ++warning_cnt | 678 | csih_install_config "${SYSCONFDIR}/ssh_config" "${SYSCONFDIR}/defaults" || let ++warning_cnt |