From 4d4fdc0f7dc25e081d8da2e7a525ecb2a6f871f4 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Tue, 7 Jul 2009 21:19:11 +1000 Subject: - (dtucker) [contrib/cygwin/ssh-host-config] better support for automated scripts and fix usage of eval. Patch from Corinna Vinschen. --- contrib/cygwin/ssh-host-config | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'contrib/cygwin') diff --git a/contrib/cygwin/ssh-host-config b/contrib/cygwin/ssh-host-config index 57e728fbc..32cb6ba23 100644 --- a/contrib/cygwin/ssh-host-config +++ b/contrib/cygwin/ssh-host-config @@ -1,6 +1,6 @@ #!/bin/bash # -# ssh-host-config, Copyright 2000, 2001, 2002, 2003 Red Hat Inc. +# ssh-host-config, Copyright 2000-2009 Red Hat Inc. # # This file is part of the Cygwin port of OpenSSH. @@ -26,7 +26,9 @@ port_number=22 privsep_configured=no privsep_used=yes cygwin_value="" +user_account= password_value= +opt_force=no # ====================================================================== # Routine: create_host_keys @@ -287,6 +289,11 @@ install_service() { csih_inform "sshd requires. You need to have or to create a privileged" csih_inform "account. This script will help you do so." echo + + [ "${opt_force}" = "yes" ] && opt_f=-f + [ -n "${user_account}" ] && opt_u="-u ""${user_account}""" + csih_select_privileged_username ${opt_f} ${opt_u} sshd + if ! csih_create_privileged_user "${password_value}" then csih_error_recoverable "There was a serious problem creating a privileged user." @@ -316,12 +323,12 @@ install_service() { if [ -n "${csih_cygenv}" ] then - cygwin_env="-e CYGWIN=\"${csih_cygenv}\"" + cygwin_env=( -e "CYGWIN=${csih_cygenv}" ) fi if [ -z "${password}" ] then - if eval cygrunsrv -I sshd -d \"CYGWIN sshd\" -p /usr/sbin/sshd \ - -a "-D" -y tcpip ${cygwin_env} + if cygrunsrv -I sshd -d "CYGWIN sshd" -p /usr/sbin/sshd \ + -a "-D" -y tcpip "${cygwin_env[@]}" then echo csih_inform "The sshd service has been installed under the LocalSystem" @@ -330,8 +337,8 @@ install_service() { csih_inform "will start automatically after the next reboot." fi else - if eval cygrunsrv -I sshd -d \"CYGWIN sshd\" -p /usr/sbin/sshd \ - -a "-D" -y tcpip ${cygwin_env} \ + if cygrunsrv -I sshd -d "CYGWIN sshd" -p /usr/sbin/sshd \ + -a "-D" -y tcpip "${cygwin_env[@]}" \ -u "${run_service_as}" -w "${password}" then echo @@ -378,11 +385,13 @@ if [ "$PROGDIR" = "/etc/postinstall" ] then csih_auto_answer="no" csih_disable_color + opt_force=yes fi if [ -n "${SSH_HOST_CONFIG_AUTO_ANSWER_NO}" ] then csih_auto_answer="no" csih_disable_color + opt_force=yes fi # ====================================================================== @@ -407,10 +416,12 @@ do -y | --yes ) csih_auto_answer=yes + opt_force=yes ;; -n | --no ) csih_auto_answer=no + opt_force=yes ;; -c | --cygwin ) @@ -423,6 +434,11 @@ do shift ;; + -u | --user ) + user_account="$1" + shift + ;; + -w | --pwd ) password_value="$1" shift @@ -443,6 +459,7 @@ do echo " --no -n Answer all questions with \"no\" automatically." echo " --cygwin -c Use \"options\" as value for CYGWIN environment var." echo " --port -p sshd listens on port n." + echo " --user -u privileged user for service." echo " --pwd -w Use \"pwd\" as password for privileged user." echo " --privileged On Windows NT/2k/XP, require privileged user" echo " instead of LocalSystem for sshd service." @@ -489,7 +506,7 @@ then fi # Create /var/empty file used as chroot jail for privilege separation -csih_make_dir "${LOCALSTATEDIR}/empty" "Cannot create log directory." +csih_make_dir "${LOCALSTATEDIR}/empty" "Cannot create ${LOCALSTATEDIR}/empty directory." chmod 755 "${LOCALSTATEDIR}/empty" setfacl -m u:system:rwx "${LOCALSTATEDIR}/empty" -- cgit v1.2.3 From 8fdcba5caf124bec3d17e6c6688ca2f1857329c3 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Sun, 12 Jul 2009 21:58:42 +1000 Subject: - (dtucker [contrib/cygwin/ssh-{host,user}-config] Add license text. Patch from Corinna Vinschen. --- ChangeLog | 2 ++ contrib/cygwin/ssh-host-config | 12 ++++++++++++ contrib/cygwin/ssh-user-config | 14 +++++++++++++- 3 files changed, 27 insertions(+), 1 deletion(-) (limited to 'contrib/cygwin') diff --git a/ChangeLog b/ChangeLog index 635bbd435..c6674c495 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 20090712 - (dtucker) [configure.ac] Include sys/param.h for the sys/mount.h test, prevents configure complaining on older BSDs. + - (dtucker [contrib/cygwin/ssh-{host,user}-config] Add license text. Patch + from Corinna Vinschen. 20090707 - (dtucker) [contrib/cygwin/ssh-host-config] better support for automated diff --git a/contrib/cygwin/ssh-host-config b/contrib/cygwin/ssh-host-config index 32cb6ba23..b6f9511e2 100644 --- a/contrib/cygwin/ssh-host-config +++ b/contrib/cygwin/ssh-host-config @@ -3,6 +3,18 @@ # ssh-host-config, Copyright 2000-2009 Red Hat Inc. # # This file is part of the Cygwin port of OpenSSH. +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR +# THE USE OR OTHER DEALINGS IN THE SOFTWARE. # ====================================================================== # Initialization diff --git a/contrib/cygwin/ssh-user-config b/contrib/cygwin/ssh-user-config index f210bd556..303aef0bb 100644 --- a/contrib/cygwin/ssh-user-config +++ b/contrib/cygwin/ssh-user-config @@ -1,8 +1,20 @@ #!/bin/bash # -# ssh-user-config, Copyright 2000, 2001, 2002, 2003, Red Hat Inc. +# ssh-user-config, Copyright 2000-2008 Red Hat Inc. # # This file is part of the Cygwin port of OpenSSH. +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR +# THE USE OR OTHER DEALINGS IN THE SOFTWARE. # ====================================================================== # Initialization -- cgit v1.2.3 From caeb16498409fb0570e665a7400ce88c9c4d17be Mon Sep 17 00:00:00 2001 From: Tim Rice Date: Wed, 29 Jul 2009 07:21:13 -0700 Subject: - (tim) [contrib/cygwin/ssh-user-config] Change script to call correct error function. Patch from Corinna Vinschen. --- ChangeLog | 4 ++++ contrib/cygwin/ssh-user-config | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'contrib/cygwin') diff --git a/ChangeLog b/ChangeLog index f6067e8a0..2c4129e3e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +20090729 + - (tim) [contrib/cygwin/ssh-user-config] Change script to call correct error + function. Patch from Corinna Vinschen. + 20090713 - (dtucker) [openbsd-compat/getrrsetbyname.c] Reduce answer buffer size so it fits into 16 bits to work around a bug in glibc's resolver where it masks diff --git a/contrib/cygwin/ssh-user-config b/contrib/cygwin/ssh-user-config index 303aef0bb..f1a001a93 100644 --- a/contrib/cygwin/ssh-user-config +++ b/contrib/cygwin/ssh-user-config @@ -130,14 +130,14 @@ check_user_homedir() { pwdhome=$(awk -F: '{ if ( $3 == '${uid}' ) print $6; }' < ${SYSCONFDIR}/passwd) if [ "X${pwdhome}" = "X" ] then - csih_error_multiline \ + csih_error_multi \ "There is no home directory set for you in ${SYSCONFDIR}/passwd." \ 'Setting $HOME is not sufficient!' fi if [ ! -d "${pwdhome}" ] then - csih_error_multiline \ + csih_error_multi \ "${pwdhome} is set in ${SYSCONFDIR}/passwd as your home directory" \ 'but it is not a valid directory. Cannot create user identity files.' fi @@ -303,7 +303,7 @@ done # Check passwd file if [ ! -f ${SYSCONFDIR}/passwd ] then - csih_error_multiline \ + csih_error_multi \ "${SYSCONFDIR}/passwd is nonexistant. Please generate an ${SYSCONFDIR}/passwd file" \ 'first using mkpasswd. Check if it contains an entry for you and' \ 'please care for the home directory in your entry as well.' -- cgit v1.2.3