Ubuntu系统denyhosts的使用

news2025/2/23 23:33:44

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档

文章目录

  • 前言
  • 一、denyhosts是什么?
  • 二、安装denyhosts
    • 1.下载安装包
    • 2.安装
    • 3.配置
    • 4.启动
    • 5.测试
  • 总结


前言

今天服务器又被攻击了,防火墙也打开了,由于服务器需要对外提供服务,避免不了开放几个外部端口,所以增强防护才是王道。翻开/var/log/auth.log的日志发现很多外国的ip再请求我的端口,庆幸的是都被拒绝掉了,这应该是反复实验端口并试图找到漏洞。我准备增加denyhosts的服务,自动将一些外部攻击给加到黑名单里面。


一、denyhosts是什么?

DenyHosts has been developed by Phil Schwartz.
The idea of denying access to SSH servers is nothing new and I was inspired by many other scripts that I discovered. However, none of them did things the way I envisioned them to. Also, they were all shell scripts which do not offer the elegance of Python.

Denyhosts provides SSH attack prevention and is used by thousands of users worldwide. You can view DenyHosts synchronization stats.

看不懂没关系,简而言之它就是一个保护你的电脑防止侵害的工具,自动扫描外部攻击并将ip加到拒绝访问里面去。

二、安装denyhosts

现在官网已经推出了3.0版本,所以这篇文章基于denyhosts-3.0版本配置,2.0版本可能有一定的差别,请自行研究安装。

1.下载安装包

Ubuntu官方是没有denyhost的deb包的,我们需要到denyhosts的官网下载压缩包并自行安装。
denyhosts官网连接

点进去之后找到左上角的Download并点进去
在这里插入图片描述
会进入一个下载网站,点击下载即可,压缩包很小,才70kb左右。或者一步到位直接点下面的网址连接:压缩包下载链接

之所以导航到官网是因为官网里面有详细的配置可以看,denyhosts的配置项相当多,最好确认之后再打开,否则可能会导致服务器登录不了的情况。

2.安装

安装目前可以确定再Ubuntu-18和Ubuntu-20是行的,其他的暂未测试。

你下载的软件版本可能不是3.0,安装方法一样的。

unzip denyhosts-3.0.zip
cd denyhosts-3.0
sudo python setup.py install

等待安装结束,一定要使用sudo权限,将denyhosts保护起来,防止本身被破坏。

3.配置

