Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
More debug output on public ip refresh, added warning for openssh ver…
Browse files Browse the repository at this point in the history
…sion 7.8 and add support -F ssh arg
  • Loading branch information
Ole Mathias Aa Heggem committed Feb 14, 2019
1 parent db16c3d commit 897c91e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
6 changes: 4 additions & 2 deletions blessclient/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1048,12 +1048,14 @@ def main():
)
parser.add_argument(
'host',
help=('Host name to which we are connecting'),
help=(
'Host name to which we are connecting'),
nargs='*'
)
parser.add_argument(
'--region',
help=('Region to which you want the lambda to connect to. Defaults to first region in config'),
help=(
'Region to which you want the lambda to connect to. Defaults to first region in config'),
default=None
)
parser.add_argument(
Expand Down
3 changes: 2 additions & 1 deletion blessclient/user_ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def _fetchIP(self, url):
if c not in VALID_IP_CHARACTERS:
raise ValueError("Public IP response included invalid character '{}'.".format(c))
return content
except Exception:
except Exception as e:
logging.debug(e)
logging.debug('Could not refresh public IP from {}'.format(url), exc_info=True)

return None
21 changes: 21 additions & 0 deletions blesswrapper/sshclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
import sys
import datetime
import re

from blessclient.client import bless, get_region_from_code, get_regions, load_config
from blessclient.bless_config import BlessConfig
Expand Down Expand Up @@ -60,6 +61,11 @@ def main():
default=22,
help='Port to connect to on the remote host. Default 22'
)
parser.add_argument(
'-F',
default=None,
help='Specifies an alternative per-user configuration file for ssh.'
)
args = parser.parse_args()

if 'AWS_PROFILE' not in os.environ:
Expand All @@ -72,6 +78,18 @@ def main():
sys.stderr.write('AWS session expired. Try running get_session first?\n')
sys.exit(1)

try:
ssh_version = re.search('OpenSSH_([^\s]+)', subprocess.check_output(['ssh', '-V'], stderr=subprocess.STDOUT).decode('UTF-8'))
if '7.8' in ssh_version.group(0):
sys.stderr.write("""@@@@@@@ WARNING @@@@@@@
There is a bug in OpenSSH version 7.8 that makes signed ssh keys not work, and thus Bless does not work.
From our knowledge, the bug only affects the ssh client.
sshd version 7.7 or 7.9 should work with Bless.
We detected that you are running {}
""".format(ssh_version.group(0))+'\n'+'-'*64)
except Exception as e:
sys.stderr.write('Failed to get OpenSSH client version\n')

ssh_options = []
if vars(args)['4']:
ssh_options.append('-4')
Expand All @@ -86,6 +104,9 @@ def main():
ssh_options.append('-X')
if args.Y:
ssh_options.append('-Y')
if args.F is not None:
ssh_options.append('-F')
ssh_options.append(args.F)

hostname = None
username = None
Expand Down

0 comments on commit 897c91e

Please sign in to comment.