home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.57k stars 30.74k forks source link

Asuswrt, ssh connection refused #12568

Closed electricJP closed 6 years ago

electricJP commented 6 years ago

Home Assistant release (hass --version): 0.63.3 Python release (python3 --version): Python 3.5.3 Component/platform: Asuswrt Description of problem: After new merlin-firmware (branch 384)

Connection refused. SSH enabled?
18:03 components/device_tracker/asuswrt.py (ERROR)

It was working just fine with older firmware (branch 380) which will be legacy soon

It is confirmed ssh is enabled and working on the router by establishing a connection from PI:

pi@raspberrypi:~ $ ssh admin@192.168.1.1
admin@192.168.1.1's password:
ASUSWRT-Merlin RT-AC68U 384.3-0 Tue Feb 13 21:08:43 UTC 2018
admin@RT-AC68U-4650:/tmp/home/root#

Using telnet as default protocol works:

  • platform: asuswrt host: 192.168.1.1 protocol: telnet username: admin password: !secret router_password interval_seconds: 30 consider_home: 600
kellerza commented 6 years ago

Did your SSH_KEY/PUB_KEY not change during the upgrade?

If you only use password, you might have to check your known_hosts (or equivalent) file, this will most likely have changed and will prevent you from connecting

electricJP commented 6 years ago

Hello, thank you for your advice. I was testing ssh connection from standard user not homeassistant. When I tried from it I got this error:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:XkEERFCG7hZnSff1V49i2xqDHAPNRtl3wjzH0lXdEf0.
Please contact your system administrator.
Add correct host key in /home/homeassistant/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/homeassistant/.ssh/known_hosts:1
  remove with:
  ssh-keygen -f "/home/homeassistant/.ssh/known_hosts" -R 192.168.1.1
ECDSA host key for 192.168.1.1 has changed and you have requested strict checking.
Host key verification failed.

I had to reinstall from scratch to upgrade python, that's why the key changed. It could be useful to have a little more explicit error message in home-assistant.log.

kellerza commented 6 years ago

The PR should help identifying these types of issues