Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Negotiation fail #3

Open
patareco opened this issue Aug 28, 2024 · 8 comments
Open

Error: Negotiation fail #3

patareco opened this issue Aug 28, 2024 · 8 comments
Labels

Comments

@patareco
Copy link

Hello,

Seems like a great plugin. Unfortunately I haven't been able to connect to a host. I get the following error:

terminus_encoding : utf-8
umask : 022
Error: Negotiation Failed
error : ('Error reading SSH protocol banner ' , )
timeout : False

I am not really familiar with paramiko but maybe it's a simple fix?

Kind regards

@Haiquan-27
Copy link
Owner

Haiquan-27 commented Sep 2, 2024

Thanks for your feedback,to fix this error i need your configuration file (ssh-panel.sublime-settings and remove sensitive information) and error message (line numbers and files) in the console.

@Haiquan-27
Copy link
Owner

If your connection is unstable, you can try increasing the value of network_timeout
see detail

@patareco
Copy link
Author

patareco commented Sep 2, 2024

Hello,

Thank you for your reply! Here is the output of the ST console:

Traceback (most recent call last):
  File "C:\Users\miguel\AppData\Roaming\Sublime Text\Installed Packages\SSH-Panel.sublime-package\main.py", line 236, in on_done
  File "C:\Users\miguel\AppData\Roaming\Sublime Text\Installed Packages\SSH-Panel.sublime-package\main.py", line 357, in run
AttributeError: 'NoneType' object has no attribute 'user_settings_config'
Exception (client): Error reading SSH protocol banner
Traceback (most recent call last):
  File "C:\Users\miguel\AppData\Roaming\Sublime Text\Installed Packages\SSH-Panel.sublime-package\dependencies\paramiko\transport.py", line 2270, in _check_banner
    buf = self.packetizer.readline(timeout)
  File "C:\Users\miguel\AppData\Roaming\Sublime Text\Installed Packages\SSH-Panel.sublime-package\dependencies\paramiko\packet.py", line 380, in readline
    buf += self._read_timeout(timeout)
  File "C:\Users\miguel\AppData\Roaming\Sublime Text\Installed Packages\SSH-Panel.sublime-package\dependencies\paramiko\packet.py", line 609, in _read_timeout
    raise EOFError()
EOFError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\miguel\AppData\Roaming\Sublime Text\Installed Packages\SSH-Panel.sublime-package\dependencies\paramiko\transport.py", line 2093, in run
    self._check_banner()
  File "C:\Users\miguel\AppData\Roaming\Sublime Text\Installed Packages\SSH-Panel.sublime-package\dependencies\paramiko\transport.py", line 2274, in _check_banner
    raise SSHException(
paramiko.ssh_exception.SSHException: Error reading SSH protocol banner


SSH-Panel[error]:Negotiation Failed 
error : ('Error reading SSH protocol banner',) 
timeout : False 

Exception in thread Thread-27:
Traceback (most recent call last):
  File "./python3.8/threading.py", line 932, in _bootstrap_inner
  File "./python3.8/threading.py", line 870, in run
  File "C:\Users\miguel\AppData\Roaming\Sublime Text\Installed Packages\SSH-Panel.sublime-package\main.py", line 398, in connect_post
  File "C:\Users\miguel\AppData\Roaming\Sublime Text\Installed Packages\SSH-Panel.sublime-package\ssh_controller.py", line 279, in connect
  File "C:\Users\miguel\AppData\Roaming\Sublime Text\Installed Packages\SSH-Panel.sublime-package\util.py", line 161, in E
SSH-Panel.util.SSHPanelException: Negotiation Failed

SSH-Panel[error]:Negotiation Failed 
error : ('Error reading SSH protocol banner',) 
timeout : False 

reloading settings Packages/User/ssh-panel.sublime-settings

and here are my settings:

{
     "server_settings": {
          "SondelBay": {
               "hostname": "ip",
               "port": port,
               "username": "user",
               "password": "pass",
               "save_password": true,
               "remote_platform": "linux",
               "network_timeout": 30,
               "banner_timeout": 30,
               "remote_path": [
                    "/home/user/domain"
               ],
               "local_path": "~/SFTP-Local/{auto_generate}"
          }
     }
}

Thank you for your time!

@Haiquan-27
Copy link
Owner

Haiquan-27 commented Sep 2, 2024

fixing suggestions:

  1. remote_platform and banner_timeout is a non-existent setting, there is no need to specify them
  2. I noticed that your SSH-Panel.sublime-package\util.py and SSH-Panel.sublime-package\ssh_controller.py is old version file,Please reinstall the latest version of SSH-Panel from package control,the latest version now is v1.3.1
  3. The recommended configuration is
{
     "server_settings": {
          "SondelBay": {
               "hostname": "ip",
               "username": "user",
               "password": "pass",
               "save_password": true,
               "port": port,
               "network_timeout": 50,
               "remote_path": [
                    "/home/user/domain"
               ],
               "local_path": "~/SFTP-Local/{auto_generate}"
          }
     }
}
  1. Suggest using the local ssh command tool to test connectivity with the server

@Haiquan-27
Copy link
Owner

Haiquan-27 commented Sep 2, 2024

This plugin uses the paramiko library in Python3.8. you can run and test this code in sublime text console:

import paramiko,threading
username = "user" 		# set value
password = "pass" 		# set value
hostname = "ip address" 	# set value
test_remote_file = "/etc/os-release" # set value
port = 22 	# set value
timeout = 50 	# set value
transport = paramiko.Transport(sock=(hostname,port))
event = threading.Event()
transport.start_client(event=event,timeout=timeout)
while True:
	event.wait(0.1)
	if event.is_set():
		if not transport.is_active():
			print("Negotiation Failed")
		else:
			print("Negotiation Successful")
		break
transport.auth_password(
	username = username,
	password = password
)
print("Password Authentication Successful")
channel = transport.open_session(timeout=timeout)
channel.invoke_subsystem('sftp')
channel.settimeout(0.5) # This value is fixed, you can try increasing it !!!!
sftp_client =  paramiko.SFTPClient(sock=channel)
with sftp_client.open(test_remote_file,"rb") as rf:
	content = rf.read()
	if len(content) > 0:
		print(content)
		print(test_remote_file,"test OK")
print("Connect Close")
sftp_client.close()
transport.close()

@Haiquan-27
Copy link
Owner

Do you need a proxy to connect to your SSH server?

@patareco
Copy link
Author

patareco commented Sep 2, 2024

I don't know if it was the update, but I could connect successfully both in console and plugin!

SSH-Panel[info]:Password Authentication Successful 

SSH-Panel[info]:Client loaded over 
time use : 14.260134220123291 
remote OS : *nix 
user : user
fingerprint : sha256:PpFWeQNQjisFW2MfPA4taohDydvPyaLKAl5AkpGeUuk= 

Thank you for the update!

ps. I am not using proxys for this server. The setting keys were desperate attempts to pass some additional parameters, but I have removed them.

@Haiquan-27
Copy link
Owner

My pleasure 😊
To get current version can view file {sublime_text_path}/Data/Packages/User/SSH-Panel/version or search SSH-Panel in Package Control: List Packages command
The reason for this error may be that the old version code called the list render function before the connection was completed, see detail
so old version has many serious errors,suggest paying attention to updates

@Haiquan-27 Haiquan-27 reopened this Sep 4, 2024
@Haiquan-27 Haiquan-27 added wontfix This will not be worked on Fixed and removed wontfix This will not be worked on labels Sep 4, 2024
@Haiquan-27 Haiquan-27 reopened this Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants