summaryrefslogtreecommitdiff
path: root/contrib/cygwin/ssh-user-config
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2015-08-19 14:23:51 +0100
committerColin Watson <cjwatson@debian.org>2015-08-19 16:48:11 +0100
commit0f0841b2d28b7463267d4d91577e72e3340a1d3a (patch)
treeba55fcd2b6e2cc22b30f5afb561dbb3da4c8b6c7 /contrib/cygwin/ssh-user-config
parentf2a5f5dae656759efb0b76c3d94890b65c197a02 (diff)
parent8698446b972003b63dfe5dcbdb86acfe986afb85 (diff)
New upstream release (6.8p1).
Diffstat (limited to 'contrib/cygwin/ssh-user-config')
-rw-r--r--contrib/cygwin/ssh-user-config27
1 files changed, 9 insertions, 18 deletions
diff --git a/contrib/cygwin/ssh-user-config b/contrib/cygwin/ssh-user-config
index 8708b7a58..33dc0cbea 100644
--- a/contrib/cygwin/ssh-user-config
+++ b/contrib/cygwin/ssh-user-config
@@ -1,6 +1,6 @@
1#!/bin/bash 1#!/bin/bash
2# 2#
3# ssh-user-config, Copyright 2000-2008 Red Hat Inc. 3# ssh-user-config, Copyright 2000-2014 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#
@@ -75,19 +75,18 @@ readonly -f create_identity
75# pwdhome 75# pwdhome
76# ====================================================================== 76# ======================================================================
77check_user_homedir() { 77check_user_homedir() {
78 local uid=$(id -u) 78 pwdhome=$(getent passwd $UID | awk -F: '{ print $6; }')
79 pwdhome=$(awk -F: '{ if ( $3 == '${uid}' ) print $6; }' < ${SYSCONFDIR}/passwd)
80 if [ "X${pwdhome}" = "X" ] 79 if [ "X${pwdhome}" = "X" ]
81 then 80 then
82 csih_error_multi \ 81 csih_error_multi \
83 "There is no home directory set for you in ${SYSCONFDIR}/passwd." \ 82 "There is no home directory set for you in the account database." \
84 'Setting $HOME is not sufficient!' 83 'Setting $HOME is not sufficient!'
85 fi 84 fi
86 85
87 if [ ! -d "${pwdhome}" ] 86 if [ ! -d "${pwdhome}" ]
88 then 87 then
89 csih_error_multi \ 88 csih_error_multi \
90 "${pwdhome} is set in ${SYSCONFDIR}/passwd as your home directory" \ 89 "${pwdhome} is set in the account database as your home directory" \
91 'but it is not a valid directory. Cannot create user identity files.' 90 'but it is not a valid directory. Cannot create user identity files.'
92 fi 91 fi
93 92
@@ -96,7 +95,7 @@ check_user_homedir() {
96 if [ "X${pwdhome}" = "X/" ] 95 if [ "X${pwdhome}" = "X/" ]
97 then 96 then
98 # But first raise a warning! 97 # But first raise a warning!
99 csih_warning "Your home directory in ${SYSCONFDIR}/passwd is set to root (/). This is not recommended!" 98 csih_warning "Your home directory in the account database is set to root (/). This is not recommended!"
100 if csih_request "Would you like to proceed anyway?" 99 if csih_request "Would you like to proceed anyway?"
101 then 100 then
102 pwdhome='' 101 pwdhome=''
@@ -106,7 +105,7 @@ check_user_homedir() {
106 fi 105 fi
107 fi 106 fi
108 107
109 if [ -d "${pwdhome}" -a csih_is_nt -a -n "`chmod -c g-w,o-w "${pwdhome}"`" ] 108 if [ -d "${pwdhome}" -a -n "`chmod -c g-w,o-w "${pwdhome}"`" ]
110 then 109 then
111 echo 110 echo
112 csih_warning 'group and other have been revoked write permission to your home' 111 csih_warning 'group and other have been revoked write permission to your home'
@@ -149,9 +148,10 @@ readonly -f check_user_dot_ssh_dir
149# pwdhome -- check_user_homedir() 148# pwdhome -- check_user_homedir()
150# ====================================================================== 149# ======================================================================
151fix_authorized_keys_perms() { 150fix_authorized_keys_perms() {
152 if [ csih_is_nt -a -e "${pwdhome}/.ssh/authorized_keys" ] 151 if [ -e "${pwdhome}/.ssh/authorized_keys" ]
153 then 152 then
154 if ! setfacl -m "u::rw-,g::---,o::---" "${pwdhome}/.ssh/authorized_keys" 153 setfacl -b "${pwdhome}/.ssh/authorized_keys" 2>/dev/null || echo -n
154 if ! chmod u-x,g-wx,o-wx "${pwdhome}/.ssh/authorized_keys"
155 then 155 then
156 csih_warning "Setting correct permissions to ${pwdhome}/.ssh/authorized_keys" 156 csih_warning "Setting correct permissions to ${pwdhome}/.ssh/authorized_keys"
157 csih_warning "failed. Please care for the correct permissions. The minimum requirement" 157 csih_warning "failed. Please care for the correct permissions. The minimum requirement"
@@ -243,15 +243,6 @@ done
243# Action! 243# Action!
244# ====================================================================== 244# ======================================================================
245 245
246# Check passwd file
247if [ ! -f ${SYSCONFDIR}/passwd ]
248then
249 csih_error_multi \
250 "${SYSCONFDIR}/passwd is nonexistant. Please generate an ${SYSCONFDIR}/passwd file" \
251 'first using mkpasswd. Check if it contains an entry for you and' \
252 'please care for the home directory in your entry as well.'
253fi
254
255check_user_homedir 246check_user_homedir
256check_user_dot_ssh_dir 247check_user_dot_ssh_dir
257create_identity id_rsa rsa "SSH2 RSA" 248create_identity id_rsa rsa "SSH2 RSA"