Browse code

Adding password-less support in GOSC

Kumar Kaushik authored on 2015/09/16 04:40:47
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,91 @@
0
+diff -ru gosc-scripts/imc-shell/imgcust-scripts/ConfigFile.sh gosc-scripts-modify/imc-shell/imgcust-scripts/ConfigFile.sh
1
+--- gosc-scripts/imc-shell/imgcust-scripts/ConfigFile.sh	2015-09-15 11:21:08.091673000 -0700
2
+@@ -851,6 +851,23 @@
3
+   echo "$val"
4
+ }
5
+ 
6
++# Retrieves remote user ssh-rsa public key for password less login as root.
7
++#
8
++# Args:
9
++#   None
10
++# Results:
11
++#   string: ssh rsa public key
12
++# Throws:
13
++#   Nothing
14
++ConfigFile_GetAdminSSHPubKey()
15
++{
16
++  local val='' # has to be declared before assigned
17
++
18
++  val=$(ConfigFile_GetOptionalNonEmptyString 'SSH|KEY')
19
++
20
++  echo "$val"
21
++}
22
++
23
+ # Retrieves whether to reset root password.
24
+ #
25
+ # Args:
26
+diff -ru gosc-scripts/imc-shell/imgcust-scripts/CustomizationUtils.sh gosc-scripts-modify/imc-shell/imgcust-scripts/CustomizationUtils.sh
27
+--- gosc-scripts/imc-shell/imgcust-scripts/CustomizationUtils.sh	2015-09-15 11:21:08.091673000 -0700
28
+@@ -840,6 +840,7 @@
29
+   local resultVar=$1
30
+   local addrShowVar=$2
31
+   local tmpOvfEnvFile=$3
32
++  local sshKey=''
33
+ 
34
+   local formatResult= # unique name
35
+ 
36
+@@ -853,24 +854,6 @@
37
+ EOF
38
+ )
39
+ 
40
+-#  securitySshRsa=$(GetOvfPropertyValue 'security.ssh-rsa' $tmpOvfEnvFile)
41
+-  securitySshRsa=''
42
+-
43
+-  if [[ -n "$securitySshRsa" ]]; then
44
+-    if [[ "$securitySshRsa" != *ssh-rsa* ]]; then
45
+-      Debug "Appending 'ssh-rsa ' to the public key"
46
+-      securitySshRsa="ssh-rsa $securitySshRsa"
47
+-    fi
48
+-
49
+-    export formatResult=$formatResult$(${CAT} <<EOF
50
+-
51
+-
52
+-ssh_authorized_keys:
53
+-  - $securitySshRsa
54
+-EOF
55
+-)
56
+-  fi
57
+-
58
+   local adminPwd=$(ConfigFile_GetAdminPassword)
59
+ 
60
+   if [[ -n "$adminPwd" ]]; then
61
+@@ -888,6 +871,27 @@
62
+ )
63
+   fi
64
+ 
65
++  sshKey=$(ConfigFile_GetAdminSSHPubKey)
66
++  if [[ -n "$sshKey" ]]; then
67
++    if [[ -n "$adminPwd" ]]; then
68
++      export formatResult=$formatResult$(${CAT} <<EOF
69
++
70
++      ssh_authorized_keys:
71
++        - $sshKey
72
++EOF
73
++)
74
++    else
75
++      export formatResult=$formatResult$(${CAT} <<EOF
76
++
77
++users:
78
++    - name: root
79
++      ssh_authorized_keys:
80
++        - $sshKey
81
++EOF
82
++)
83
++    fi
84
++  fi
85
++
86
+   export formatResult=$formatResult$(${CAT} <<EOF
87
+ 
88
+ write_files:
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	Usermode tools for VmWare virts
2 2
 Name:		open-vm-tools
3 3
 Version:	10.0.0
4
-Release:	10%{?dist}
4
+Release:	11%{?dist}
5 5
 License:	LGPLv2+
6 6
 URL:		https://github.com/vmware/open-vm-tools
7 7
 Group:		Applications/System
... ...
@@ -19,6 +19,7 @@ Patch4:         GOSC-NFS-MOUNT.patch
19 19
 Patch5:         skipreboot.patch
20 20
 Patch6:         GOSC-counterBug.patch
21 21
 Patch7:         LighwaveHostPatch.patch
22
+Patch8:         GOSC-ssh-support.patch
22 23
 BuildRequires: 	glib-devel
23 24
 BuildRequires: 	xerces-c-devel
24 25
 BuildRequires: 	xml-security-c-devel
... ...
@@ -48,6 +49,7 @@ VmWare virtualization user mode tools
48 48
 %patch5 -p1
49 49
 %patch6 -p0
50 50
 %patch7 -p0
51
+%patch8 -p0
51 52
 %build
52 53
 touch ChangeLog
53 54
 autoreconf -i
... ...
@@ -107,6 +109,8 @@ rm -f /sbin/mount.vmhgfs
107 107
 
108 108
 
109 109
 %changelog
110
+*       Tue Sep 15 2015 Kumar Kaushik <kaushikk@vmware.com> 10.0.0-11
111
+-       Adding ssh RSA public support for password-less login.
110 112
 *       Wed Sep 09 2015 Kumar Kaushik <kaushikk@vmware.com> 10.0.0-10
111 113
 -       Adding option to modify /etc/hosts for lightwave on optional basis.
112 114
 *       Wed Sep 09 2015 Kumar Kaushik <kaushikk@vmware.com> 10.0.0-9