@@ -1056,6 +1056,7 @@ def _get_jump_host(configuration, client_id, cloud_id, manage=False):
1056
1056
return jump_host
1057
1057
addr = lookup_user_service_value (configuration , client_id , service ,
1058
1058
'service_jumphost_address' , '' )
1059
+ jump_host ['hostalias' ] = '%s-cloud-jump' % cloud_id
1059
1060
jump_host ['address' ] = jump_host ['fqdn' ] = addr
1060
1061
jump_host ['fqdn' ] = cloud_fqdn_from_ip (configuration , addr )[0 ]
1061
1062
jump_host ['user' ] = lookup_user_service_value (
@@ -1152,39 +1153,60 @@ def cloud_remove_jump_host_key(configuration, client_id, cloud_id, auth_keys,
1152
1153
def cloud_ssh_login_help (configuration , client_id , cloud_id , label , address ,
1153
1154
port , image ):
1154
1155
"""Return complete ssh login instructions for saved cloud_dict instance on
1155
- cloud_id.
1156
+ cloud_id. Output is explicitly html-formatted.
1156
1157
"""
1157
1158
_logger = configuration .logger
1158
- base_msg = """You can connect with ssh as user %s on host %s and port %d.
1159
- """
1159
+ base_msg = """<p>
1160
+ You can connect with ssh as user %s on host %s and port %d.
1161
+ <br/>"""
1160
1162
jump_msg = """Please note that you MUST explicitly ssh jump through host
1161
1163
%(fqdn)s as user %(user)s to reach the instance.
1162
- """
1164
+ <br/> """
1163
1165
jump_host = cloud_login_jump_host (configuration , client_id , cloud_id )
1164
1166
fqdn = cloud_fqdn_from_ip (configuration , address )[0 ]
1165
1167
username = cloud_login_username (configuration , cloud_id , image )
1166
1168
msg = base_msg % (username , fqdn , port )
1167
1169
jump_opt = ''
1168
1170
ssh_config = """Host %s
1169
- HostName %s
1170
- User %s
1171
- # Path to your ssh private key matching pub key set on your Cloud Setup page
1172
- IdentityFile ~/.ssh/id_rsa
1173
- IdentitiesOnly yes
1171
+ Hostname %s
1172
+ User %s
1173
+ # Path to your ssh private key matching pub key set on your Cloud Setup page
1174
+ IdentityFile ~/.ssh/id_rsa
1175
+ IdentitiesOnly yes
1174
1176
""" % (label , fqdn , username )
1175
1177
if jump_host ['fqdn' ]:
1176
1178
msg += jump_msg % jump_host
1177
1179
jump_opt = "-J%(user)s@%(fqdn)s" % jump_host
1178
- ssh_config += """ProxyJump %(user)s@%(fqdn)s
1180
+ ssh_config += """ ProxyJump %(hostalias)s
1181
+
1182
+ Host %(hostalias)s %(fqdn)s
1183
+ Hostname %(fqdn)s
1184
+ User %(user)s
1185
+ # Path to your ssh private key matching pub key set on your Cloud Setup page
1186
+ IdentityFile ~/.ssh/id_rsa
1179
1187
""" % jump_host
1180
1188
msg += """Example explicit ssh command:
1189
+ <pre class='codeblock'>
1190
+ <code>
1181
1191
ssh %s %s@%s
1192
+ </code>
1193
+ </pre>
1194
+ </p>
1182
1195
""" % (jump_opt , username , fqdn )
1183
- msg += """
1196
+ msg += """<p>
1184
1197
Alternatively you can add something like:
1198
+ <pre class='codeblock'>
1199
+ <code>
1185
1200
%s
1186
- to your ~/.ssh/config to allow the simple ssh command:
1201
+ </code>
1202
+ </pre>
1203
+ to your ~/.ssh/config to allow connecting with the simple ssh command:
1204
+ <pre class='codeblock'>
1205
+ <code>
1187
1206
ssh %s
1207
+ </code>
1208
+ </pre>
1209
+ </p>
1188
1210
""" % (ssh_config , label )
1189
1211
1190
1212
return msg
0 commit comments