使用WordPress之后必须要知道的安全技巧

This entry was posted by 老猫 Friday, 19 June, 2009

WordPress是目前世界上使用广泛的博客软件,比较容易受到各种攻击,因此WordPress安全性也是非常重要的,以下有10个安全技巧,可以帮助你轻松的解决WordPress安全性问题,以免你在WordPress的安全性上走更多的弯路。

  1、升级WordPress到最新版本

  一般来说,新版本的WordPress安全性都会比老版本要好一些,并且解决了已知的各种安全性问题,特别当遇到重大的版本升级时,新版本可能会解决更多的关键性问题。(例如老版本WordPress有remv.php重大漏洞,可能会导致遭受DDoS攻击,升级到最新2.7版本可解决这个问题)

  2、隐藏WordPress版本

  编辑你的header.php模板,将里面关于WordPress的版本信息都删除,这样黑客就无法通过查看源代码的防治得知你的WordPress有没有升级到最新版本。

  3、更改WordPress用户名

  每个黑客都知道WordPress的管理员用户是admin,具有管理员权限,会攻击这个用户,那么你需要创建一个新用户,将其设置为管理员权限,然后删除老的admin帐号,这就能避免黑客猜测管理员的用户名。

  4、更改WordPress用户密码

  安装好WordPress后,系统会发送一个随机密码到你的信箱,修改这个密码,因为这个密码的长度只有6个字符,你要将密码修改为10个字符以上的复杂密码,并尽量使用字母、数字、符号相混合的密码。

  5、防止WordPress目录显示

  WordPress会默认安装插件到/wp-content/plugins/目录下,通常情况下直接浏览这个目录会列出所有安装的插件名,这很糟糕,因为黑客可以利用已知插件的漏洞进行攻击,因此可以创建一个空的index.html文件放到这个目录下,当然,修改Apache的.htaccess文件也可以起到相同的作用。

  6、保护wp-admin文件夹

  你可以通过限定IP地址访问WordPress管理员文件夹来进行保护,所有其他IP地址访问都返回禁止访问的信息,不过你也只能从一两个地方进行博客管理。另外,你需要放一个新的.htaccess文件到wp-admin目录下,防止根目录下的.htaccess文件被替换。

  7、针对搜索引擎的保护

  很多WordPress系统文件不需要被搜索引擎索引,因此,修改你的robots.txt文件,增加一行Disallow: /wp-*

  8、安装Login Lockdown插件

  这个插件可以记录失败的登录尝试的IP地址和时间,如果来自某一个IP地址的这种失败登录超过一定条件,那么系统将禁止这一IP地址继续尝试登录。

  9、WordPress数据库安全

  数据表最好不要使用默认的wp_开头,安装数据库备份插件,无论做了多少保护,你还是应该定期备份你的数据库,使用WordPress Database Backup等插件可以实现数据库的定期备份。

  10、安装WordPress Security Scan插件

  这个插件会自动按照以上的安全建议对你的WordPress进行扫描,查找存在的问题,使用较为简单。

WordPress是目前世界上使用广泛的博客软件,比较容易受到各种攻击,因此WordPress安全性也是非常重要的,以下有10个安全技巧,可以帮助你轻松的解决WordPress安全性问题,以免你在WordPress的安全性上走更多的弯路。

  1、升级WordPress到最新版本

  一般来说,新版本的WordPress安全性都会比老版本要好一些,并且解决了已知的各种安全性问题,特别当遇到重大的版本升级时,新版本可能会解决更多的关键性问题。(例如老版本WordPress有remv.php重大漏洞,可能会导致遭受DDoS攻击,升级到最新2.7版本可解决这个问题)

  2、隐藏WordPress版本

  编辑你的header.php模板,将里面关于WordPress的版本信息都删除,这样黑客就无法通过查看源代码的防治得知你的WordPress有没有升级到最新版本。

  3、更改WordPress用户名

  每个黑客都知道WordPress的管理员用户是admin,具有管理员权限,会攻击这个用户,那么你需要创建一个新用户,将其设置为管理员权限,然后删除老的admin帐号,这就能避免黑客猜测管理员的用户名。

  4、更改WordPress用户密码

  安装好WordPress后,系统会发送一个随机密码到你的信箱,修改这个密码,因为这个密码的长度只有6个字符,你要将密码修改为10个字符以上的复杂密码,并尽量使用字母、数字、符号相混合的密码。

  5、防止WordPress目录显示

  WordPress会默认安装插件到/wp-content/plugins/目录下,通常情况下直接浏览这个目录会列出所有安装的插件名,这很糟糕,因为黑客可以利用已知插件的漏洞进行攻击,因此可以创建一个空的index.html文件放到这个目录下,当然,修改Apache的.htaccess文件也可以起到相同的作用。

  6、保护wp-admin文件夹

  你可以通过限定IP地址访问WordPress管理员文件夹来进行保护,所有其他IP地址访问都返回禁止访问的信息,不过你也只能从一两个地方进行博客管理。另外,你需要放一个新的.htaccess文件到wp-admin目录下,防止根目录下的.htaccess文件被替换。

  7、针对搜索引擎的保护

  很多WordPress系统文件不需要被搜索引擎索引,因此,修改你的robots.txt文件,增加一行Disallow: /wp-*

  8、安装Login Lockdown插件

  这个插件可以记录失败的登录尝试的IP地址和时间,如果来自某一个IP地址的这种失败登录超过一定条件,那么系统将禁止这一IP地址继续尝试登录。

  9、WordPress数据库安全

  数据表最好不要使用默认的wp_开头,安装数据库备份插件,无论做了多少保护,你还是应该定期备份你的数据库,使用WordPress Database Backup等插件可以实现数据库的定期备份。

  10、安装WordPress Security Scan插件

  这个插件会自动按照以上的安全建议对你的WordPress进行扫描,查找存在的问题,使用较为简单。

 英文原文:Top Ten WordPress Security Tips

Below are 10 security tips that you can easily implement on your WordPress blog. Please share one or more life-savers you use permanently to help protect yourself from WordPress security issues.

1. Upgrade WordPress – In general, keeping your WordPress installation up to date is a great way to avoid known problems. Do note that the lastest version, especially in the case of major upgrades, may cause more problems then it resolves.

2. WordPress Version – The tag in your header.php that displays your current version of wordpress. Since everyone knows your wordpress version this way, your blog is prone to hackers if you have not upgraded to the new version.

3. WordPress Username – Every hacker knows WordPress has a user “admin” with god-like administration privileges. Slow the hackers down by removing the “admin” user. Create a WordPress user with admin privileges using the administration interface. Log out of WordPress and log back in with the new user. Delete the admin user. The new admin user should be different than your normal post author.

4. WordPress Password – Are you still logging into your wp-admin page with the same default password that was emailed to you? If so, CHANGE IT! That password is only 6 characters and just numbers and letters. Make it complex and more than 10 characters if you can. Also, try not to use words, make it a nice jumble of letters, numbers, and symbols.

5. Prevent Directory Listing – In many WordPress installations it is possible to view a list of installed plugins by navigating to the /wp-content/plugins/ directory. This is not a good idea as known plugin vulnerabilities can than be easily exploited. Add an empty default index file, such as index.html, to the directory. You can also protect it using an .htaccess file assuming you’re using Apache.

6. Protect Your WP-Admin Folder – You can protect your WordPress admin folder by allowing access to it from a defined set of IP addresses. Everything else will bring up a Forbidden error message. So if you only access your blog from one or two places routinely, it’s worth implementing. Also, you’re supposed to create a new .htaccess file inside your wp-admin folder, not replace the one at the root of your blog.

7. Protect From Search Engines – There is no need to have all of your filesWordPress files indexed by Google, so it’s best to block them in your robots.txt file. Add the following line to your list:Disallow: /wp-*

8. Install Login Lockdown WordPress PluginThis plugin records the IP address and timestamp of every failed WordPress login attempt. If more than a certain number of attempts are detected within a short period of time from the same IP range, then the login function is disabled for all requests from that range.

9. Install WordPress Database Backup Plugin – You always have to take regular backups of your file directories as well as the database. WordPress Database Backup plugin creates backups of your core WordPress tables as well as other tables of your choice in the same database.

10. Install WordPress Security Scan Plugin – The WP Security Scan plugin attempts to both to audit your blog security and to implement many of the suggestions mentioned above.

转载自月光博客 [ http://www.williamlong.info/ ]


Leave a Reply