AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[denyhosts](server)

Martin Hope
We are Borg
Asked: 2017-01-31 03:30:45 +0800 CST

Denyhosts 杀死 ssh,denyhosts 文件包含奇怪的字符

  • 0

今天早上我们注意到我们无法使用 SSH 登录到我们的服务器。然后,我们的服务器提供商在 ram 上安装了一个最小的 Linux。安装磁盘并 chroot 后,我​​暂时停止了拒绝主机,当我进入 hosts.deny 文件以清除我们的 IP 地址时,我们看到以下内容。这究竟是什么?

# DenyHosts: Sat Jan 28 05:01:43 2017 | sshd: ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@$
sshd: ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@$
# DenyHosts: Sat Jan 28 05:01:43 2017 | sshd: ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@$
sshd: ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@$
# DenyHosts: Sat Jan 28 05:23:14 2017 | sshd: ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@$
sshd: ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@$
# DenyHosts: Sat Jan 28 05:23:14 2017 | sshd: ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@$
sshd: ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@$

此外,当我发出命令 iptables -L 时,我得到以下信息。我想清除 iptables 规则:

iptables -L
libkmod: ERROR ../libkmod/libkmod.c:554 kmod_search_moddep: could not open moddep file '/lib/modules/4.8.15/modules.dep.bin'
iptables v1.4.14: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

这就是我进入环境的方式:

 mount --bind /proc /mnt/proc
 mount --bind /dev /mnt/dev
 mount --bind /sys /mnt/sys
chroot /mnt

谢谢你。

更新

 modprobe filter
modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.8.15/modules.dep.bin'
modprobe: FATAL: Module filter not found in directory /lib/modules/4.8.15

更新

日志

Jan 30 02:39:34 HOSTNAME sshd[6483]: refused connect from 112.85.42.18 (112.85.42.18)
Jan 30 02:40:18 HOSTNAME sshd[6495]: warning: /etc/hosts.deny, line 64: missing newline or line too long
Jan 30 02:40:18 HOSTNAME sshd[6495]: warning: /etc/hosts.deny, line 64: all the subsequent rules will be ignored
Jan 30 02:40:18 HOSTNAME sshd[6495]: refused connect from 112.85.42.18 (112.85.42.18)
Jan 30 02:40:57 HOSTNAME sshd[6504]: warning: /etc/hosts.deny, line 64: missing newline or line too long
Jan 30 02:40:57 HOSTNAME sshd[6504]: warning: /etc/hosts.deny, line 64: all the subsequent rules will be ignored
Jan 30 02:40:57 HOSTNAME sshd[6504]: refused connect from 112.85.42.18 (112.85.42.18)
Jan 30 02:41:37 HOSTNAME sshd[6519]: warning: /etc/hosts.deny, line 64: missing newline or line too long
Jan 30 02:41:37 HOSTNAME sshd[6519]: warning: /etc/hosts.deny, line 64: all the subsequent rules will be ignored
Jan 30 02:41:37 HOSTNAME sshd[6519]: refused connect from 112.85.42.18 (112.85.42.18)
linux networking bash ssh denyhosts
  • 1 个回答
  • 169 Views
Martin Hope
spiffytech
Asked: 2010-04-03 17:07:49 +0800 CST

Denyhosts vs fail2ban vs iptables - 防止暴力登录的最佳方法?

  • 65

我正在设置 LAMP 服务器,需要阻止 SSH/FTP/等。暴力登录尝试成功。我已经看到很多关于拒绝主机和 fail2ban 的建议,但很少对两者进行比较。我还读到 IPTables 规则可以填充相同的功能。

为什么我会选择其中一种方法而不是另一种?serverfault上的人如何处理这个问题?

iptables brute-force-attacks denyhosts fail2ban
  • 11 个回答
  • 63181 Views
Martin Hope
grieve
Asked: 2009-06-04 06:33:30 +0800 CST

如何防止拒绝主机一遍又一遍地将同一主机添加到被拒绝的文件中

  • 1

我在我的 FreeBSD (6.2) 机器上使用denyhosts,一切似乎都工作正常,除了denyhosts 不断向我的拒绝文件中添加相同的 4 个主机。

eli18.internetdsl.tpnet.pl
mx-int.rundblick.de
vmnepo05.deri.ie
v29051.1blu.de

有没有其他人看到过这个,或者更好地知道如何解决它?我对此进行了谷歌搜索,但没有找到任何答案。一个人有类似的问题,但没有解决方案。

编辑:

只是为了澄清一下,我目前已将拒绝主机配置为将所有被拒绝的主机写入 /etc/hosts.deniedssh,而我的 /etc/hosts.allow 在规则中使用该文件来拒绝访问该文件中的所有主机。Denyhosts 出于某种原因不断将相同的四个主机添加到 hosts.deniedssh

编辑 2: 这是我的 denyhosts.conf 文件的相关部分

# Mandrake, FreeBSD or OpenBSD:
SECURE_LOG = /var/log/auth.log
# Most operating systems:
HOSTS_DENY = /etc/hosts.deniedssh
#######################################################################
#
# WORK_DIR: the path that DenyHosts will use for writing data to
# (it will be created if it does not already exist).
#
# Note: it is recommended that you use an absolute pathname
# for this value (eg. /home/foo/denyhosts/data)
#
WORK_DIR = /usr/local/share/denyhosts/data

此外,在我的 /var/log/auth.log 文件中找不到这四个主机(至少不是最新的)。

ssh freebsd denyhosts
  • 4 个回答
  • 1525 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve