summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--contrib/cygwin/ssh-host-config31
2 files changed, 29 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 290d90675..5e77f8315 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
120090707
2 - (dtucker) [contrib/cygwin/ssh-host-config] better support for automated
3 scripts and fix usage of eval. Patch from Corinna Vinschen.
4
520090705
1 - (dtucker) OpenBSD CVS Sync 6 - (dtucker) OpenBSD CVS Sync
2 - andreas@cvs.openbsd.org 2009/06/27 09:29:06 7 - andreas@cvs.openbsd.org 2009/06/27 09:29:06
3 [packet.h packet.c] 8 [packet.h packet.c]
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 @@
1#!/bin/bash 1#!/bin/bash
2# 2#
3# ssh-host-config, Copyright 2000, 2001, 2002, 2003 Red Hat Inc. 3# ssh-host-config, Copyright 2000-2009 Red Hat Inc.
4# 4#
5# This file is part of the Cygwin port of OpenSSH. 5# This file is part of the Cygwin port of OpenSSH.
6 6
@@ -26,7 +26,9 @@ port_number=22
26privsep_configured=no 26privsep_configured=no
27privsep_used=yes 27privsep_used=yes
28cygwin_value="" 28cygwin_value=""
29user_account=
29password_value= 30password_value=
31opt_force=no
30 32
31# ====================================================================== 33# ======================================================================
32# Routine: create_host_keys 34# Routine: create_host_keys
@@ -287,6 +289,11 @@ install_service() {
287 csih_inform "sshd requires. You need to have or to create a privileged" 289 csih_inform "sshd requires. You need to have or to create a privileged"
288 csih_inform "account. This script will help you do so." 290 csih_inform "account. This script will help you do so."
289 echo 291 echo
292
293 [ "${opt_force}" = "yes" ] && opt_f=-f
294 [ -n "${user_account}" ] && opt_u="-u ""${user_account}"""
295 csih_select_privileged_username ${opt_f} ${opt_u} sshd
296
290 if ! csih_create_privileged_user "${password_value}" 297 if ! csih_create_privileged_user "${password_value}"
291 then 298 then
292 csih_error_recoverable "There was a serious problem creating a privileged user." 299 csih_error_recoverable "There was a serious problem creating a privileged user."
@@ -316,12 +323,12 @@ install_service() {
316 323
317 if [ -n "${csih_cygenv}" ] 324 if [ -n "${csih_cygenv}" ]
318 then 325 then
319 cygwin_env="-e CYGWIN=\"${csih_cygenv}\"" 326 cygwin_env=( -e "CYGWIN=${csih_cygenv}" )
320 fi 327 fi
321 if [ -z "${password}" ] 328 if [ -z "${password}" ]
322 then 329 then
323 if eval cygrunsrv -I sshd -d \"CYGWIN sshd\" -p /usr/sbin/sshd \ 330 if cygrunsrv -I sshd -d "CYGWIN sshd" -p /usr/sbin/sshd \
324 -a "-D" -y tcpip ${cygwin_env} 331 -a "-D" -y tcpip "${cygwin_env[@]}"
325 then 332 then
326 echo 333 echo
327 csih_inform "The sshd service has been installed under the LocalSystem" 334 csih_inform "The sshd service has been installed under the LocalSystem"
@@ -330,8 +337,8 @@ install_service() {
330 csih_inform "will start automatically after the next reboot." 337 csih_inform "will start automatically after the next reboot."
331 fi 338 fi
332 else 339 else
333 if eval cygrunsrv -I sshd -d \"CYGWIN sshd\" -p /usr/sbin/sshd \ 340 if cygrunsrv -I sshd -d "CYGWIN sshd" -p /usr/sbin/sshd \
334 -a "-D" -y tcpip ${cygwin_env} \ 341 -a "-D" -y tcpip "${cygwin_env[@]}" \
335 -u "${run_service_as}" -w "${password}" 342 -u "${run_service_as}" -w "${password}"
336 then 343 then
337 echo 344 echo
@@ -378,11 +385,13 @@ if [ "$PROGDIR" = "/etc/postinstall" ]
378then 385then
379 csih_auto_answer="no" 386 csih_auto_answer="no"
380 csih_disable_color 387 csih_disable_color
388 opt_force=yes
381fi 389fi
382if [ -n "${SSH_HOST_CONFIG_AUTO_ANSWER_NO}" ] 390if [ -n "${SSH_HOST_CONFIG_AUTO_ANSWER_NO}" ]
383then 391then
384 csih_auto_answer="no" 392 csih_auto_answer="no"
385 csih_disable_color 393 csih_disable_color
394 opt_force=yes
386fi 395fi
387 396
388# ====================================================================== 397# ======================================================================
@@ -407,10 +416,12 @@ do
407 416
408 -y | --yes ) 417 -y | --yes )
409 csih_auto_answer=yes 418 csih_auto_answer=yes
419 opt_force=yes
410 ;; 420 ;;
411 421
412 -n | --no ) 422 -n | --no )
413 csih_auto_answer=no 423 csih_auto_answer=no
424 opt_force=yes
414 ;; 425 ;;
415 426
416 -c | --cygwin ) 427 -c | --cygwin )
@@ -423,6 +434,11 @@ do
423 shift 434 shift
424 ;; 435 ;;
425 436
437 -u | --user )
438 user_account="$1"
439 shift
440 ;;
441
426 -w | --pwd ) 442 -w | --pwd )
427 password_value="$1" 443 password_value="$1"
428 shift 444 shift
@@ -443,6 +459,7 @@ do
443 echo " --no -n Answer all questions with \"no\" automatically." 459 echo " --no -n Answer all questions with \"no\" automatically."
444 echo " --cygwin -c <options> Use \"options\" as value for CYGWIN environment var." 460 echo " --cygwin -c <options> Use \"options\" as value for CYGWIN environment var."
445 echo " --port -p <n> sshd listens on port n." 461 echo " --port -p <n> sshd listens on port n."
462 echo " --user -u <account> privileged user for service."
446 echo " --pwd -w <passwd> Use \"pwd\" as password for privileged user." 463 echo " --pwd -w <passwd> Use \"pwd\" as password for privileged user."
447 echo " --privileged On Windows NT/2k/XP, require privileged user" 464 echo " --privileged On Windows NT/2k/XP, require privileged user"
448 echo " instead of LocalSystem for sshd service." 465 echo " instead of LocalSystem for sshd service."
@@ -489,7 +506,7 @@ then
489fi 506fi
490 507
491# Create /var/empty file used as chroot jail for privilege separation 508# Create /var/empty file used as chroot jail for privilege separation
492csih_make_dir "${LOCALSTATEDIR}/empty" "Cannot create log directory." 509csih_make_dir "${LOCALSTATEDIR}/empty" "Cannot create ${LOCALSTATEDIR}/empty directory."
493chmod 755 "${LOCALSTATEDIR}/empty" 510chmod 755 "${LOCALSTATEDIR}/empty"
494setfacl -m u:system:rwx "${LOCALSTATEDIR}/empty" 511setfacl -m u:system:rwx "${LOCALSTATEDIR}/empty"
495 512