X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org MIME-Version: 1.0 Date: Mon, 7 Dec 2009 14:27:38 -0700 Message-ID: Subject: ssh-host-config Vista and --yes do not run unattended From: Ben Smith To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com I've been working on an unattended cygwin/sshd install.=A0 On Vista, the ssh-host-config script waits for user input at several points when the "--yes" option is used.=A0 The "--yes" option is usually there to allow for unattended use of a script, and this behavior breaks the ability to use the script unattended. I've fixed this by modifying openssh-5.1p1-10 and csih-0.2.0-1. To reproduce: 1) Install cygwin with the openssh package on Vista. 2) Run ssh-host-config --yes. Result: ssh-host-config stops and waits for user input. The first problem happens in cygwin-service-installation- helper.sh.=A0 The script asks a question about creating a special user "cyg_server" for running sshd under.=A0 The question is worded so that "no" is the default answer.=A0 This means that if you run ssh-host-config with "--yes" on Vista, the question is answered "yes" and the script pauses, waiting for input. Other problems arise because mv commands stop and ask the user for permission to overwrite files. I am attaching patches against ssh-host-config and cygwin-service-installation-helper.sh.=A0 With these changes, ssh-host-config can be run unattended on Vista. I hardcoded a password into ssh-host-config because the -w option to ssh-host-config doesn't seem to create the same kind of user.=A0 It would probably be better to modify ssh-host-config so that the -w option works with the Vista user creation. --Ben Smith *** new/ssh-host-config=A0=A0=A0 2009-12-07 13:54:26.000000000 -0700 --- usr/bin/ssh-host-config=A0=A0=A0 2008-11-20 11:18:43.000000000 -0700 *************** *** 26,32 **** =A0 privsep_configured=3Dno =A0 privsep_used=3Dyes =A0 cygwin_value=3D"ntsec" ! password_value=3D"asecretpassword" =A0 # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =A0 # Routine: create_host_keys --- 26,32 ---- =A0 privsep_configured=3Dno =A0 privsep_used=3Dyes =A0 cygwin_value=3D"ntsec" ! password_value=3D =A0 # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =A0 # Routine: create_host_keys *************** *** 87,93 **** =A0=A0=A0=A0=A0 grep -v 'sshd[ \t][ \t]*22' "${_services}" > "${_serv_tmp}" =A0=A0=A0=A0=A0 if [ -f "${_serv_tmp}" ] =A0=A0=A0=A0=A0 then !=A0=A0=A0=A0=A0=A0 if mv -f "${_serv_tmp}" "${_services}" =A0=A0=A0=A0=A0=A0=A0 then =A0=A0=A0=A0=A0=A0=A0=A0=A0 csih_inform "Removing sshd from ${_wservices}" =A0=A0=A0=A0=A0=A0=A0 else --- 87,93 ---- =A0=A0=A0=A0=A0 grep -v 'sshd[ \t][ \t]*22' "${_services}" > "${_serv_tmp}" =A0=A0=A0=A0=A0 if [ -f "${_serv_tmp}" ] =A0=A0=A0=A0=A0 then !=A0=A0=A0=A0=A0=A0 if mv "${_serv_tmp}" "${_services}" =A0=A0=A0=A0=A0=A0=A0 then =A0=A0=A0=A0=A0=A0=A0=A0=A0 csih_inform "Removing sshd from ${_wservices}" =A0=A0=A0=A0=A0=A0=A0 else *************** *** 104,110 **** =A0=A0=A0 then =A0=A0=A0=A0=A0 if awk '{ if ( $2 ~ /^23\/tcp/ ) print "ssh 22/tcp'"${_spaces}"'SSH Remote Login Protocol\nssh 22/udp'"${_spaces}"'SSH Remote Login Protocol"; print $0; }' < "${_services}" > "${_serv_tmp}" =A0=A0=A0=A0=A0 then !=A0=A0=A0=A0=A0=A0 if mv -f "${_serv_tmp}" "${_services}" =A0=A0=A0=A0=A0=A0=A0 then =A0=A0=A0=A0=A0=A0=A0=A0=A0 csih_inform "Added ssh to ${_wservices}" =A0=A0=A0=A0=A0=A0=A0 else --- 104,110 ---- =A0=A0=A0 then =A0=A0=A0=A0=A0 if awk '{ if ( $2 ~ /^23\/tcp/ ) print "ssh 22/tcp'"${_spaces}"'SSH Remote Login Protocol\nssh 22/udp'"${_spaces}"'SSH Remote Login Protocol"; print $0; }' < "${_services}" > "${_serv_tmp}" =A0=A0=A0=A0=A0 then !=A0=A0=A0=A0=A0=A0 if mv "${_serv_tmp}" "${_services}" =A0=A0=A0=A0=A0=A0=A0 then =A0=A0=A0=A0=A0=A0=A0=A0=A0 csih_inform "Added ssh to ${_wservices}" =A0=A0=A0=A0=A0=A0=A0 else *************** *** 163,169 **** =A0=A0=A0 =A0=A0=A0 =A0 s/^#StrictModes yes/StrictModes no/" \ =A0=A0=A0=A0=A0=A0=A0=A0=A0 < ${SYSCONFDIR}/sshd_config \ =A0=A0=A0=A0=A0=A0=A0=A0=A0 > "${sshdconfig_tmp}" !=A0=A0=A0=A0 mv -f "${sshdconfig_tmp}" ${SYSCONFDIR}/sshd_config =A0=A0=A0 elif [ "${privsep_configured}" !=3D "yes" ] =A0=A0=A0 then =A0=A0=A0=A0=A0 echo >> ${SYSCONFDIR}/sshd_config --- 163,169 ---- =A0=A0=A0 =A0=A0=A0 =A0 s/^#StrictModes yes/StrictModes no/" \ =A0=A0=A0=A0=A0=A0=A0=A0=A0 < ${SYSCONFDIR}/sshd_config \ =A0=A0=A0=A0=A0=A0=A0=A0=A0 > "${sshdconfig_tmp}" !=A0=A0=A0=A0 mv "${sshdconfig_tmp}" ${SYSCONFDIR}/sshd_config =A0=A0=A0 elif [ "${privsep_configured}" !=3D "yes" ] =A0=A0=A0 then =A0=A0=A0=A0=A0 echo >> ${SYSCONFDIR}/sshd_config *************** *** 196,202 **** =A0=A0=A0=A0=A0=A0=A0=A0=A0 grep -v '^[# \t]*ssh' "${_inetcnf}" >> "${_inet= cnf_tmp}" =A0=A0=A0=A0=A0=A0=A0=A0=A0 if [ -f "${_inetcnf_tmp}" ] =A0=A0=A0=A0=A0=A0=A0=A0=A0 then !=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if mv -f "${_inetcnf_tmp}" "${_inetcnf}" =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 then =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 csih_inform "Removed ssh[d] from ${_inetcnf}" =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 else --- 196,202 ---- =A0=A0=A0=A0=A0=A0=A0=A0=A0 grep -v '^[# \t]*ssh' "${_inetcnf}" >> "${_inet= cnf_tmp}" =A0=A0=A0=A0=A0=A0=A0=A0=A0 if [ -f "${_inetcnf_tmp}" ] =A0=A0=A0=A0=A0=A0=A0=A0=A0 then !=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if mv "${_inetcnf_tmp}" "${_inetcnf}" =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 then =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 csih_inform "Removed ssh[d] from ${_inetcnf}" =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 else *************** *** 218,224 **** =A0=A0=A0=A0=A0=A0=A0 else =A0=A0=A0=A0=A0=A0=A0=A0=A0 sed -e 's/@COMMENT@[ \t]*/# /' < "${_sshd_inetd= _conf}" > "${_sshd_inetd_conf_tmp}" =A0=A0=A0=A0=A0=A0=A0 fi !=A0=A0=A0=A0=A0=A0 mv -f "${_sshd_inetd_conf_tmp}" "${_sshd_inetd_conf}" =A0=A0=A0=A0=A0=A0=A0 csih_inform "Updated ${_sshd_inetd_conf}" =A0=A0=A0=A0=A0 fi --- 218,224 ---- =A0=A0=A0=A0=A0=A0=A0 else =A0=A0=A0=A0=A0=A0=A0=A0=A0 sed -e 's/@COMMENT@[ \t]*/# /' < "${_sshd_inetd= _conf}" > "${_sshd_inetd_conf_tmp}" =A0=A0=A0=A0=A0=A0=A0 fi !=A0=A0=A0=A0=A0=A0 mv "${_sshd_inetd_conf_tmp}" "${_sshd_inetd_conf}" =A0=A0=A0=A0=A0=A0=A0 csih_inform "Updated ${_sshd_inetd_conf}" =A0=A0=A0=A0=A0 fi *************** *** 233,239 **** =A0=A0=A0=A0=A0=A0=A0 grep -v '^[# \t]*sshd' "${_inetcnf}" >> "${_inetcnf_t= mp}" =A0=A0=A0=A0=A0=A0=A0 if [ -f "${_inetcnf_tmp}" ] =A0=A0=A0=A0=A0=A0=A0 then !=A0=A0=A0=A0=A0=A0=A0=A0 if mv -f "${_inetcnf_tmp}" "${_inetcnf}" =A0=A0=A0=A0=A0=A0=A0=A0=A0 then =A0 =A0=A0=A0 =A0=A0=A0 csih_inform "Removed sshd from ${_inetcnf}" =A0=A0=A0=A0=A0=A0=A0=A0=A0 else --- 233,239 ---- =A0=A0=A0=A0=A0=A0=A0 grep -v '^[# \t]*sshd' "${_inetcnf}" >> "${_inetcnf_t= mp}" =A0=A0=A0=A0=A0=A0=A0 if [ -f "${_inetcnf_tmp}" ] =A0=A0=A0=A0=A0=A0=A0 then !=A0=A0=A0=A0=A0=A0=A0=A0 if mv "${_inetcnf_tmp}" "${_inetcnf}" =A0=A0=A0=A0=A0=A0=A0=A0=A0 then =A0 =A0=A0=A0 =A0=A0=A0 csih_inform "Removed sshd from ${_inetcnf}" =A0=A0=A0=A0=A0=A0=A0=A0=A0 else *** new/cygwin-service-installation-helper.sh=A0=A0=A0 2009-12-07 14:09:14.000000000 -0700 --- usr/share/csih/cygwin-service-installation-helper.sh=A0=A0=A0 2009-05-03 18:18:38.000000000 -0700 *************** *** 2414,2420 **** =A0=A0=A0=A0=A0=A0=A0 csih_inform "'${username}' will only be used by regis= tered services." =A0=A0=A0=A0=A0=A0=A0 if [ $opt_force -eq 0 ] =A0=A0=A0=A0=A0=A0=A0 then !=A0=A0=A0=A0=A0=A0=A0=A0 if ! csih_request "Do you want to use that name?" =A0=A0=A0=A0=A0=A0=A0=A0=A0 then =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 csih_get_value "Enter the new user name:" =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 username=3D"${csih_value}" --- 2414,2420 ---- =A0=A0=A0=A0=A0=A0=A0 csih_inform "'${username}' will only be used by regis= tered services." =A0=A0=A0=A0=A0=A0=A0 if [ $opt_force -eq 0 ] =A0=A0=A0=A0=A0=A0=A0 then !=A0=A0=A0=A0=A0=A0=A0=A0 if csih_request "Do you want to use a different n= ame?" =A0=A0=A0=A0=A0=A0=A0=A0=A0 then =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 csih_get_value "Enter the new user name:" =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 username=3D"${csih_value}" -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple