<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>猫言猫语 &#187; SSH</title>
	<atom:link href="http://imcat.in/tag/ssh/feed/" rel="self" type="application/rss+xml" />
	<link>http://imcat.in</link>
	<description>人的头脑太复杂,时间过得久,有时候连自己也被自己骗了,记下来才是最真实的……</description>
	<lastBuildDate>Fri, 21 Oct 2011 17:55:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>安装denyhost防止SSH和FTP被暴力破解</title>
		<link>http://imcat.in/ssh-ftp-install-denyhost-revent-brute-force/</link>
		<comments>http://imcat.in/ssh-ftp-install-denyhost-revent-brute-force/#comments</comments>
		<pubDate>Tue, 19 Oct 2010 03:23:03 +0000</pubDate>
		<dc:creator>Cat.</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[denyhost]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[暴力破解]]></category>

		<guid isPermaLink="false">http://imcat.in/?p=1389</guid>
		<description><![CDATA[做人到低调啊,我其实很低调的嘛,不知道得罪了哪个人,我的SSH和FTP一直被人扫描,而且还是那种多线程的,导致我的SSH和FTP开启了多进程来应付它的暴力破解,无奈之下还有改了端口了. 不过这是治标不治本的啦,Google一翻,终于给我找到了这个软件DenyHosts,DenyHosts是用Python语言编写的一个程序,它会分析你的日志文件,当发现重复的错误登录时就会记录IP到/etc/hosts.deny文件,然后自动屏蔽IP.功能很不错吧,下面是安装过程 (环境CentOS 5.5, DenyHosts 2.6) 下载: wget http://imcat.in/down/DenyHosts-2.6.tar.gz 安装: tar -zxvf DenyHosts-2.6.tar.gz cd DenyHosts-2.6 python setup.py install 修改配置文件: cp /usr/share/denyhosts/denyhosts.cfg-dist /usr/share/denyhosts/denyhosts.cfg vi /usr/share/denyhosts/denyhosts.cfg 配置文件比较长,需要修改的,我都做了注释,自己看吧 ############ THESE SETTINGS ARE REQUIRED ############ ######################################################################## # # SECURE_LOG: the log file that contains sshd logging info # if you are not sure, grep &#34;sshd:&#34; /var/log/* # # The [...]]]></description>
			<content:encoded><![CDATA[<p>做人到低调啊,我其实很低调的嘛,不知道得罪了哪个人,我的SSH和FTP一直被人扫描,而且还是那种多线程的,导致我的SSH和FTP开启了多进程来应付它的暴力破解,无奈之下还有改了端口了.<br />
不过这是治标不治本的啦,Google一翻,终于给我找到了这个软件DenyHosts,DenyHosts是用Python语言编写的一个程序,它会分析你的日志文件,当发现重复的错误登录时就会记录IP到/etc/hosts.deny文件,然后自动屏蔽IP.功能很不错吧,下面是安装过程 (环境CentOS 5.5, DenyHosts 2.6)</p>
<p>下载:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">wget http://imcat.in/down/DenyHosts-2.6.tar.gz</div></div>
<p>安装:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tar -zxvf DenyHosts-2.6.tar.gz<br />
cd DenyHosts-2.6<br />
python setup.py install</div></div>
<p><span id="more-1389"></span><br />
修改配置文件:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">cp /usr/share/denyhosts/denyhosts.cfg-dist /usr/share/denyhosts/denyhosts.cfg<br />
vi /usr/share/denyhosts/denyhosts.cfg</div></div>
<p>配置文件比较长,需要修改的,我都做了注释,自己看吧</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">############ THESE SETTINGS ARE REQUIRED ############<br />
<br />
########################################################################<br />
#<br />
# SECURE_LOG: the log file that contains sshd logging info<br />
# if you are not sure, grep &quot;sshd:&quot; /var/log/*<br />
#<br />
# The file to process can be overridden with the --file command line<br />
# argument<br />
#<br />
# Redhat or Fedora Core:<br />
#日志文件,根据这个文件来判断<br />
SECURE_LOG = /var/log/secure<br />
#<br />
# Mandrake, FreeBSD or OpenBSD:<br />
#SECURE_LOG = /var/log/auth.log<br />
#<br />
# SuSE:<br />
#SECURE_LOG = /var/log/messages<br />
#<br />
# Mac OS X (v10.4 or greater -<br />
#   also refer to:   http://www.denyhosts.net/faq.html#macos<br />
#SECURE_LOG = /private/var/log/asl.log<br />
#<br />
# Mac OS X (v10.3 or earlier):<br />
#SECURE_LOG=/private/var/log/system.log<br />
#<br />
########################################################################<br />
<br />
########################################################################<br />
#<br />
# HOSTS_DENY: the file which contains restricted host access information<br />
#<br />
# Most operating systems:<br />
#记录屏蔽的IP文件<br />
HOSTS_DENY = /etc/hosts.deny<br />
#<br />
# Some BSD (FreeBSD) Unixes:<br />
#HOSTS_DENY = /etc/hosts.allow<br />
#<br />
# Another possibility (also see the next option):<br />
#HOSTS_DENY = /etc/hosts.evil<br />
#######################################################################<br />
<br />
########################################################################<br />
#<br />
# PURGE_DENY: removed HOSTS_DENY entries that are older than this time<br />
#             when DenyHosts is invoked with the --purge flag<br />
#<br />
#      format is: i[dhwmy]<br />
#      Where 'i' is an integer (eg. 7)<br />
#            'm' = minutes<br />
#            'h' = hours<br />
#            'd' = days<br />
#            'w' = weeks<br />
#            'y' = years<br />
#<br />
# never purge:<br />
#多久清除屏蔽的IP,我设置一天<br />
PURGE_DENY = 1d<br />
#<br />
# purge entries older than 1 week<br />
#PURGE_DENY = 1w<br />
#<br />
# purge entries older than 5 days<br />
#PURGE_DENY = 5d<br />
#######################################################################<br />
<br />
#######################################################################<br />
#<br />
# PURGE_THRESHOLD: defines the maximum times a host will be purged.<br />
# Once this value has been exceeded then this host will not be purged.<br />
# Setting this parameter to 0 (the default) disables this feature.<br />
#<br />
# default: a denied host can be purged/re-added indefinitely<br />
#PURGE_THRESHOLD = 0<br />
#<br />
# a denied host will be purged at most 2 times.<br />
#PURGE_THRESHOLD = 2<br />
#<br />
#######################################################################<br />
<br />
#######################################################################<br />
#<br />
# BLOCK_SERVICE: the service name that should be blocked in HOSTS_DENY<br />
#<br />
# man 5 hosts_access for details<br />
#<br />
# eg.   sshd: 127.0.0.1  # will block sshd logins from 127.0.0.1<br />
#<br />
# To block all services for the offending host:<br />
#BLOCK_SERVICE = ALL<br />
# To block only sshd:<br />
#禁止的服务,我设置为全部,禁止登录SSH和/FTP<br />
BLOCK_SERVICE  = ALL<br />
# To only record the offending host and nothing else (if using<br />
# an auxilary file to list the hosts).  Refer to:<br />
# http://denyhosts.sourceforge.net/faq.html#aux<br />
#BLOCK_SERVICE =<br />
#<br />
#######################################################################<br />
<br />
#######################################################################<br />
#<br />
# DENY_THRESHOLD_INVALID: block each host after the number of failed login<br />
# attempts has exceeded this value.  This value applies to invalid<br />
# user login attempts (eg. non-existent user accounts)<br />
#<br />
#允许无效用户失败的数次<br />
DENY_THRESHOLD_INVALID = 1<br />
#<br />
#######################################################################<br />
<br />
#######################################################################<br />
#<br />
# DENY_THRESHOLD_VALID: block each host after the number of failed<br />
# login attempts has exceeded this value.  This value applies to valid<br />
# user login attempts (eg. user accounts that exist in /etc/passwd) except<br />
# for the &quot;root&quot; user<br />
#允许普通用户失败的次数<br />
DENY_THRESHOLD_VALID = 1<br />
#<br />
#######################################################################<br />
<br />
#######################################################################<br />
#<br />
# DENY_THRESHOLD_ROOT: block each host after the number of failed<br />
# login attempts has exceeded this value.  This value applies to<br />
# &quot;root&quot; user login attempts only.<br />
#允许root用户失败的次数<br />
DENY_THRESHOLD_ROOT = 3<br />
#<br />
#######################################################################<br />
<br />
#######################################################################<br />
#<br />
# DENY_THRESHOLD_RESTRICTED: block each host after the number of failed<br />
# login attempts has exceeded this value.  This value applies to<br />
# usernames that appear in the WORK_DIR/restricted-usernames file only.<br />
#<br />
DENY_THRESHOLD_RESTRICTED = 1<br />
#<br />
#######################################################################<br />
<br />
#######################################################################<br />
#<br />
# WORK_DIR: the path that DenyHosts will use for writing data to<br />
# (it will be created if it does not already exist).<br />
#<br />
# Note: it is recommended that you use an absolute pathname<br />
# for this value (eg. /home/foo/denyhosts/data)<br />
#<br />
WORK_DIR = /usr/share/denyhosts/data<br />
#<br />
#######################################################################<br />
<br />
#######################################################################<br />
#<br />
# SUSPICIOUS_LOGIN_REPORT_ALLOWED_HOSTS<br />
#<br />
# SUSPICIOUS_LOGIN_REPORT_ALLOWED_HOSTS=YES|NO<br />
# If set to YES, if a suspicious login attempt results from an allowed-host<br />
# then it is considered suspicious.  If this is NO, then suspicious logins<br />
# from allowed-hosts will not be reported.  All suspicious logins from<br />
# ip addresses that are not in allowed-hosts will always be reported.<br />
#<br />
SUSPICIOUS_LOGIN_REPORT_ALLOWED_HOSTS=YES<br />
######################################################################<br />
<br />
######################################################################<br />
#<br />
# HOSTNAME_LOOKUP<br />
#<br />
# HOSTNAME_LOOKUP=YES|NO<br />
# If set to YES, for each IP address that is reported by Denyhosts,<br />
# the corresponding hostname will be looked up and reported as well<br />
# (if available).<br />
#是否做域名反解析<br />
HOSTNAME_LOOKUP=NO<br />
#<br />
######################################################################<br />
<br />
######################################################################<br />
#<br />
# LOCK_FILE<br />
#<br />
# LOCK_FILE=/path/denyhosts<br />
# If this file exists when DenyHosts is run, then DenyHosts will exit<br />
# immediately.  Otherwise, this file will be created upon invocation<br />
# and deleted upon exit.  This ensures that only one instance is<br />
# running at a time.<br />
#<br />
# Redhat/Fedora:<br />
LOCK_FILE = /var/lock/subsys/denyhosts<br />
#<br />
# Debian<br />
#LOCK_FILE = /var/run/denyhosts.pid<br />
#<br />
# Misc<br />
#LOCK_FILE = /tmp/denyhosts.lock<br />
#<br />
######################################################################<br />
<br />
############ THESE SETTINGS ARE OPTIONAL ############<br />
<br />
#######################################################################<br />
#<br />
# ADMIN_EMAIL: if you would like to receive emails regarding newly<br />
# restricted hosts and suspicious logins, set this address to<br />
# match your email address.  If you do not want to receive these reports<br />
# leave this field blank (or run with the --noemail option)<br />
#<br />
# Multiple email addresses can be delimited by a comma, eg:<br />
# ADMIN_EMAIL = foo@bar.com, bar@foo.com, etc@foobar.com<br />
#管理员Email<br />
ADMIN_EMAIL =<br />
#<br />
#######################################################################<br />
<br />
#######################################################################<br />
#<br />
# SMTP_HOST and SMTP_PORT: if DenyHosts is configured to email<br />
# reports (see ADMIN_EMAIL) then these settings specify the<br />
# email server address (SMTP_HOST) and the server port (SMTP_PORT)<br />
#<br />
#<br />
SMTP_HOST = localhost<br />
SMTP_PORT = 25<br />
#<br />
#######################################################################<br />
<br />
#######################################################################<br />
#<br />
# SMTP_USERNAME and SMTP_PASSWORD: set these parameters if your<br />
# smtp email server requires authentication<br />
#<br />
#SMTP_USERNAME=foo<br />
#SMTP_PASSWORD=bar<br />
#<br />
######################################################################<br />
<br />
#######################################################################<br />
#<br />
# SMTP_FROM: you can specify the &quot;From:&quot; address in messages sent<br />
# from DenyHosts when it reports thwarted abuse attempts<br />
#<br />
SMTP_FROM = DenyHosts &amp;lt;nobody@localhost&amp;gt;<br />
#<br />
#######################################################################<br />
<br />
#######################################################################<br />
#<br />
# SMTP_SUBJECT: you can specify the &quot;Subject:&quot; of messages sent<br />
# by DenyHosts when it reports thwarted abuse attempts<br />
SMTP_SUBJECT = DenyHosts Report<br />
#<br />
######################################################################<br />
<br />
######################################################################<br />
#<br />
# SMTP_DATE_FORMAT: specifies the format used for the &quot;Date:&quot; header<br />
# when sending email messages.<br />
#<br />
# for possible values for this parameter refer to: man strftime<br />
#<br />
# the default:<br />
#<br />
#SMTP_DATE_FORMAT = %a, %d %b %Y %H:%M:%S %z<br />
#<br />
######################################################################<br />
<br />
######################################################################<br />
#<br />
# SYSLOG_REPORT<br />
#<br />
# SYSLOG_REPORT=YES|NO<br />
# If set to yes, when denied hosts are recorded the report data<br />
# will be sent to syslog (syslog must be present on your system).<br />
# The default is: NO<br />
#<br />
#SYSLOG_REPORT=NO<br />
#<br />
#SYSLOG_REPORT=YES<br />
#<br />
######################################################################<br />
<br />
######################################################################<br />
#<br />
# ALLOWED_HOSTS_HOSTNAME_LOOKUP<br />
#<br />
# ALLOWED_HOSTS_HOSTNAME_LOOKUP=YES|NO<br />
# If set to YES, for each entry in the WORK_DIR/allowed-hosts file,<br />
# the hostname will be looked up.  If your versions of tcp_wrappers<br />
# and sshd sometimes log hostnames in addition to ip addresses<br />
# then you may wish to specify this option.<br />
#<br />
#ALLOWED_HOSTS_HOSTNAME_LOOKUP=NO<br />
#<br />
######################################################################<br />
<br />
######################################################################<br />
#<br />
# AGE_RESET_VALID: Specifies the period of time between failed login<br />
# attempts that, when exceeded will result in the failed count for<br />
# this host to be reset to 0.  This value applies to login attempts<br />
# to all valid users (those within /etc/passwd) with the<br />
# exception of root.  If not defined, this count will never<br />
# be reset.<br />
#<br />
# See the comments in the PURGE_DENY section (above)<br />
# for details on specifying this value or for complete details<br />
# refer to:  http://denyhosts.sourceforge.net/faq.html#timespec<br />
#<br />
AGE_RESET_VALID=5d<br />
#<br />
######################################################################<br />
<br />
######################################################################<br />
#<br />
# AGE_RESET_ROOT: Specifies the period of time between failed login<br />
# attempts that, when exceeded will result in the failed count for<br />
# this host to be reset to 0.  This value applies to all login<br />
# attempts to the &quot;root&quot; user account.  If not defined,<br />
# this count will never be reset.<br />
#<br />
# See the comments in the PURGE_DENY section (above)<br />
# for details on specifying this value or for complete details<br />
# refer to:  http://denyhosts.sourceforge.net/faq.html#timespec<br />
#<br />
AGE_RESET_ROOT=25d<br />
#<br />
######################################################################<br />
<br />
######################################################################<br />
#<br />
# AGE_RESET_RESTRICTED: Specifies the period of time between failed login<br />
# attempts that, when exceeded will result in the failed count for<br />
# this host to be reset to 0.  This value applies to all login<br />
# attempts to entries found in the WORK_DIR/restricted-usernames file.<br />
# If not defined, the count will never be reset.<br />
#<br />
# See the comments in the PURGE_DENY section (above)<br />
# for details on specifying this value or for complete details<br />
# refer to:  http://denyhosts.sourceforge.net/faq.html#timespec<br />
#<br />
AGE_RESET_RESTRICTED=25d<br />
#<br />
######################################################################<br />
<br />
######################################################################<br />
#<br />
# AGE_RESET_INVALID: Specifies the period of time between failed login<br />
# attempts that, when exceeded will result in the failed count for<br />
# this host to be reset to 0.  This value applies to login attempts<br />
# made to any invalid username (those that do not appear<br />
# in /etc/passwd).  If not defined, count will never be reset.<br />
#<br />
# See the comments in the PURGE_DENY section (above)<br />
# for details on specifying this value or for complete details<br />
# refer to:  http://denyhosts.sourceforge.net/faq.html#timespec<br />
#<br />
AGE_RESET_INVALID=10d<br />
#<br />
######################################################################<br />
<br />
######################################################################<br />
#<br />
# RESET_ON_SUCCESS: If this parameter is set to &quot;yes&quot; then the<br />
# failed count for the respective ip address will be reset to 0<br />
# if the login is successful.<br />
#<br />
# The default is RESET_ON_SUCCESS = no<br />
#<br />
#RESET_ON_SUCCESS = yes<br />
#<br />
#####################################################################<br />
<br />
######################################################################<br />
#<br />
# PLUGIN_DENY: If set, this value should point to an executable<br />
# program that will be invoked when a host is added to the<br />
# HOSTS_DENY file.  This executable will be passed the host<br />
# that will be added as it's only argument.<br />
#<br />
#PLUGIN_DENY=/usr/bin/true<br />
#<br />
######################################################################<br />
<br />
######################################################################<br />
#<br />
# PLUGIN_PURGE: If set, this value should point to an executable<br />
# program that will be invoked when a host is removed from the<br />
# HOSTS_DENY file.  This executable will be passed the host<br />
# that is to be purged as it's only argument.<br />
#<br />
#PLUGIN_PURGE=/usr/bin/true<br />
#<br />
######################################################################<br />
<br />
######################################################################<br />
#<br />
# USERDEF_FAILED_ENTRY_REGEX: if set, this value should contain<br />
# a regular expression that can be used to identify additional<br />
# hackers for your particular ssh configuration.  This functionality<br />
# extends the built-in regular expressions that DenyHosts uses.<br />
# This parameter can be specified multiple times.<br />
# See this faq entry for more details:<br />
#    http://denyhosts.sf.net/faq.html#userdef_regex<br />
#<br />
#USERDEF_FAILED_ENTRY_REGEX=<br />
#<br />
#<br />
######################################################################<br />
<br />
######### THESE SETTINGS ARE SPECIFIC TO DAEMON MODE  ##########<br />
<br />
#######################################################################<br />
#<br />
# DAEMON_LOG: when DenyHosts is run in daemon mode (--daemon flag)<br />
# this is the logfile that DenyHosts uses to report it's status.<br />
# To disable logging, leave blank.  (default is: /var/log/denyhosts)<br />
#<br />
DAEMON_LOG = /var/log/denyhosts<br />
#<br />
# disable logging:<br />
#DAEMON_LOG =<br />
#<br />
######################################################################<br />
<br />
#######################################################################<br />
#<br />
# DAEMON_LOG_TIME_FORMAT: when DenyHosts is run in daemon mode<br />
# (--daemon flag) this specifies the timestamp format of<br />
# the DAEMON_LOG messages (default is the ISO8061 format:<br />
# ie. 2005-07-22 10:38:01,745)<br />
#<br />
# for possible values for this parameter refer to: man strftime<br />
#<br />
# Jan 1 13:05:59<br />
#DAEMON_LOG_TIME_FORMAT = %b %d %H:%M:%S<br />
#<br />
# Jan 1 01:05:59<br />
#DAEMON_LOG_TIME_FORMAT = %b %d %I:%M:%S<br />
#<br />
######################################################################<br />
<br />
#######################################################################<br />
#<br />
# DAEMON_LOG_MESSAGE_FORMAT: when DenyHosts is run in daemon mode<br />
# (--daemon flag) this specifies the message format of each logged<br />
# entry.  By default the following format is used:<br />
#<br />
# %(asctime)s - %(name)-12s: %(levelname)-8s %(message)s<br />
#<br />
# Where the &quot;%(asctime)s&quot; portion is expanded to the format<br />
# defined by DAEMON_LOG_TIME_FORMAT<br />
#<br />
# This string is passed to python's logging.Formatter contstuctor.<br />
# For details on the possible format types please refer to:<br />
# http://docs.python.org/lib/node357.html<br />
#<br />
# This is the default:<br />
#DAEMON_LOG_MESSAGE_FORMAT = %(asctime)s - %(name)-12s: %(levelname)-8s %(message)s<br />
#<br />
#<br />
######################################################################<br />
<br />
#######################################################################<br />
#<br />
# DAEMON_SLEEP: when DenyHosts is run in daemon mode (--daemon flag)<br />
# this is the amount of time DenyHosts will sleep between polling<br />
# the SECURE_LOG.  See the comments in the PURGE_DENY section (above)<br />
# for details on specifying this value or for complete details<br />
# refer to:    http://denyhosts.sourceforge.net/faq.html#timespec<br />
#<br />
#<br />
DAEMON_SLEEP = 30s<br />
#<br />
#######################################################################<br />
<br />
#######################################################################<br />
#<br />
# DAEMON_PURGE: How often should DenyHosts, when run in daemon mode,<br />
# run the purge mechanism to expire old entries in HOSTS_DENY<br />
# This has no effect if PURGE_DENY is blank.<br />
#<br />
DAEMON_PURGE = 1h<br />
#<br />
#######################################################################<br />
<br />
#########   THESE SETTINGS ARE SPECIFIC TO     ##########<br />
#########       DAEMON SYNCHRONIZATION         ##########<br />
<br />
#######################################################################<br />
#<br />
# Synchronization mode allows the DenyHosts daemon the ability<br />
# to periodically send and receive denied host data such that<br />
# DenyHosts daemons worldwide can automatically inform one<br />
# another regarding banned hosts.   This mode is disabled by<br />
# default, you must uncomment SYNC_SERVER to enable this mode.<br />
#<br />
# for more information, please refer to:<br />
#        http:/denyhosts.sourceforge.net/faq.html#sync<br />
#<br />
#######################################################################<br />
<br />
#######################################################################<br />
#<br />
# SYNC_SERVER: The central server that communicates with DenyHost<br />
# daemons.  Currently, denyhosts.net is the only available server<br />
# however, in the future, it may be possible for organizations to<br />
# install their own server for internal network synchronization<br />
#<br />
# To disable synchronization (the default), do nothing.<br />
#<br />
# To enable synchronization, you must uncomment the following line:<br />
#SYNC_SERVER = http://xmlrpc.denyhosts.net:9911<br />
#<br />
#######################################################################<br />
<br />
#######################################################################<br />
#<br />
# SYNC_INTERVAL: the interval of time to perform synchronizations if<br />
# SYNC_SERVER has been uncommented.  The default is 1 hour.<br />
#<br />
#SYNC_INTERVAL = 1h<br />
#<br />
#######################################################################<br />
<br />
#######################################################################<br />
#<br />
# SYNC_UPLOAD: allow your DenyHosts daemon to transmit hosts that have<br />
# been denied?  This option only applies if SYNC_SERVER has<br />
# been uncommented.<br />
# The default is SYNC_UPLOAD = yes<br />
#<br />
#SYNC_UPLOAD = no<br />
#SYNC_UPLOAD = yes<br />
#<br />
#######################################################################<br />
<br />
#######################################################################<br />
#<br />
# SYNC_DOWNLOAD: allow your DenyHosts daemon to receive hosts that have<br />
# been denied by others?  This option only applies if SYNC_SERVER has<br />
# been uncommented.<br />
# The default is SYNC_DOWNLOAD = yes<br />
#<br />
#SYNC_DOWNLOAD = no<br />
#SYNC_DOWNLOAD = yes<br />
#<br />
#<br />
#<br />
#######################################################################<br />
<br />
#######################################################################<br />
#<br />
# SYNC_DOWNLOAD_THRESHOLD: If SYNC_DOWNLOAD is enabled this parameter<br />
# filters the returned hosts to those that have been blocked this many<br />
# times by others.  That is, if set to 1, then if a single DenyHosts<br />
# server has denied an ip address then you will receive the denied host.<br />
#<br />
# See also SYNC_DOWNLOAD_RESILIENCY<br />
#<br />
#SYNC_DOWNLOAD_THRESHOLD = 10<br />
#<br />
# The default is SYNC_DOWNLOAD_THRESHOLD = 3<br />
#<br />
#SYNC_DOWNLOAD_THRESHOLD = 3<br />
#<br />
#######################################################################<br />
<br />
#######################################################################<br />
#<br />
# SYNC_DOWNLOAD_RESILIENCY:  If SYNC_DOWNLOAD is enabled then the<br />
# value specified for this option limits the downloaded data<br />
# to this resiliency period or greater.<br />
#<br />
# Resiliency is defined as the timespan between a hackers first known<br />
# attack and it's most recent attack.  Example:<br />
#<br />
# If the centralized   denyhosts.net server records an attack at 2 PM<br />
# and then again at 5 PM, specifying a SYNC_DOWNLOAD_RESILIENCY = 4h<br />
# will not download this ip address.<br />
#<br />
# However, if the attacker is recorded again at 6:15 PM then the<br />
# ip address will be downloaded by your DenyHosts instance.<br />
#<br />
# This value is used in conjunction with the SYNC_DOWNLOAD_THRESHOLD<br />
# and only hosts that satisfy both values will be downloaded.<br />
# This value has no effect if SYNC_DOWNLOAD_THRESHOLD = 1<br />
#<br />
# The default is SYNC_DOWNLOAD_RESILIENCY = 5h (5 hours)<br />
#<br />
# Only obtain hackers that have been at it for 2 days or more:<br />
#SYNC_DOWNLOAD_RESILIENCY = 2d<br />
#<br />
# Only obtain hackers that have been at it for 5 hours or more:<br />
#SYNC_DOWNLOAD_RESILIENCY = 5h<br />
#<br />
#######################################################################</div></div>
<p>最后就是设置启动脚本了</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">cp /usr/share/denyhosts/daemon-control-dist /usr/share/denyhosts/daemon-control<br />
chown root /usr/share/denyhosts/daemon-control<br />
chmod 755 /usr/share/denyhosts/daemon-control<br />
ln -s /usr/share/denyhosts/daemon-control /etc/init.d/denyhosts<br />
chkconfig --level 345 denyhosts on</div></div>
<p>启动denyhosts</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">service denyhosts start</div></div>
<p>这样就安装完成了,每次开机都自动启动的,自己测试下,输入几次错误的密码.然后看看cat /etc/hosts.deny 里面是否有屏蔽的IP,再然后测试下,有屏蔽IP是否还能登录SSH和FTP.我的FTP安装的是VSFTP,其他的没测试过..</p>
<h2  class="related_post_title">暧味日志</h2><ul class="related_post"><li><a href="http://imcat.in/linux-change-root-ssh-remote-login-port-and-set-against/" title="linux修改ssh端口和禁止root远程登陆设置">linux修改ssh端口和禁止root远程登陆设置</a> (5)</li><li><a href="http://imcat.in/use-screen-manage-remote-session/" title="使用 screen 管理你的远程会话">使用 screen 管理你的远程会话</a> (1)</li><li><a href="http://imcat.in/some-commonly-used-ssh-commands/" title="一些常用的SSH命令">一些常用的SSH命令</a> (4)</li><li><a href="http://imcat.in/godaddy-host-of-the-linux-open-ssh-guide/" title="Godaddy的Linux主机开通SSH教程">Godaddy的Linux主机开通SSH教程</a> (25)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://imcat.in/ssh-ftp-install-denyhost-revent-brute-force/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>linux修改ssh端口和禁止root远程登陆设置</title>
		<link>http://imcat.in/linux-change-root-ssh-remote-login-port-and-set-against/</link>
		<comments>http://imcat.in/linux-change-root-ssh-remote-login-port-and-set-against/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 07:49:41 +0000</pubDate>
		<dc:creator>Cat.</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[root]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://imcat.in/?p=1388</guid>
		<description><![CDATA[linux修改ssh端口22 vi /etc/ssh/sshd_config 找到#port 22 将前面的#去掉,然后修改端口 port 1234 重启服务就OK了 service sshd restart 为增强安全 先增加一个普通权限的用户,并设置密码 useradd test passwd test 然后禁止ROOT远程SSH登录： vi /etc/ssh/sshd_config 把其中的 PermitRootLogin yes 改为 PermitRootLogin no 重启sshd服务 service sshd restart 远程管理用普通用户test登录,然后用 su root 切换到root用户就可以拿到最高权限 暧味日志Linux命令tar压缩排除指定目录的方法 (0)iptables限制同一IP连接数 (3)Linux下替换文件名中的空格 (0)安装denyhost防止SSH和FTP被暴力破解 (6)使用WinSCP连接到Linux (3)]]></description>
			<content:encoded><![CDATA[<p>linux修改ssh端口22</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">vi /etc/ssh/sshd_config</div></div>
<p>找到#port 22<br />
将前面的#去掉,然后修改端口 port 1234<br />
重启服务就OK了<br />
service sshd restart</p>
<p><span id="more-1388"></span><br />
为增强安全<br />
先增加一个普通权限的用户,并设置密码</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">useradd test<br />
passwd test</div></div>
<p>然后禁止ROOT远程SSH登录：</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">vi /etc/ssh/sshd_config</div></div>
<p>把其中的<br />
PermitRootLogin yes<br />
改为<br />
PermitRootLogin no<br />
重启sshd服务</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">service sshd restart</div></div>
<p>远程管理用普通用户test登录,然后用 su root 切换到root用户就可以拿到最高权限</p>
<h2  class="related_post_title">暧味日志</h2><ul class="related_post"><li><a href="http://imcat.in/linux-tar-exclude/" title="Linux命令tar压缩排除指定目录的方法">Linux命令tar压缩排除指定目录的方法</a> (0)</li><li><a href="http://imcat.in/iptables-limit-number-connections-same-ip/" title="iptables限制同一IP连接数">iptables限制同一IP连接数</a> (3)</li><li><a href="http://imcat.in/linux-replace-the-file-name-space/" title="Linux下替换文件名中的空格">Linux下替换文件名中的空格</a> (0)</li><li><a href="http://imcat.in/ssh-ftp-install-denyhost-revent-brute-force/" title="安装denyhost防止SSH和FTP被暴力破解">安装denyhost防止SSH和FTP被暴力破解</a> (6)</li><li><a href="http://imcat.in/use-winscp-connect-linux/" title="使用WinSCP连接到Linux">使用WinSCP连接到Linux</a> (3)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://imcat.in/linux-change-root-ssh-remote-login-port-and-set-against/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>使用 screen 管理你的远程会话</title>
		<link>http://imcat.in/use-screen-manage-remote-session/</link>
		<comments>http://imcat.in/use-screen-manage-remote-session/#comments</comments>
		<pubDate>Sat, 02 Oct 2010 11:40:13 +0000</pubDate>
		<dc:creator>Cat.</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[screen]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://imcat.in/?p=1367</guid>
		<description><![CDATA[如果远程登录到服务器上执行一个很耗时的程序或者脚本，那么只能一直开着这个窗口了。如果是几天的话，那可就麻烦了。 有了screen就不一样了。 screen可以在一个物理终端上模拟出多个窗口。最重要的是，可以挂起这些窗口。这样的话关掉正在执行程序的窗口就变成了可能。 新建一个窗口 1.键入命令screen。 这样就新建了一个窗口，可以像普通的终端一样使用。需要退出这个窗口的话可以执行exit命令。窗口是可以嵌套建立的，如果是多层窗口，退出后将返回到上一层。 2.输入命令screen vim 这样就会以一个新的窗口来运行vim了。 挂起和恢复窗口 在当前screen窗口中键入C-a d，即Ctrl键+a键，之后再按下d键，就可以挂起当前的窗口，但是在这个窗口中打开的程序还是在继续执行的。 输入命令screen -ls可以查看到被挂起的窗口： [root@Nginx domain]#screen -ls There is a screen on: 22496.pts-0.Nginx (Detached) 1 Socket in /var/run/screen/S-root. 恢复窗口：screen -r 22496 安装： yum install screen 暧味日志安装denyhost防止SSH和FTP被暴力破解 (6)linux修改ssh端口和禁止root远程登陆设置 (5)一些常用的SSH命令 (4)Godaddy的Linux主机开通SSH教程 (25)]]></description>
			<content:encoded><![CDATA[<p>如果远程登录到服务器上执行一个很耗时的程序或者脚本，那么只能一直开着这个窗口了。如果是几天的话，那可就麻烦了。</p>
<p>有了screen就不一样了。</p>
<p>screen可以在一个物理终端上模拟出多个窗口。最重要的是，可以挂起这些窗口。这样的话关掉正在执行程序的窗口就变成了可能。<br />
新建一个窗口</p>
<p>1.键入命令screen。</p>
<p>这样就新建了一个窗口，可以像普通的终端一样使用。需要退出这个窗口的话可以执行exit命令。窗口是可以嵌套建立的，如果是多层窗口，退出后将返回到上一层。<br />
<span id="more-1367"></span><br />
2.输入命令screen vim</p>
<p>这样就会以一个新的窗口来运行vim了。<br />
挂起和恢复窗口</p>
<p>在当前screen窗口中键入C-a d，即Ctrl键+a键，之后再按下d键，就可以挂起当前的窗口，但是在这个窗口中打开的程序还是在继续执行的。</p>
<p>输入命令screen -ls可以查看到被挂起的窗口：</p>
<p>[root@Nginx domain]#screen -ls<br />
There is a screen on:<br />
22496.pts-0.Nginx (Detached)<br />
1 Socket in /var/run/screen/S-root.</p>
<p>恢复窗口：screen -r 22496</p>
<p>安装：<br />
yum install screen</p>
<h2  class="related_post_title">暧味日志</h2><ul class="related_post"><li><a href="http://imcat.in/ssh-ftp-install-denyhost-revent-brute-force/" title="安装denyhost防止SSH和FTP被暴力破解">安装denyhost防止SSH和FTP被暴力破解</a> (6)</li><li><a href="http://imcat.in/linux-change-root-ssh-remote-login-port-and-set-against/" title="linux修改ssh端口和禁止root远程登陆设置">linux修改ssh端口和禁止root远程登陆设置</a> (5)</li><li><a href="http://imcat.in/some-commonly-used-ssh-commands/" title="一些常用的SSH命令">一些常用的SSH命令</a> (4)</li><li><a href="http://imcat.in/godaddy-host-of-the-linux-open-ssh-guide/" title="Godaddy的Linux主机开通SSH教程">Godaddy的Linux主机开通SSH教程</a> (25)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://imcat.in/use-screen-manage-remote-session/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>一些常用的SSH命令</title>
		<link>http://imcat.in/some-commonly-used-ssh-commands/</link>
		<comments>http://imcat.in/some-commonly-used-ssh-commands/#comments</comments>
		<pubDate>Tue, 12 May 2009 13:46:54 +0000</pubDate>
		<dc:creator>Cat.</dc:creator>
				<category><![CDATA[个人收藏]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[命令]]></category>

		<guid isPermaLink="false">http://www.maoxmao.com/%e4%b8%80%e4%ba%9b%e5%b8%b8%e7%94%a8%e7%9a%84ssh%e5%91%bd%e4%bb%a4/</guid>
		<description><![CDATA[购买了vps,我用得最多还是SSH,因为我没有安装控制面板,什么都是靠SSH来完成,用SSH的好处很多,基本上(Cpanel控制面板有的),SSH都支持,可是我总是记不住命令,唯有用博客记下来了... wget命令:从远程的服务器上下载软件到你的目录下,wget http://imcat.in/xxoo.zip 这个命令就是把xxoo.zip下载过来. 然后就是解压命令了,如果是zip文件就直接用unzip就可以解压,例如: unzip xxoo.zip  就是解压xxoo.zip文件到当前文件夹.. 压缩命令: tar cfz xxoo.tar.gz xxoo   这个命令就是将xxoo文件夹压缩为xxoo.tar.gz 重命名命令：mv xxoo maoxmao   就是把xxoo重命名为 maoxmao 复制命令：cp -a xxoo /home/www  就是把你当前目录下的xxoo文件夹整个复制到/home/www下。 ssh下备份mysql: mysqldump -h localhost -p maoxmao -u maoxmao &#62;maoxmao.sql 输入密码后,就自动将数据库备份为maoxmao.sql 恢复mysql命令: mysql -h localhost -p maoxmao -u maoxmao 输入密码,然后source maoxmao.sql 就可以恢复mysql了 暂时就这么多,以后再更新 暧味日志安装denyhost防止SSH和FTP被暴力破解 (6)linux修改ssh端口和禁止root远程登陆设置 (5)使用 screen 管理你的远程会话 (1)Linux查看系统配置常用命令 (2)Godaddy的Linux主机开通SSH教程 (25)]]></description>
			<content:encoded><![CDATA[<p>购买了vps,我用得最多还是SSH,因为我没有安装控制面板,什么都是靠SSH来完成,用SSH的好处很多,基本上(Cpanel控制面板有的),SSH都支持,可是我总是记不住命令,唯有用博客记下来了...</p>
<p>wget命令:从远程的服务器上下载软件到你的目录下,wget http://imcat.in/xxoo.zip 这个命令就是把xxoo.zip下载过来.</p>
<p>然后就是解压命令了,如果是zip文件就直接用unzip就可以解压,例如: unzip xxoo.zip  就是解压xxoo.zip文件到当前文件夹..</p>
<p>压缩命令: tar cfz xxoo.tar.gz xxoo   这个命令就是将xxoo文件夹压缩为xxoo.tar.gz</p>
<p>重命名命令：mv xxoo maoxmao   就是把xxoo重命名为 maoxmao</p>
<p>复制命令：cp -a xxoo /home/www  就是把你当前目录下的xxoo文件夹整个复制到/home/www下。</p>
<p>ssh下备份mysql:</p>
<p><span id="more-920"></span></p>
<p>mysqldump -h localhost -p maoxmao -u maoxmao &gt;maoxmao.sql</p>
<p>输入密码后,就自动将数据库备份为maoxmao.sql</p>
<p>恢复mysql命令:</p>
<p>mysql -h  localhost -p maoxmao -u maoxmao</p>
<p>输入密码,然后source maoxmao.sql</p>
<p>就可以恢复mysql了</p>
<p>暂时就这么多,以后再更新</p>
<h2  class="related_post_title">暧味日志</h2><ul class="related_post"><li><a href="http://imcat.in/ssh-ftp-install-denyhost-revent-brute-force/" title="安装denyhost防止SSH和FTP被暴力破解">安装denyhost防止SSH和FTP被暴力破解</a> (6)</li><li><a href="http://imcat.in/linux-change-root-ssh-remote-login-port-and-set-against/" title="linux修改ssh端口和禁止root远程登陆设置">linux修改ssh端口和禁止root远程登陆设置</a> (5)</li><li><a href="http://imcat.in/use-screen-manage-remote-session/" title="使用 screen 管理你的远程会话">使用 screen 管理你的远程会话</a> (1)</li><li><a href="http://imcat.in/view-the-system-configuration-commonly-used-linux-commands/" title="Linux查看系统配置常用命令">Linux查看系统配置常用命令</a> (2)</li><li><a href="http://imcat.in/godaddy-host-of-the-linux-open-ssh-guide/" title="Godaddy的Linux主机开通SSH教程">Godaddy的Linux主机开通SSH教程</a> (25)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://imcat.in/some-commonly-used-ssh-commands/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Godaddy的Linux主机开通SSH教程</title>
		<link>http://imcat.in/godaddy-host-of-the-linux-open-ssh-guide/</link>
		<comments>http://imcat.in/godaddy-host-of-the-linux-open-ssh-guide/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 13:26:51 +0000</pubDate>
		<dc:creator>Cat.</dc:creator>
				<category><![CDATA[网络相关]]></category>
		<category><![CDATA[Godaddy]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://www.maoxmao.com/godaddy%e7%9a%84linux%e4%b8%bb%e6%9c%ba%e5%bc%80%e9%80%9assh%e6%95%99%e7%a8%8b/</guid>
		<description><![CDATA[估计还有很多人都不知道,Godaddy的Linux主机已经支持SSH功能了.这个SSH功能默认不是开通的.所以需要申请,方法很简单. 首先要删除所有数据库,所以在开通前要备份好数据库,然后全部删除.接着登录godaddy的空间管理面板.选择Settings选项卡下的SSH选项，如下图： 然后填写Country Code: 在中国的请写 86   Phone Number:  写手机号就可以了 例如：013800138000 然后点击 Enable 几秒钟后就会收到来自  专网 的电话， 告诉你5个数字(0-9随机5个数字) 一共朗读两遍  把你听到的数字填入“You will be called with your PIN:”  就可以了 最后就等Godaddy处理开通..一般需要24小时的. 暧味日志安装denyhost防止SSH和FTP被暴力破解 (6)linux修改ssh端口和禁止root远程登陆设置 (5)使用 screen 管理你的远程会话 (1)一些常用的SSH命令 (4)博客日IP1.5W,你也可以做到 (34)]]></description>
			<content:encoded><![CDATA[<p>估计还有很多人都不知道,Godaddy的Linux主机已经支持SSH功能了.这个SSH功能默认不是开通的.所以需要申请,方法很简单.</p>
<p>首先要删除所有数据库,所以在开通前要备份好数据库,然后全部删除.接着登录godaddy的空间管理面板.选择Settings选项卡下的SSH选项，如下图：</p>
<p><a href="/wp-content/uploads/2009/01/godaddy.jpg"><img src="/wp-content/uploads/2009/01/godaddy-thumb.jpg" title="Godaddy的Linux主机开通SSH教程" alt="godaddy thumb Godaddy的Linux主机开通SSH教程" /></a></p>
<p><span id="more-902"></span></p>
<p>然后填写Country Code: 在中国的请写 86   Phone Number:  写手机号就可以了 例如：013800138000</p>
<p><a href="/wp-content/uploads/2009/01/godaddy1.jpg"><img src="/wp-content/uploads/2009/01/godaddy1-thumb.jpg" title="Godaddy的Linux主机开通SSH教程" alt="godaddy1 thumb Godaddy的Linux主机开通SSH教程" /></a></p>
<p>然后点击 Enable<br />
几秒钟后就会收到来自  专网 的电话， 告诉你5个数字(0-9随机5个数字)<br />
一共朗读两遍  把你听到的数字填入“You will be called with your PIN:”  就可以了</p>
<p><a href="/wp-content/uploads/2009/01/godaddy2.jpg"><img src="/wp-content/uploads/2009/01/godaddy2-thumb.jpg" title="Godaddy的Linux主机开通SSH教程" alt="godaddy2 thumb Godaddy的Linux主机开通SSH教程" /></a></p>
<p>最后就等Godaddy处理开通..一般需要24小时的.</p>
<h2  class="related_post_title">暧味日志</h2><ul class="related_post"><li><a href="http://imcat.in/ssh-ftp-install-denyhost-revent-brute-force/" title="安装denyhost防止SSH和FTP被暴力破解">安装denyhost防止SSH和FTP被暴力破解</a> (6)</li><li><a href="http://imcat.in/linux-change-root-ssh-remote-login-port-and-set-against/" title="linux修改ssh端口和禁止root远程登陆设置">linux修改ssh端口和禁止root远程登陆设置</a> (5)</li><li><a href="http://imcat.in/use-screen-manage-remote-session/" title="使用 screen 管理你的远程会话">使用 screen 管理你的远程会话</a> (1)</li><li><a href="http://imcat.in/some-commonly-used-ssh-commands/" title="一些常用的SSH命令">一些常用的SSH命令</a> (4)</li><li><a href="http://imcat.in/blog-on-ip15w-you-can-do/" title="博客日IP1.5W,你也可以做到">博客日IP1.5W,你也可以做到</a> (34)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://imcat.in/godaddy-host-of-the-linux-open-ssh-guide/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
	</channel>
</rss>

