Endlessh“无法启动 Endlessh SSH Tarpit”

Endlessh“无法启动 Endlessh SSH Tarpit”

我刚刚了解了 Endlessh 包,我已按照此视频中描述的步骤进行了安装。https://www.youtube.com/watch?v=SKhKNUo6rJU

但是当检查 Endlessh 是否正在监听端口 22 时什么也没有发生,然后,我检查了状态以查看它是否正在运行,但它没有运行,下面是我得到的结果:

xxxxxxxxx@localhost:~$ sudo systemctl status endlessh.service
● endlessh.service - Endlessh SSH Tarpit
     Loaded: loaded (/etc/systemd/system/endlessh.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Mon 2022-01-03 13:14:16 CET; 2min 32s ago
       Docs: man:endlessh(1)
    Process: 186607 ExecStart=/usr/local/bin/endlessh (code=exited, status=1/FAILURE)
   Main PID: 186607 (code=exited, status=1/FAILURE)

Jan 03 13:13:46 localhost systemd[1]: endlessh.service: Main process exited, code=exited, status=1/FAILURE
Jan 03 13:13:46 localhost systemd[1]: endlessh.service: Failed with result 'exit-code'.
Jan 03 13:14:16 localhost systemd[1]: endlessh.service: Scheduled restart job, restart counter is at 4.
Jan 03 13:14:16 localhost systemd[1]: Stopped Endlessh SSH Tarpit.
Jan 03 13:14:16 localhost systemd[1]: endlessh.service: Start request repeated too quickly.
Jan 03 13:14:16 localhost systemd[1]: endlessh.service: Failed with result 'exit-code'.
Jan 03 13:14:16 localhost systemd[1]: Failed to start Endlessh SSH Tarpit.
Jan 03 13:15:59 localhost systemd[1]: endlessh.service: Start request repeated too quickly.
Jan 03 13:15:59 localhost systemd[1]: endlessh.service: Failed with result 'exit-code'.
Jan 03 13:15:59 localhost systemd[1]: Failed to start Endlessh SSH Tarpit.

在寻找我的问题的进一步答案时,我在 skeeto/endlessh 的 github 上发现了这个: https://github.com/skeeto/endlessh/issues/39#issuecomment-727283671

我试过了,但重新启动 endlessh 时仍然得到相同的失败状态。我忘了说我在 endlessh 文件夹中创建了一个配置文件/etc/endlessh/config

# The port on which to listen for new SSH connections.
Port 22

# The endless banner is sent one line at a time. This is the delay
# in milliseconds between individual lines.
Delay 10000

# The length of each line is randomized. This controls the maximum
# length of each line. Shorter lines may keep clients on for longer if
# they give up after a certain number of bytes.
MaxLineLength 32

# Maximum number of connections to accept at a time. Connections beyond
# these are not immediately rejected but will wait in the queue.
MaxClients 4096

# Set the detail level for the log.
# 0 = Quiet
# 1 = Standard, useful log messages
# 2 = Very noisy debugging information
LogLevel 0

# Set the family of the listening socket
# 0 = Use IPv4 Mapped IPv6 (Both v4 and v6, default)
# 4 = Use IPv4 only
# 6 = Use IPv6 only
BindFamily 0

你知道哪里出了问题吗?我应该重启服务器吗?谢谢 :)

答案1

  • 找到您的endlessh.service文件(当然也可以/usr/lib/systemd/system/endlessh.service用其他方式使用find / -name endlessh.service
  • 取消注释该行AmbientCapabilities=CAP_NET_BIND_SERVICE
  • 替换InaccessiblePaths=/run /appInaccessiblePaths=
  • 替换PrivateUsers=truePrivateUsers=false
  • 跑步setcap 'cap_net_bind_service=+ep' `which endlessh`
  • 最后,重启守护进程systemctl daemon-reload && systemctl restart endlessh.service

正常情况下,它应该可以工作。

相关内容