11
11
12
12
set -e
13
13
14
- BOSCO_KEY=/etc/osg/bosco.key
14
+ DEFAULT_BOSCO_KEY=/etc/osg/bosco.key
15
+ BOSCOKEYS_DIR=/etc/osg/boscokeys
15
16
ENDPOINT_CONFIG=/etc/endpoints.ini
16
17
SKIP_WN_INSTALL=no
17
18
@@ -32,7 +33,19 @@ function debug_file_contents {
32
33
function fetch_remote_os_info {
33
34
ruser=$1
34
35
rhost=$2
35
- ssh -q -i $BOSCO_KEY " $ruser @$rhost " " cat /etc/os-release"
36
+ ssh -q -i " $( get_bosco_key " $ruser " " $rhost " ) " " $ruser @$rhost " " cat /etc/os-release"
37
+ }
38
+
39
+ function get_bosco_key {
40
+ ruser=$1
41
+ rhost=$2
42
+ if [[ -f $BOSCOKEYS_DIR /${ruser} @${rhost} .key ]]; then
43
+ echo " $BOSCOKEYS_DIR /${ruser} @${rhost} .key"
44
+ elif [[ -f $BOSCOKEYS_DIR /${ruser} .key ]]; then
45
+ echo " $BOSCOKEYS_DIR /${ruser} .key"
46
+ else
47
+ echo " $DEFAULT_BOSCO_KEY "
48
+ fi
36
49
}
37
50
38
51
setup_ssh_config () {
@@ -45,7 +58,7 @@ setup_ssh_config () {
45
58
46
59
# copy Bosco key
47
60
ssh_key=$ssh_dir /bosco_key.rsa
48
- cp $BOSCO_KEY $ssh_key
61
+ cp " $( get_bosco_key " $ruser " " $remote_fqdn " ) " $ssh_key
49
62
chmod 600 $ssh_key
50
63
chown " ${ruser} " : $ssh_key
51
64
77
90
setup_endpoints_ini () {
78
91
echo " Setting up endpoint.ini entry for ${ruser} @$remote_fqdn ..."
79
92
remote_os_major_ver=$1
93
+ ssh_key=$( get_bosco_key " $ruser " " $remote_fqdn " )
80
94
# The WN client updater uses "remote_dir" for WN client
81
95
# configuration and remote copy. We need the absolute path
82
96
# specifically for fetch-crl
83
- remote_home_dir=$( ssh -q -i $BOSCO_KEY " ${ruser} @$remote_fqdn " pwd)
97
+ remote_home_dir=$( ssh -q -i $ssh_key " ${ruser} @$remote_fqdn " pwd)
84
98
osg_ver=3.4
85
99
if [[ $remote_os_major_ver -gt 6 ]]; then
86
100
osg_ver=3.5
@@ -91,6 +105,7 @@ local_user = ${ruser}
91
105
remote_host = $remote_fqdn
92
106
remote_user = ${ruser}
93
107
remote_dir = $remote_home_dir /bosco-osg-wn-client
108
+ ssh_key = $ssh_key
94
109
upstream_url = https://repo.opensciencegrid.org/tarball-install/${osg_ver} /osg-wn-client-latest.el${remote_os_major_ver} .x86_64.tar.gz
95
110
EOF
96
111
}
@@ -111,12 +126,12 @@ REMOTE_HOST_KEY=`ssh-keyscan -p "$remote_port" "$remote_fqdn"`
111
126
root_ssh_dir=/root/.ssh/
112
127
mkdir -p $root_ssh_dir
113
128
chmod 700 $root_ssh_dir
114
- ln -s $BOSCO_KEY $root_ssh_dir /bosco_key.rsa
129
+ ln -s " $( get_bosco_key " root " " $remote_fqdn " ) " $root_ssh_dir /bosco_key.rsa
115
130
116
131
cat << EOF > /etc/ssh/ssh_config
117
132
Host $remote_fqdn
118
133
Port $remote_port
119
- IdentityFile ${BOSCO_KEY}
134
+ IdentityFile " $( get_bosco_key " root " " $remote_fqdn " ) "
120
135
ControlMaster auto
121
136
ControlPath /tmp/cm-%i-%r@%h:%p
122
137
ControlPersist 15m
0 commit comments