1Panel icon indicating copy to clipboard operation
1Panel copied to clipboard

[BUG]面板ssh管理设置监听ipv6地址之后重启ssh服务会挂

Open LouisFonda opened this issue 1 year ago • 3 comments

联系方式

[email protected]

1Panel 版本

V1.10.6-lts

问题描述

面板ssh管理设置监听ipv6地址之后重启ssh服务会挂

重现步骤

1.注释 AddressFamily any 2.设置监听ipv6地址 3.重启ssh服务

期待的正确结果

Port 22 AddressFamily any ListenAddress 0.0.0.0 ListenAddress ::

相关日志输出

No response

附加信息

设置监听ipv6地址,同时也要设置允许ipv6地址族

LouisFonda avatar May 11 '24 16:05 LouisFonda

感谢反馈 我们先在本地复现一下

zhengkunwang223 avatar May 12 '24 01:05 zhengkunwang223

麻烦提供一下完整的配置信息

ssongliu avatar May 22 '24 02:05 ssongliu

环境

平台:阿里云ecs实例 系统:ubuntu22

问题经过

创建实例的时候我没有设置ipv6,并且使用了一段时间,云主机的ipv6是后面单独设置上去的,期间我在1panel上面设置了绑定ipv6,之后就发现当域名解析成ipv6时会连接失败,使用ipv4地址直接连接或者域名被解析成ipv4时可以连接成功,这个时候ssh并没有挂,后面我发现当配置文件只设置ipv4的监听没问题,设置ipv6就会挂掉,最后我添加AddressFamily any就没问题了,我今天重现不了这个问题了。

新问题(服务器重启之后)

现在的新问题是我只能设置ipv6,单独设置ipv4会挂

基本配置


# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

Include /etc/ssh/sshd_config.d/*.conf


#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#PubkeyAuthentication yes

# Expect .ssh/authorized_keys2 to be disregarded by default in future.
#AuthorizedKeysFile	.ssh/authorized_keys .ssh/authorized_keys2

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
#PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
KbdInteractiveAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the KbdInteractiveAuthentication and
# PAM authentication via KbdInteractiveAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# and KbdInteractiveAuthentication to 'no'.
UsePAM yes

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
PrintMotd no
#PrintLastLog yes
#TCPKeepAlive yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
UseDNS no
#PidFile /run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

# override default of no subsystems
Subsystem	sftp	/usr/lib/openssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#	X11Forwarding no
#	AllowTcpForwarding no
#	PermitTTY no
#	ForceCommand cvs server
PasswordAuthentication yes

问题配置

只监听ipv4

PasswordAuthentication yes
ListenAddress 0.0.0.0
#ListenAddress ::

监听ipv4+AddressFamily

PasswordAuthentication yes
AddressFamily any
ListenAddress 0.0.0.0
#ListenAddress ::

无问题配置

不监听任何地址

PasswordAuthentication yes

监听所有ipv4+ipv6

PasswordAuthentication yes
ListenAddress 0.0.0.0
ListenAddress ::

只监听ipv6


PasswordAuthentication yes
#ListenAddress 0.0.0.0
ListenAddress ::

LouisFonda avatar May 23 '24 07:05 LouisFonda