Skip to content

Commit bd87ea9

Browse files
committed
Don't allow different keys for different hosts
Keys will be looked for in the following order: - `/etc/osg/boscokeys/${ruser}.key` - `/etc/osg/bosco.key`
1 parent 0b8916e commit bd87ea9

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

hosted-ce/30-remote-site-setup.sh

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,12 @@ function debug_file_contents {
3333
function fetch_remote_os_info {
3434
ruser=$1
3535
rhost=$2
36-
ssh -q -i "$(get_bosco_key "$ruser" "$rhost")" "$ruser@$rhost" "cat /etc/os-release"
36+
ssh -q -i "$(get_bosco_key "$ruser")" "$ruser@$rhost" "cat /etc/os-release"
3737
}
3838

3939
function get_bosco_key {
4040
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
41+
if [[ -f $BOSCOKEYS_DIR/${ruser}.key ]]; then
4542
echo "$BOSCOKEYS_DIR/${ruser}.key"
4643
else
4744
echo "$DEFAULT_BOSCO_KEY"
@@ -58,7 +55,7 @@ setup_ssh_config () {
5855

5956
# copy Bosco key
6057
ssh_key=$ssh_dir/bosco_key.rsa
61-
cp "$(get_bosco_key "$ruser" "$remote_fqdn")" $ssh_key
58+
cp "$(get_bosco_key "$ruser")" $ssh_key
6259
chmod 600 $ssh_key
6360
chown "${ruser}": $ssh_key
6461

@@ -90,7 +87,7 @@ EOF
9087
setup_endpoints_ini () {
9188
echo "Setting up endpoint.ini entry for ${ruser}@$remote_fqdn..."
9289
remote_os_major_ver=$1
93-
ssh_key=$(get_bosco_key "$ruser" "$remote_fqdn")
90+
ssh_key=$(get_bosco_key "$ruser")
9491
# The WN client updater uses "remote_dir" for WN client
9592
# configuration and remote copy. We need the absolute path
9693
# specifically for fetch-crl
@@ -126,12 +123,12 @@ REMOTE_HOST_KEY=`ssh-keyscan -p "$remote_port" "$remote_fqdn"`
126123
root_ssh_dir=/root/.ssh/
127124
mkdir -p $root_ssh_dir
128125
chmod 700 $root_ssh_dir
129-
ln -s "$(get_bosco_key "root" "$remote_fqdn")" $root_ssh_dir/bosco_key.rsa
126+
ln -s "$(get_bosco_key "root")" $root_ssh_dir/bosco_key.rsa
130127

131128
cat <<EOF > /etc/ssh/ssh_config
132129
Host $remote_fqdn
133130
Port $remote_port
134-
IdentityFile "$(get_bosco_key "root" "$remote_fqdn")"
131+
IdentityFile "$(get_bosco_key "root")"
135132
ControlMaster auto
136133
ControlPath /tmp/cm-%i-%r@%h:%p
137134
ControlPersist 15m

0 commit comments

Comments
 (0)