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 / 问题 / 878543
Accepted
aye
aye
Asked: 2017-10-16 05:31:29 +0800 CST2017-10-16 05:31:29 +0800 CST 2017-10-16 05:31:29 +0800 CST

Centos 7 中 sshd 相关进程过多

  • 772

当我ps aux在我的 Centos 7 机器上运行命令时,我看到大约 100 个条目:

root     19862  0.0  0.0 151692     8 ?        Ss   Oct09   0:00 sshd: unknown [priv]
sshd     19864  0.0  0.0 105068     0 ?        S    Oct09   0:00 sshd: unknown [net]

我想问一下这是正常的,还是我的系统受到了某种ssh暴力攻击?

谢谢!

ssh
  • 2 2 个回答
  • 1772 Views

2 个回答

  • Voted
  1. Best Answer
    anx
    2017-10-16T12:08:06+08:002017-10-16T12:08:06+08:00

    是的,这很正常。sshd 为当前尝试进行身份验证的每个用户打开 2 个新进程。

    是的,这很可能表明有人试图向您的服务器进行身份验证,而这并不是故意的。如果没有,请查看您/var/log/auth.log应该将您指向网络中正在运行已弃用的 cron 脚本的服务器。

    经验法则:如果您担心有人可能闯入,那么问题不在于有人试图闯入!相反,请确保没有人会成功进行暴力破解。

    您可以按顺序调整 sshd 配置,并在一定程度上限制用于处理这些问题的系统资源。但是对于除了最薄的服务器之外的任何服务器,默认值都应该没问题,这真的不是什么大问题。

    # Disable unused authentication methods
    #  !! ONLY DISABLE PASSWORDS IF ALL USERS LOGIN USING KEYS !!
    PasswordAuthentication no
    
    # If the above is true, also limit the time users have to present
    #  their authentication
    # If theres no passwords typed, something <60 seconds is reasonable
    #  !! DO NOT SET TOO LOW! USERS MAY STILL NEED TO UNLOCK THEIR KEY/CARD !!
    LoginGraceTime 120
    
    # Limit how many times a user can attempt to authenticate
    #  !! Users who initially try the wrong key or invalid method will
    #  !! first need to configure their ssh client properly
    #  !! else they will be locked out if this is too low!
    MaxAuthTries 6
    
    # Limit the number of concurrently authenticating users
    # start not accepting some connections if there are already 10 clients
    # stop accepting any connections if there are already 100 clients
    #  !! one may even argue leaving this high is helpful, because
    #  !! an attacker needs more resources to prevent legitimate connections
    MaxStartups 10:30:100
    

    您还可以将您的 ssh 移动到另一个端口,这将大大限制尝试的人数。我不建议这样做。它不会提高安全性,而且会使事情变得更加复杂。

    • 3
  2. cstamas
    2017-10-16T13:12:34+08:002017-10-16T13:12:34+08:00

    首先,我同意@anx 所说的。

    要添加的一些东西(我做的事情):

    • 为方便起见,可以使用 fail2ban 来解析日志文件并阻止暴力攻击。这不会增加安全性,但会减少日志中的噪音。
    • 为了提高安全性,请使用基于密钥的登录。
      • 为了更上一层楼,可以使用 openpgp 卡来存储密钥,这样它就不再是磁盘上可以被盗的文件了。(卡签名请求,但无法从卡中获取密钥。)
    • 不完全禁用基于密码的登录的折衷方案是添加第二因素身份验证。
      • 可以安装 google 验证器 pam 模块和 android 应用程序。它可以设置为在登录时除了输入密码外,还需要输入手机(或其他基于硬件的计算器软件)生成的号码。这是一个基于时间的令牌,因此如果加密检查成功,它会授予您登录权限。
    • 可以同时启用基于密钥的登录和第二因素身份验证。

    教程:如何在 centos 7 上安装 fail2ban

    • 1

相关问题

  • 如何最好地设置 ssh 隧道以访问远程网络 (Linux)

  • SSH 和重定向

  • 通过 SSH 会话使用 NET USER 命令拒绝访问

  • SSH 服务器零日漏洞利用 - 保护自己的建议

  • ubuntu apt-get upgrade - 如何在 shell 中单击确定?

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