Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

paramiko throw exception when ssh option "password" is composed with letters #248

Closed
yzs981130 opened this issue Jan 19, 2018 · 2 comments
Closed
Labels

Comments

@yzs981130
Copy link

paramiko log

DEB [20180119-22:25:31.520] thr=2   paramiko.transport: Adding ssh-ed25519 host key for xxx
DEB [20180119-22:25:31.548] thr=5   paramiko.transport: userauth is OK
ERR [20180119-22:25:31.549] thr=5   paramiko.transport: Unknown exception: object of type 'int' has no len()
ERR [20180119-22:25:31.551] thr=5   paramiko.transport: Traceback (most recent call last):
ERR [20180119-22:25:31.551] thr=5   paramiko.transport:   File "/usr/local/lib/python2.7/dist-packages/paramiko/transport.py", line 1908, in run
ERR [20180119-22:25:31.551] thr=5   paramiko.transport:     handler(self.auth_handler, m)
ERR [20180119-22:25:31.551] thr=5   paramiko.transport:   File "/usr/local/lib/python2.7/dist-packages/paramiko/auth_handler.py", line 260, in _parse_service_accept
ERR [20180119-22:25:31.551] thr=5   paramiko.transport:     m.add_string(password)
ERR [20180119-22:25:31.551] thr=5   paramiko.transport:   File "/usr/local/lib/python2.7/dist-packages/paramiko/message.py", line 274, in add_string
ERR [20180119-22:25:31.552] thr=5   paramiko.transport:     self.add_int(len(s))
ERR [20180119-22:25:31.552] thr=5   paramiko.transport: TypeError: object of type 'int' has no len()
ERR [20180119-22:25:31.552] thr=5   paramiko.transport: 

bootstrap.py output

daemonset "kube-proxy" created
src/
src/start.sh
src/cleanup.sh
src/kubelet.sh
Traceback (most recent call last):
  File "./bootstrap.py", line 356, in <module>
    main()
  File "./bootstrap.py", line 342, in main
    remoteBootstrap(cluster_config['clusterinfo'], machine_list[hostname])
  File "./bootstrap.py", line 202, in remoteBootstrap
    sftp_paramiko(src_local, dst_remote, srcipt_package, host_config)
  File "./bootstrap.py", line 104, in sftp_paramiko
    ssh.connect(hostname=hostip, port=port, username=username, password=password)
  File "/usr/lib/python2.7/dist-packages/paramiko/client.py", line 367, in connect
    look_for_keys, gss_auth, gss_kex, gss_deleg_creds, gss_host)
  File "/usr/lib/python2.7/dist-packages/paramiko/client.py", line 571, in _auth
    self._transport.auth_password(username, password)
  File "/usr/lib/python2.7/dist-packages/paramiko/transport.py", line 1262, in auth_password
    return self.auth_handler.wait_for_response(my_event)
  File "/usr/lib/python2.7/dist-packages/paramiko/auth_handler.py", line 197, in wait_for_response
    raise e
Exception: Unknown   ##type

Solution: add quotation marks in the field

@abuccts
Copy link
Member

abuccts commented Jan 19, 2018

@ydye should we check and convert the type of each field in parsed yaml file? otherwise, yaml.load() will decide it which we can't control. e.g., use string(host_config['password']) to avoid such issues.

@abuccts abuccts added the bug label Jan 19, 2018
@ydye
Copy link
Contributor

ydye commented Jan 20, 2018

Let's do it. @abuccts

abuccts added a commit that referenced this issue Feb 1, 2018
Convert data types loaded from yaml config.
Fixes #248.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants