無効なホストのSSH(IPv6)

無効なホストのSSH(IPv6)

簡単に言うと:

opi2つのホストがありますbpi

これを行うと、IPv4を介して接続しましたがssh bpi(間違った)IPv6アドレスを使用していたopi問題を追跡しました。私のOpenWRTルーターはと関連していると思いますが、実際には()の代わりに表示されます。ssh opissh bpibpiip address show eth0opi

出力などを投稿できますが、ip address show何がプライベートで、何がIPv6ではないかよくわかりません。問題のアドレス範囲はですglobal mngtmpaddr noprefixroute

ルータに見えるすべてのIPv6をオフにしたくはありませんが、何が問題なのかわかりません。

詳細:

この問題のためにIPv6について読んでみましたが、ネットワーキングに関する内容はあまり満足できず、難しい部分が多いため、通常は遠くです。

この動作は SSH ホスト鍵の変更 DNS なりすまし警告をトリガーするので、これは良いことです。 OpenWRTのIPv6に関連している可能性がありますが、他の人や未解決の問題を見つけることができません。また、まだIPv6関連のエントリを設定していません。このようなことが起こりました。ルータは先月、OpenWrt 21.02.1にフラッシュされました。

すべてのマシンはDebian Linuxベースです。この問題は、私が使った3つのノートブックすべてで発生しました。 OpenWRTのdnsmasqサービスを使用して、すべてのホストにDNS名で静的DHCPリースを提供します。各ホストのファイルはインベントリです(/etc/hostsZeroTierが提供するアドレスエイリアスのリストを除く)。*.zt

IPv4アドレスまたはZeroTierエイリアスに直接接続すると、すべてが期待どおりに機能します。

opiOpenWRTではIPv6ホストとして表示されません。 bpi表示されますが、アドレスはですopi。両方のボックスに異なるMACがあるため、静的DHCP割り当てのためにdnsmasqに入れてWOL用の設定ファイルに保存します。

任意のIPv6アドレス(すべてのアドレスを除く)に接続できます。これはおそらく特別なアドレスです。私は数年前にやったhe.netチュートリアルを除いて、IPv6についてほとんど知りません。

IPv6を完全にオフにする以外に何を試すことができますか?

OpenWRTでIPv6サフィックスを設定する必要がありますか?


/etc/nsswitch.confリクエストに応じて、Ubuntu 10 / Debian 11は現状のまま提供されます。

passwd:         compat systemd
group:          compat systemd
shadow:         compat
gshadow:        files

hosts:          files mdns4_minimal [NOTFOUND=return] dns
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

そして/etc/hosts(または少なくともIPv6部分):

127.0.0.1   localhost
127.0.1.1   t460s

# Some IPv4 aliases here, nothing more
# 10.147.*.*    *.zt

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

ネームサーバーは、このノートブックまたは/を含む他のすべてのノートブックに127.0.0.53あります(192.168.3.1はOpenWRTゲートウェイです)。192.168.3.1opibpi

$ nslookup opi.lan
Server:     127.0.0.53
Address:    127.0.0.53#53

Non-authoritative answer:
Name:   opi.lan
Address: 192.168.3.182
$ nslookup bpi.lan
Server:     127.0.0.53
Address:    127.0.0.53#53

Non-authoritative answer:
Name:   bpi.lan
Address: 192.168.3.160
Name:   bpi.lan
Address: fd26:256d:8eef::17f
$ ssh bpi.zt nslookup bpi
Server:     192.168.3.1
Address:    192.168.3.1#53

Name:   bpi.lan
Address: 192.168.3.160
Name:   bpi.lan
Address: fd26:256d:8eef::17f

ゲートウェイ自体からuci show dhcp

dhcp.@dnsmasq[0]=dnsmasq
dhcp.@dnsmasq[0].domainneeded='1'
dhcp.@dnsmasq[0].localise_queries='1'
dhcp.@dnsmasq[0].rebind_protection='1'
dhcp.@dnsmasq[0].rebind_localhost='1'
dhcp.@dnsmasq[0].local='/lan/'
dhcp.@dnsmasq[0].domain='lan'
dhcp.@dnsmasq[0].expandhosts='1'
dhcp.@dnsmasq[0].authoritative='1'
dhcp.@dnsmasq[0].readethers='1'
dhcp.@dnsmasq[0].leasefile='/tmp/dhcp.leases'
dhcp.@dnsmasq[0].resolvfile='/tmp/resolv.conf.d/resolv.conf.auto'
dhcp.@dnsmasq[0].localservice='1'
dhcp.@dnsmasq[0].ednspacket_max='1232'
dhcp.lan=dhcp
dhcp.lan.interface='lan'
dhcp.lan.start='100'
dhcp.lan.limit='150'
dhcp.lan.leasetime='12h'
dhcp.lan.dhcpv4='server'
dhcp.lan.dhcpv6='server'
dhcp.lan.ra='server'
dhcp.lan.ra_flags='managed-config' 'other-config'
dhcp.wan=dhcp
dhcp.wan.interface='wan'
dhcp.wan.ignore='1'
dhcp.odhcpd=odhcpd
dhcp.odhcpd.maindhcp='0'
dhcp.odhcpd.leasefile='/tmp/hosts/odhcpd'
dhcp.odhcpd.leasetrigger='/usr/sbin/odhcpd-update'
dhcp.odhcpd.loglevel='4'

dhcp.@host[0]=host
dhcp.@host[0].name='xxx'
dhcp.@host[0].dns='1'
dhcp.@host[0].mac='x:x:x:x:x:x'
dhcp.@host[0].ip='192.168.3.x'

IPv6ルーティング:

::1 dev lo proto kernel metric 256 pref medium
fd26:256d:8eef::3b5 dev wlp3s0 proto kernel metric 600 pref medium
fd26:256d:8eef::d1c dev enp0s31f6 proto kernel metric 100 pref medium
fd26:256d:8eef::/64 dev enp0s31f6 proto ra metric 100 pref medium
fd26:256d:8eef::/64 dev wlp3s0 proto ra metric 600 pref medium
fd26:256d:8eef::/48 via fe80::9ade:d0ff:fe5e:534c dev enp0s31f6 proto ra metric 100 pref medium
fd26:256d:8eef::/48 via fe80::9ade:d0ff:fe5e:534c dev wlp3s0 proto ra metric 600 pref medium
fe80::/64 dev enp0s31f6 proto kernel metric 100 pref medium
fe80::/64 dev ztuku7oncs proto kernel metric 256 pref medium
fe80::/64 dev wlp3s0 proto kernel metric 600 pref medium

典型的resolv.confな:

search lan
nameserver 192.168.3.1
nameserver fd26:256d:8eef::1

$ ssh bpi
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@       WARNING: POSSIBLE DNS SPOOFING DETECTED!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The ECDSA host key for bpi has changed,
and the key for the corresponding IP address fd26:256d:8eef::17f
is unchanged. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
Offending key for IP in /home/hari/.ssh/known_hosts:113
  remove with:
  ssh-keygen -f "/home/hari/.ssh/known_hosts" -R "fd26:256d:8eef::17f"
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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:UdjpmN7FNjdrvUWRMXPDYW6wURx0BU3N/AeuZpf0oTc.
Please contact your system administrator.
Add correct host key in /home/hari/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/hari/.ssh/known_hosts:149
  remove with:
  ssh-keygen -f "/home/hari/.ssh/known_hosts" -R "bpi"
Password authentication is disabled to avoid man-in-the-middle attacks.
Keyboard-interactive authentication is disabled to avoid man-in-the-middle attacks.
Agent forwarding is disabled to avoid man-in-the-middle attacks.
  ___  ____  _    ___             
 / _ \|  _ \(_)  / _ \ _ __   ___ 
| | | | |_) | | | | | | '_ \ / _ \
| |_| |  __/| | | |_| | | | |  __/
 \___/|_|   |_|  \___/|_| |_|\___|
                                  
Welcome to Armbian 21.02.2 Focal with Linux 5.10.60-sunxi
...
$ ssh bpi.zt
 ____  ____  _ 
| __ )|  _ \(_)
|  _ \| |_) | |
| |_) |  __/| |
|____/|_|   |_|
               
Welcome to Armbian 21.02.3 Focal with Linux 5.10.60-sunxi
...

後で見てみましょう。

  • もしresolve.confに特別な機能がありますか?resolve.conf.dおそらく...
  • 2つの間に管理されたスイッチを持つことが重要ですか?これも新機能です。
  • mDNSは私ができることで、これはsearch local問題を「隠す」ことができますか?

しかし、本当にOpenWRTを掘り下げて、それらの人々を悩ませるべきかどうかを調べる必要があると思います。

ベストアンサー1

おすすめ記事