summaryrefslogtreecommitdiffhomepage
path: root/demos
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2017-09-18 12:05:57 -0700
committerJeff Forcier <jeff@bitprophet.org>2017-09-18 12:05:57 -0700
commitd20f8b9820294006ee078944ca9eb01a41b65dd8 (patch)
tree2f6b3ac3d6529c8ac2b4704f318d0b1820a09928 /demos
parent20b69e7735e8c7e8bf63ee4df2c6a6b34743e646 (diff)
parent89a9b583e46f634792d814c5cff8e0cecdb5fa50 (diff)
Merge branch '2.0' of github.com:paramiko/paramiko into 2.0
Diffstat (limited to 'demos')
-rw-r--r--[-rwxr-xr-x]demos/demo_simple.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/demos/demo_simple.py b/demos/demo_simple.py
index 3a17988c..7ae3d8c8 100755..100644
--- a/demos/demo_simple.py
+++ b/demos/demo_simple.py
@@ -37,8 +37,10 @@ except ImportError:
# setup logging
paramiko.util.log_to_file('demo_simple.log')
# Paramiko client configuration
-UseGSSAPI = True # enable GSS-API / SSPI authentication
-DoGSSAPIKeyExchange = True
+UseGSSAPI = paramiko.GSS_AUTH_AVAILABLE # enable "gssapi-with-mic" authentication, if supported by your python installation
+DoGSSAPIKeyExchange = paramiko.GSS_AUTH_AVAILABLE # enable "gssapi-kex" key exchange, if supported by your python installation
+# UseGSSAPI = False
+# DoGSSAPIKeyExchange = False
port = 22
# get hostname
@@ -64,7 +66,7 @@ if username == '':
username = input('Username [%s]: ' % default_username)
if len(username) == 0:
username = default_username
-if not UseGSSAPI or (not UseGSSAPI and not DoGSSAPIKeyExchange):
+if not UseGSSAPI and not DoGSSAPIKeyExchange:
password = getpass.getpass('Password for %s@%s: ' % (username, hostname))
@@ -74,7 +76,7 @@ try:
client.load_system_host_keys()
client.set_missing_host_key_policy(paramiko.WarningPolicy())
print('*** Connecting...')
- if not UseGSSAPI or (not UseGSSAPI and not DoGSSAPIKeyExchange):
+ if not UseGSSAPI and not DoGSSAPIKeyExchange:
client.connect(hostname, port, username, password)
else:
# SSPI works only with the FQDN of the target host
@@ -83,6 +85,7 @@ try:
client.connect(hostname, port, username, gss_auth=UseGSSAPI,
gss_kex=DoGSSAPIKeyExchange)
except Exception:
+ # traceback.print_exc()
password = getpass.getpass('Password for %s@%s: ' % (username, hostname))
client.connect(hostname, port, username, password)