配置才是重头戏,因为是全英文的,可以搭配谷歌翻译看下。
每一项都要认真看,不懂得就按默认配置来,不要随意打开(去掉#注释)
下面列出几个重要得配置供参考:

       ############ THESE SETTINGS ARE REQUIRED ############

########################################################################
#
# SECURE_LOG: the log file that contains sshd logging info
# if you are not sure, grep "sshd:" /var/log/*
#
# The file to process can be overridden with the --file command line
# argument
#
# Redhat or Fedora Core:
#SECURE_LOG = /var/log/secure
#
# Mandrake, FreeBSD or OpenBSD:
#SECURE_LOG = /var/log/auth.log
#
# SuSE or Gentoo:
#SECURE_LOG = /var/log/messages
#
# Mac OS X (v10.4 or greater -
#   also refer to:   http://www.denyhost.net/faq.html#macos
#SECURE_LOG = /private/var/log/asl.log
#
# Mac OS X (v10.3 or earlier):
#SECURE_LOG=/private/var/log/system.log
#
# Debian and Ubuntu
SECURE_LOG = /var/log/auth.log #Ubuntu保存认证的日志文件,保持默认
########################################################################

########################################################################
#
# HOSTS_DENY: the file which contains restricted host access information
#
# Most operating systems:
HOSTS_DENY = /etc/hosts.deny #写入禁止hosts名录的位置,保持默认
#
# Some BSD (FreeBSD) Unixes:
#HOSTS_DENY = /etc/hosts.allow
#
# Another possibility (also see the next option):
#HOSTS_DENY = /etc/hosts.evil
#######################################################################


########################################################################
#
# PURGE_DENY: removed HOSTS_DENY entries that are older than this time
#             when DenyHosts is invoked with the --purge flag
#
#      format is: i[dhwmy]
#      Where 'i' is an integer (eg. 7)
#            'm' = minutes
#            'h' = hours
#            'd' = days
#            'w' = weeks
#            'y' = years
#
# never purge:
PURGE_DENY = 1h #禁止这个hosts多长时间,超过时间解除禁止,上面的是单位,按照需要配置
#
# purge entries older than 1 week
#PURGE_DENY = 1w #未打开,可选项1星期
#
# purge entries older than 5 days
#PURGE_DENY = 5d #未打开,可选项5天
#######################################################################

#######################################################################
#
# PURGE_THRESHOLD: defines the maximum times a host will be purged.
# Once this value has been exceeded then this host will not be purged.
# Setting this parameter to 0 (the default) disables this feature.
#
# default: a denied host can be purged/re-added indefinitely
#PURGE_THRESHOLD = 0
#
# a denied host will be purged at most 2 times.
#PURGE_THRESHOLD = 2
#
# a denied host will be purged at most 3 times.
PURGE_THRESHOLD = 3 # 事不过3,对于解除禁止的hosts有几次解除机会,超过这个次数永久禁止
#
#######################################################################


#######################################################################
#
# BLOCK_SERVICE: the service name that should be blocked in HOSTS_DENY
#
# man 5 hosts_access for details
#
# eg.   sshd: 127.0.0.1  # will block sshd logins from 127.0.0.1
#
# To block all services for the offending host:
#BLOCK_SERVICE = ALL
# To block only sshd:
BLOCK_SERVICE  = sshd # 禁止的服务,意思是监控sshd的行为
# To only record the offending host and nothing else (if using
# an auxilary file to list the hosts).  Refer to:
# http://denyhost.sourceforge.net/faq.html#aux
#BLOCK_SERVICE =
#
#######################################################################


#######################################################################
#
# DENY_THRESHOLD_INVALID: block each host after the number of failed login
# attempts has exceeded this value.  This value applies to invalid
# user login attempts (eg. non-existent user accounts)
#
DENY_THRESHOLD_INVALID = 3 # 允许无效用户登陆失败的次数
#
#######################################################################

#######################################################################
#
# DENY_THRESHOLD_VALID: block each host after the number of failed
# login attempts has exceeded this value.  This value applies to valid
# user login attempts (eg. user accounts that exist in /etc/passwd) except
# for the "root" user
#
DENY_THRESHOLD_VALID = 5 # 允许普通用户登录失败的次数
#
#######################################################################

#######################################################################
#
# DENY_THRESHOLD_ROOT: block each host after the number of failed
# login attempts has exceeded this value.  This value applies to
# "root" user login attempts only.
#
DENY_THRESHOLD_ROOT = 2 # 允许root用户登录失败的次数
#
#######################################################################


#######################################################################
#
# DENY_THRESHOLD_RESTRICTED: block each host after the number of failed
# login attempts has exceeded this value.  This value applies to
# usernames that appear in the WORK_DIR/restricted-usernames file only.
#
DENY_THRESHOLD_RESTRICTED = 1
#
#######################################################################


#######################################################################
#
# 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/denyhost/data)
#
WORK_DIR = /var/lib/denyhosts # 工作目录,维持默认
#
#######################################################################

#######################################################################
#
# ETC_DIR: the path that DenyHosts will use for reading data when
# we need configuration information.
#
# Note: it is recommended that you use an absolute pathname
# for this value (eg. /etc or /usr/local/etc)
#
ETC_DIR = /etc # 维持默认
#
#######################################################################



#######################################################################
#
# SUSPICIOUS_LOGIN_REPORT_ALLOWED_HOSTS
#
# SUSPICIOUS_LOGIN_REPORT_ALLOWED_HOSTS=YES|NO
# If set to YES, if a suspicious login attempt results from an allowed-host
# then it is considered suspicious.  If this is NO, then suspicious logins
# from allowed-hosts will not be reported.  All suspicious logins from
# ip addresses that are not in allowed-hosts will always be reported.
#
SUSPICIOUS_LOGIN_REPORT_ALLOWED_HOSTS=YES 
######################################################################

######################################################################
#
# HOSTNAME_LOOKUP
#
# HOSTNAME_LOOKUP=YES|NO
# If set to YES, for each IP address that is reported by Denyhosts,
# the corresponding hostname will be looked up and reported as well
# (if available).
#
HOSTNAME_LOOKUP=NO # 域名反解
#
######################################################################


######################################################################
#
# LOCK_FILE
#
# LOCK_FILE=/path/denyhosts
# If this file exists when DenyHosts is run, then DenyHosts will exit
# immediately.  Otherwise, this file will be created upon invocation
# and deleted upon exit.  This ensures that only one instance is
# running at a time.
#
# Redhat/Fedora:
#LOCK_FILE = /var/lock/subsys/denyhosts
#
# Debian or Gentoo
LOCK_FILE = /var/run/denyhosts.pid # pid文件,维持默认
#
# Misc
#LOCK_FILE = /tmp/denyhosts.lock
#
######################################################################


       ############ THESE SETTINGS ARE OPTIONAL ############


#######################################################################
#
# IPTABLES: if you would like DenyHost to block incoming connections
# using the Linux firewall IPTABLES, then set the following variable
# to the path of the iptables executable. Typically this is
# /sbin/iptables
# If this option is not set or commented out then the iptables
# firewall is not used.
IPTABLES = /sbin/iptables # 防火墙前端程序,维持默认
#
# Warning: If you are running IPTABLES, please make sure to comment
# out the PFCTL_PATH and the PF_TABLE variables below. PF and
# IPTABLES should not be running together on the same operating system.
#
# By default DenyHost will ask IPTables to block incoming connections
# from an aggressive host on ALL ports. While this is usually a good
# idea, it may prevent some botted machines from being able to access
# services their legitmate users want, like a web server. To only
# block specific ports, enable the following option.
# BLOCKPORT = 22
#
#######################################################################

#######################################################################
#
# On FreeBSD/OpenBSD/TrueOS/PC-BSD/NetBSD/OS X we may want to block incoming
# traffic using the PF firewall instead of the hosts.deny file
# (aka tcp_wrapper).
# The admin can set up a PF table that is persistent
# and DenyHost can add new addresses to be blocked to that table.
# The TrueOS operating system enables this by default, blocking
# all addresses in the "blacklist" table.
#
# To have DenyHost update the blocking PF table in real time, uncomment
# these next two options. Make sure the table name specificed
# is one created in the pf.conf file of your operating system.
# The PFCTL_PATH variable must point to the pfctl extectuable on your OS.
# PFCTL_PATH = /sbin/pfctl
# PF_TABLE = blacklist
# Note, a good rule to have in your pf.conf file to enable the
# blacklist table is:
#
# table <blacklist> persist file "/etc/blacklist"
# block in quick from <blacklist> to any
#
# Warning: If you are using PF, please make sure to disable the
# IPTABLES rule above as these two packet filters should not be
# run together on the same operating system.
# Note: Even if you decide to run DenyHost with PF filtering
# only and no hosts.deny support, please still create an empty
# file called /etc/hosts.deny for backward compatibility.
# Also, please make sure PF is enabled prior to launching
# DenyHosts. To do this run "pfctl -e".
#
# To write all blocked hosts to a PF table file enable this next option.
# This will make hosts added to the PF table persistent across reboots.
# PF_TABLE_FILE = /etc/blacklist
#
#######################################################################


#######################################################################
#
# ADMIN_EMAIL: if you would like to receive emails regarding newly
# restricted hosts and suspicious logins, set this address to
# match your email address.  If you do not want to receive these reports
# leave this field blank (or run with the --noemail option)
#
# Multiple email addresses can be delimited by a comma, eg:
# ADMIN_EMAIL = foo@bar.com, bar@foo.com, etc@foobar.com
#
ADMIN_EMAIL = root@localhost # 给管理员发邮件,有需要改,可能需要配置邮件服务
#
#######################################################################

#######################################################################
#
# SMTP_HOST and SMTP_PORT: if DenyHosts is configured to email
# reports (see ADMIN_EMAIL) then these settings specify the
# email server address (SMTP_HOST) and the server port (SMTP_PORT)
#
#
SMTP_HOST = localhost # 邮件相关 host,按照需要配置或维持默认
SMTP_PORT = 25 # 邮件相关 port,按照需要配置或维持默认
#
#######################################################################

#######################################################################
#
# SMTP_USERNAME and SMTP_PASSWORD: set these parameters if your
# smtp email server requires authentication
#
#SMTP_USERNAME=foo # 邮件相关,按照需要配置或维持默认
#SMTP_PASSWORD=bar # 邮件相关,按照需要配置或维持默认
#
######################################################################

#######################################################################
#
# SMTP_FROM: you can specify the "From:" address in messages sent
# from DenyHosts when it reports thwarted abuse attempts
#
SMTP_FROM = DenyHosts <nobody@localhost> # 邮件相关,按照需要配置或维持默认
#
#######################################################################

#######################################################################
#
# SMTP_SUBJECT: you can specify the "Subject:" of messages sent
# by DenyHosts when it reports thwarted abuse attempts
SMTP_SUBJECT = DenyHosts Report # 邮件相关,按照需要配置或维持默认
#
######################################################################

######################################################################
#
# SMTP_DATE_FORMAT: specifies the format used for the "Date:" header
# when sending email messages.
#
# for possible values for this parameter refer to: man strftime
#
# the default:
#
#SMTP_DATE_FORMAT = %a, %d %b %Y %H:%M:%S %z # 邮件相关,按照需要配置或维持默认
#
######################################################################

######################################################################
#
# SYSLOG_REPORT
#
# SYSLOG_REPORT=YES|NO # 是否将事件记录到syslog,denyhosts本身有日志,维持默认
# If set to yes, when denied hosts are recorded the report data
# will be sent to syslog (syslog must be present on your system).
# The default is: NO
#
#SYSLOG_REPORT=NO
#
#SYSLOG_REPORT=YES
#
######################################################################

######################################################################
#
# ALLOWED_HOSTS_HOSTNAME_LOOKUP
#
# ALLOWED_HOSTS_HOSTNAME_LOOKUP=YES|NO
# If set to YES, for each entry in the WORK_DIR/allowed-hosts file,
# the hostname will be looked up.  If your versions of tcp_wrappers
# and sshd sometimes log hostnames in addition to ip addresses
# then you may wish to specify this option.
#
ALLOWED_HOSTS_HOSTNAME_LOOKUP=NO # 维持原样
#
######################################################################

######################################################################
#
# AGE_RESET_VALID: Specifies the period of time between failed login
# attempts that, when exceeded will result in the failed count for
# this host to be reset to 0.  This value applies to login attempts
# to all valid users (those within /etc/passwd) with the
# exception of root.  If not defined, this count will never
# be reset.
#
# See the comments in the PURGE_DENY section (above)
# for details on specifying this value or for complete details
# refer to:  http://denyhost.sourceforge.net/faq.html#timespec
#
AGE_RESET_VALID=5d # 维持原样
#
######################################################################

######################################################################
#
# AGE_RESET_ROOT: Specifies the period of time between failed login
# attempts that, when exceeded will result in the failed count for
# this host to be reset to 0.  This value applies to all login
# attempts to the "root" user account.  If not defined,
# this count will never be reset.
#
# See the comments in the PURGE_DENY section (above)
# for details on specifying this value or for complete details
# refer to:  http://denyhost.sourceforge.net/faq.html#timespec
#
AGE_RESET_ROOT=25d # 维持原样
#
######################################################################

######################################################################
#
# AGE_RESET_RESTRICTED: Specifies the period of time between failed login
# attempts that, when exceeded will result in the failed count for
# this host to be reset to 0.  This value applies to all login
# attempts to entries found in the WORK_DIR/restricted-usernames file.
# If not defined, the count will never be reset.
#
# See the comments in the PURGE_DENY section (above)
# for details on specifying this value or for complete details
# refer to:  http://denyhost.sourceforge.net/faq.html#timespec
#
AGE_RESET_RESTRICTED=25d # 维持原样
#
######################################################################


######################################################################
#
# AGE_RESET_INVALID: Specifies the period of time between failed login
# attempts that, when exceeded will result in the failed count for
# this host to be reset to 0.  This value applies to login attempts
# made to any invalid username (those that do not appear
# in /etc/passwd).  If not defined, count will never be reset.
#
# See the comments in the PURGE_DENY section (above)
# for details on specifying this value or for complete details
# refer to:  http://denyhost.sourceforge.net/faq.html#timespec
#
AGE_RESET_INVALID=10d # 维持原样
#
######################################################################


######################################################################
#
# RESET_ON_SUCCESS: If this parameter is set to "yes" then the
# failed count for the respective ip address will be reset to 0
# if the login is successful.
#
# The default is RESET_ON_SUCCESS = no
#
#RESET_ON_SUCCESS = yes
#
#####################################################################


######################################################################
#
# PLUGIN_DENY: If set, this value should point to an executable
# program that will be invoked when a host is added to the
# HOSTS_DENY file.  This executable will be passed the host
# that will be added as its only argument.
#
#PLUGIN_DENY=/usr/bin/true
#
######################################################################


######################################################################
#
# PLUGIN_PURGE: If set, this value should point to an executable
# program that will be invoked when a host is removed from the
# HOSTS_DENY file.  This executable will be passed the host
# that is to be purged as it's only argument.
#
#PLUGIN_PURGE=/usr/bin/true
#
######################################################################

######################################################################
#
# USERDEF_FAILED_ENTRY_REGEX: if set, this value should contain
# a regular expression that can be used to identify additional
# hackers for your particular ssh configuration.  This functionality
# extends the built-in regular expressions that DenyHosts uses.
# This parameter can be specified multiple times.
# See this faq entry for more details:
#    http://denyhost.sf.net/faq.html#userdef_regex
#
#USERDEF_FAILED_ENTRY_REGEX=
#
#
######################################################################




   ######### THESE SETTINGS ARE SPECIFIC TO DAEMON MODE  ##########



#######################################################################
#
# DAEMON_LOG: when DenyHosts is run in daemon mode (--daemon flag)
# this is the logfile that DenyHosts uses to report its status.
# To disable logging, leave blank.  (default is: /var/log/denyhosts)
#
DAEMON_LOG = /var/log/denyhosts # denyhosts的事件日志
#
# disable logging:
#DAEMON_LOG =
#
######################################################################

#######################################################################
#
# DAEMON_LOG_TIME_FORMAT: when DenyHosts is run in daemon mode
# (--daemon flag) this specifies the timestamp format of
# the DAEMON_LOG messages (default is the ISO8061 format:
# ie. 2005-07-22 10:38:01,745)
#
# for possible values for this parameter refer to: man strftime
#
# Jan 1 13:05:59
#DAEMON_LOG_TIME_FORMAT = %b %d %H:%M:%S
#
# Jan 1 01:05:59
#DAEMON_LOG_TIME_FORMAT = %b %d %I:%M:%S
#
######################################################################

#######################################################################
#
# DAEMON_LOG_MESSAGE_FORMAT: when DenyHosts is run in daemon mode
# (--daemon flag) this specifies the message format of each logged
# entry.  By default the following format is used:
#
# %(asctime)s - %(name)-12s: %(levelname)-8s %(message)s
#
# Where the "%(asctime)s" portion is expanded to the format
# defined by DAEMON_LOG_TIME_FORMAT
#
# This string is passed to python's logging.Formatter contstuctor.
# For details on the possible format types please refer to:
# http://docs.python.org/lib/node357.html
#
# This is the default:
#DAEMON_LOG_MESSAGE_FORMAT = %(asctime)s - %(name)-12s: %(levelname)-8s %(message)s
#
#
######################################################################


#######################################################################
#
# DAEMON_SLEEP: when DenyHosts is run in daemon mode (--daemon flag)
# this is the amount of time DenyHosts will sleep between polling
# the SECURE_LOG.  See the comments in the PURGE_DENY section (above)
# for details on specifying this value or for complete details
# refer to:    http://denyhost.sourceforge.net/faq.html#timespec
#
#
DAEMON_SLEEP = 30s # 拉取安全日志的时间间隔
#
#######################################################################

#######################################################################
#
# DAEMON_PURGE: How often should DenyHosts, when run in daemon mode,
# run the purge mechanism to expire old entries in HOSTS_DENY
# This has no effect if PURGE_DENY is blank.
#
DAEMON_PURGE = 1h # 多长时间检测一次应当从黑名单剔除的host
#
#######################################################################


   #########   THESE SETTINGS ARE SPECIFIC TO     ##########
   #########       DAEMON SYNCHRONIZATION         ##########


#######################################################################
#
# Synchronization mode allows the DenyHosts daemon the ability
# to periodically send and receive denied host data such that
# DenyHosts daemons worldwide can automatically inform one
# another regarding banned hosts.   This mode is disabled by
# default, you must uncomment SYNC_SERVER to enable this mode.
#
# for more information, please refer to:
#        http:/denyhost.sourceforge.net/faq.html
#
#######################################################################


#######################################################################
#
# SYNC_SERVER: The central server that communicates with DenyHost
# daemons.
#
# To disable synchronization (the default), do nothing.
#
# To enable synchronization, you must uncomment the following line:
#SYNC_SERVER = http://xmlrpc.denyhosts.net:9911
#
#######################################################################

#######################################################################
#
# SYNC_INTERVAL: the interval of time to perform synchronizations if
# SYNC_SERVER has been uncommented.  The default is 1 hour.
#
#SYNC_INTERVAL = 1h
#
#######################################################################


#######################################################################
#
# SYNC_UPLOAD: allow your DenyHosts daemon to transmit hosts that have
# been denied?  This option only applies if SYNC_SERVER has
# been uncommented.
# The default is SYNC_UPLOAD = yes
#
SYNC_UPLOAD = no # 上传被禁止的host名录到服务器,需要先配置服务器
#SYNC_UPLOAD = yes
#
#######################################################################


#######################################################################
#
# SYNC_DOWNLOAD: allow your DenyHosts daemon to receive hosts that have
# been denied by others?  This option only applies if SYNC_SERVER has
# been uncommented.
# The default is SYNC_DOWNLOAD = yes
#
SYNC_DOWNLOAD = no # 和upload反过来,意思是从其它服务器下载禁止名录
#SYNC_DOWNLOAD = yes
#
#
#
#######################################################################

#######################################################################
#
# SYNC_DOWNLOAD_THRESHOLD: If SYNC_DOWNLOAD is enabled this parameter
# filters the returned hosts to those that have been blocked this many
# times by others.  That is, if set to 1, then if a single DenyHosts
# server has denied an ip address then you will receive the denied host.
#
# See also SYNC_DOWNLOAD_RESILIENCY
#
#SYNC_DOWNLOAD_THRESHOLD = 10
#
# The default is SYNC_DOWNLOAD_THRESHOLD = 3
#
#SYNC_DOWNLOAD_THRESHOLD = 3
#
#######################################################################

#######################################################################
#
# SYNC_DOWNLOAD_RESILIENCY:  If SYNC_DOWNLOAD is enabled then the
# value specified for this option limits the downloaded data
# to this resiliency period or greater.
#
# Resiliency is defined as the timespan between a hackers first known
# attack and its most recent attack.  Example:
#
# If the centralized  denyhosts.net server records an attack at 2 PM
# and then again at 5 PM, specifying a SYNC_DOWNLOAD_RESILIENCY = 4h
# will not download this ip address.
#
# However, if the attacker is recorded again at 6:15 PM then the
# ip address will be downloaded by your DenyHosts instance.
#
# This value is used in conjunction with the SYNC_DOWNLOAD_THRESHOLD
# and only hosts that satisfy both values will be downloaded.
# This value has no effect if SYNC_DOWNLOAD_THRESHOLD = 1
#
# The default is SYNC_DOWNLOAD_RESILIENCY = 5h (5 hours)
#
# Only obtain hackers that have been at it for 2 days or more:
#SYNC_DOWNLOAD_RESILIENCY = 2d
#
# Only obtain hackers that have been at it for 5 hours or more:
#SYNC_DOWNLOAD_RESILIENCY = 5h
#
#######################################################################

其实,光前面的参数就够了,后面的属于高级范畴了,有时间可以多研究下。

4.启动

denyhosts服务每次启动会读取/etc/denyhosts.conf里面的配置,启动方式也比较简单。

sudo daemon-control-dist start

等待启动成功,如果报了找不到/usr/sbin/denyhosts的话,执行下面的命令:

sudo ln -s /usr/local/bin/denyhosts.py /usr/sbin/denyhosts
sudo daemon-control-dist start

这下就没有问题了,成功启动。一定要以root用户启动,否则权限不够!

5.测试

我的机器打开了防火墙,所以我找了一台机器去故意输错密码,尝试了3次以后denyhosts会把这个ip禁止掉(分别在iptables创建一个DROP规则和加入到/etc/hosts.deny名录里),至此你这个ip就不能访问ssh了,直到超时解除禁止。

特别注意,denyhosts有一定的后效性,就是反应没有那么快,它是定期轮询SECURE文件来添加禁用规则。


总结

1、总体没那么难,不明白的设置就维持默认
2、有问题的可以评论,我会看到邮件

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/619426.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

劝退忠告:外包实在是太坑了,划水三年,感觉人都废了

先说一下自己的情况&#xff0c;专科生&#xff0c;19年通过校招进入杭州某个外包软件公司&#xff0c;干了接近3年的功能测试&#xff0c;今年年初&#xff0c;感觉自己不能够在这样下去了&#xff0c;长时间呆在一个舒适的环境会让一个人堕落! 而我已经在一个企业干了3年的功…

Linux使用者必备-13款厉害到让人怒赞的工具大揭秘

本文介绍几款 Linux 运维比较实用的工具&#xff0c;希望对 Linux 管理员有所帮助。 1、查看进程占用带宽情况-Nethogs Nethogs 是一个终端下的网络流量监控工具可以直观的显示每个进程占用的带宽。 下载&#xff1a;http://sourceforge.net/projects/nethogs/files/nethogs…

【MVS+DepthFilter】video-based real-time multi view stereo

1.SVO 半直接视觉里程计 2. SVO2系列之深度滤波DepthFilter 3. SVO&#xff08;SVO: fast semi-direct monocular visual odometry&#xff09; 4. svo_note 5. MVSDepthFilter: video-based real-time multi view stereo 6. 作者George Vogiatzis主页 video-based real-time m…

Java版Spring cloud 企业电子招投标系统源码

一、立项管理 1、招标立项申请 功能点&#xff1a;招标类项目立项申请入口&#xff0c;用户可以保存为草稿&#xff0c;提交。 2、非招标立项申请 功能点&#xff1a;非招标立项申请入口、用户可以保存为草稿、提交。 3、采购立项列表 功能点&#xff1a;对草稿进行编辑&#x…

Pytorch版本的Ernie Health源码详解

Pytorch版本的Ernie Health源码详解 一、目录架构 二、尝试使用Ernie Health import torch # 查看torch版本 torch.__version__ 1.12.0cpu# 查看设备是否有GPU资源 # device torch.device(cuda:0 if torch.cuda.is_available() else cpu) device cuda if torch.cuda.is_ava…

I.MX6ULL_Linux_驱动篇(37) linux系统定时器

定时器是我们最常用到的功能&#xff0c;一般用来完成定时功能&#xff0c;本章我们就来学习一下 Linux 内核提供的定时器 API 函数&#xff0c;通过这些定时器 API 函数我们可以完成很多要求定时的应用。 Linux内核也提供了短延时函数&#xff0c;比如微秒、纳秒、毫秒延时函数…

Python selenium爬取影评生成词云图

文章目录 问题描述效果截图如下问题分析前期准备完整代码及解释字体素材 问题描述 通过中文分词、过滤停用词、生成词云图等步骤对评论数据进行处理和可视化。 效果截图如下 非常nice 问题分析 该程序需要使用 Selenium 库来模拟浏览器操作&#xff0c;因此需要下载安装 Chr…

@Autowired VS @Resource

一、两者的区别 首先&#xff0c;两者都是通过注解来实现依赖注入 。不同的话有以下几点&#xff1a; Autowired 是 Spring 提供的注解&#xff0c;所以只有 Spring 的 IoC容器 支持该注解。Resource 是 JSR-250 提供的&#xff08;是 Java 的标准 &#xff09;&#xff0c;我…

CnOpenData·A股上市公司标准数据

一、数据简介 按照《中华人民共和国标准化法》的定义&#xff0c;标准是指农业、工业、服务业以及社会事业等领域需要统一的技术要求。标准作为一种通用性的规范语言&#xff0c;在合理利用国家资源、保障产品质量、提高市场信任度、促进商品流通、维护公平竞争、保障安全等方面…

Hash算法的特点、应用和实现方法详解

什么是Hash算法&#xff1f;Hash算法&#xff0c;简称散列算法&#xff0c;也成哈希算法&#xff08;英译&#xff09;&#xff0c;是将一个大文件映射成一个小串字符。与指纹一样&#xff0c;就是以较短的信息来保证文件的唯一性的标志&#xff0c;这种标志与文件的每一个字节…

企业数字化转型必看的6本书

导读 >> 2023年数据产业将为企业带来新的价值增量&#xff0c;成为企业数字化转型的重要突破口。数字化已经成为商业的一种基本常识&#xff0c;未来企业都将是数字化企业。然而在数字化转型话题热议的当下&#xff0c;真正成果显著的企业仍是少数&#xff0c;2023年企业…

如何阻止Windows Update更新Windows 10中的特定设备驱动程序

如果你想禁用Windows 10驱动程序的自动更新,那么方法有的是,但是如果你想禁用特定设备的驱动程序更新,该怎么办呢? 幸运的是,有一种替代方法可以禁用特定设备的驱动程序更新。你可以通过设置组策略“禁止安装与这些设备ID匹配的设备”来实现这一点。 根据微软的说法: …

在简历上写了“精通”后,我差点被面试官问到窒息....

前言 如果有真才实学&#xff0c;写个精通可以让面试官眼前一亮&#xff01; 如果是瞎写&#xff1f;基本就要被狠狠地虐一把里&#xff01; 最近在面试&#xff0c;我现在十分后悔在简历上写了“精通”二字… 先给大家看看我简历上的技能列表&#xff1a; 熟悉软件测试理…

阿里云服务器25565端口开通教程(ECS和轻量)

阿里云服务器25565端口怎么开通&#xff1f;ECS云服务器端口在安全组中开启&#xff0c;轻量应用服务器端口在防火墙中打开&#xff0c;我的世界mc服务器依赖25565端口&#xff0c;阿里云服务器网来详细说下云服务器ECS和轻量应用服务器开通25565端口的方法&#xff1a; 云服务…

学成在线项目note

目录 一、index.html 1、头部header 2、轮播图banner 3、精品推荐 4、精品推荐课程 5、footer 二、index.css 1、重要的代码 一、index.html <!-- 网站的首页, 所有网站的首页都叫index.html, 因为服务器找首页都是找index.html --> <!-- 布局: 从外到内, 从上到…

青岛科技大学|物联网工程|物联网定位技术(第三讲)|15:40

目录 物联网定位技术&#xff08;第三讲&#xff09; 1. 试简述C/A码的作用、构成 请画出C/A码生成电路简图并给予原理性的说明 2. 试简述 P码的作用、构成 请画出P码生成电路简图&#xff0c;并给予原理性的说明 3. GPS信号是如何进行伪码扩频与解扩 请画图给予说明 4…

Java的Object类和深拷贝和浅拷贝(面试题)

1.java.lang.Object类的说明 1.Object类是所有Java类的根父类 2.如果在类的声明中未使用extends关键字指明其父类&#xff0c;则默认父类为java.lang.Object类 3.Object类中的功能(属性、方法)就具通用性。 属性&#xff1a;无 方法&#xff1a;equals() / toString() / ge…

图片识别表格的方法有哪些?试试这几个好用的表格识别软件

随着数字化时代的到来&#xff0c;越来越多的公司和个人需要处理大量的表格数据。这些数据往往以图片的格式存在&#xff0c;而手动输入这些数据非常耗费时间和精力。因此&#xff0c;图片识别表格软件正在成为一个不可或缺的工具。那么&#xff0c;图片识别表格软件哪个好呢&a…

SAP从入门到放弃系列之CRP-Part1

从我学习CRP(Capacity Requirement planning)过程&#xff0c;应该能分三部分来总结。这篇就总结一下我学到的基本配置和概念。 温馨提示 &#xff1a;又臭又长的系统配置内容放在了最后的章节。本文分三个部分&#xff0c;工作中心数据和工艺路线创建&#xff0c;生产订单能力…

【Tomcat 部署及优化】

目录 一、Tomcat 安装部署1、Tomcat 介绍2、Tomcat 核心组件1、Tomcat 功能组件结构&#xff1a;2、Container 结构分析&#xff1a; 3、Tomcat 请求过程&#xff1a; 二、Tomcat 服务部署1.关闭防火墙&#xff0c;将安装 Tomcat 所需软件包传到/opt目录下2.安装JDK3.设置JDK环…