# Zen Cart中文版网站安全 Zen Cart™软件使用的是GNU通用公共许可协议，您可以免费使用、修改Zen Cart™软件。 虽然该软件是免费的，但是欢迎您每次下载新版本前捐款，以帮助我们继续软件开发、升级，和维护免费论坛。 捐款网址： Zen Cart™ 团队 感谢您的支持 Zen Cart China Zen Cart™ 源自: Copyright 2003 osCommerce 该软件希望提供有用的功能，但[不做保证]，也不保证[适用于特定用途] 该软件受限于GNU通用公共许可协议

该软件通过OSI开源软件认证。 OSI Certified是开源动力的认证标志。

# ZEN CART中文版安全建店的方法 下面是强化Zen Cart网店安全的几个步骤: # 1. 删除/zc_install安装目录 安装完成后，从服务器商删除/zc_install安装目录。 不要只是改名目录，万一别人知道了目录名，就不安全。 # 2. 改名"/admin"目录 修改"admin"目录名，用一个很难猜测到的名字。 (在进行下面的修改前，请备份文件和数据库。) A- 用文本编辑器，例如记事本，打开文件admin/includes/configure.php。 将所有出现/admin/的地方改成自己的管理目录名。 需要修改的部分: define('DIR_WS_ADMIN', '/admin/'); define('DIR_WS_CATALOG', '/'); define('DIR_WS_HTTPS_ADMIN', '/admin/'); define('DIR_WS_HTTPS_CATALOG', '/'); 需要修改的部分: define('DIR_FS_ADMIN', '/home/mystore.com/www/public/admin/'); define('DIR_FS_CATALOG', '/home/mystore.com/www/public/'); B- 找到Zen Cart的/admin/目录， 将该目录名按照admin/includes/configure.php中的定义作相应修改。 C - 使用.htaccess文件来保护Admin目录，类似下面提到的，保存在/admin/includes目录下 (Zen Cart v1.2.7以上版本中已有该文件) # 3. 设置configure.php文件为只读 将两个configure.php文件用CHMOD(设置权限)命令改为只读很重要。 通常就是设置为"644"，有时是"444"。 配置文件configure.php位于: /<您的商店目录>/includes/configure.php /<您的商店目录>/admin/includes/configure.php 有时通过FTP设置文件为只读不起作用。尽管看起来已经设置为只读了，实际上没有。通过查看商店首页的顶部是否有警告信息来确定设置是否生效。如果还是显示警告信息，请通过主机商提供的"文件管理"功能来修改。 如果您用的是Windows服务器，只要将文件设置为"所有人" "只读"，如果在IIS下，是IUSR_xxxxx用户，或者"System"帐号，在Apache下，是"apache user"帐号。 # 4. 删除不用的管理员帐号 管理页面->工具->管理设置 在管理页面下，打开工具菜单，选择管理设置 - 检查所有没有使用的管理员帐号并删除。特别注意是否有"Demo"帐号。 # 5. 强化管理员密码 一定要使用一定强度、不易猜测的密码。 要修改管理员密码，进入管理页面->工具->管理设置，点击"重置密码"按钮，或点击那个回收箱的图标。 建议使用至少8位密码。 密码最好包含字母、数字、符合、以及大小写等。 # 保护管理页面 在管理页面工作时要注意安全： 仅打开一个窗口访问管理页面 登录管理页面后不要访问其他网站 不用时请登出管理页面 # 6. 保护"自定义页面" "html_includes"中的内容 定义好您的自定义页面后，(管理页面->工具->页面编辑), 您要保护这些文件: A. 用FTP软件下载备份，这些文件位于/includes/languages/english/html_includes目录。 B. 修改文件 CHMOD 644 或 444 (或 Windows下为“只读”)。见上面的CHMOD说明 /includes/languages/schinese/html_includes – 下面的所有文件/目录 提示: 设置为只读后，如果需要修改自定义页面，还需要重设为可读写。 # 7. 使用.htaccess文件来强化安全 在服务器目录里，.htaccess文件可用于防止用户浏览目录，还可以防止直接访问"任何".PHP脚本，因为某些目录中的所有PHP文件是通过其它PHP文件访问，而不是直接通过浏览器。这有利于安全。 某些目录下还有一些半-"空白"的index.html文件，这些文件用于保护目录，万一FTP软件不能上传.htaccess文件，或您的服务器不接受，可以防止目录浏览，但不会停止执行.PHP文件。 这也是"可行的"方法，尽管在所有目录下使用.htaccess文件更好。 目录中存在index.html 文件，但还没有.htaccess文件时，建议添加的.htaccess文件如下(取决于服务器的设置): #.htaccess 用于保护文件 OPTIONS -Indexes -ExecCGI IndexIgnore */* ### 先限制所有访问。然后，允许访问特定项目，见下面的 FilesMatch 部分. <FilesMatch .*> Order Deny,Allow Deny from all </FilesMatch> ### 说明: 仅在列表中增加允许的文件类型，取决于要保护的目录: <FilesMatch .*\.(js|css|jpg|gif|png|swf)> Order Deny,Allow Allow from all </FilesMatch> In order for the above suggestions to work, your host must include either 'All' or all of these: 'Limit Options Indexes' parameters to the AllowOverride configuration in the server's apache/conf/httpd.conf file. Some hosts don't like to let you use the OPTIONS directive, so you'll need to leave that line out or put a # in front of it. 如果您的主机不允许您建立/使用自己的.htaccess文件，有时您可以通过管理面板来设置.htaccess文件。 您需要选择 -- 并使用 -- 适合您的服务器的方法。最好咨询您的主机提供商。 # 关闭"允许访客推荐给朋友"功能 管理页面->电子邮件选项->允许访客推荐给朋友选项设置为'false'。防止用户利用你的服务器发送不必要的电子邮件。 # Protect your "images" and other folders During initial installation, you are advised to set your images folder to read/write, so that you can use the Admin interface to upload product/category images without having to use FTP for each one. Similar recommendations are made to other files for various reasons. However, leaving the images (or any other) folder in read/write mode means that hackers might be able to put malicious files in this (or other) folder(s) and thus create access points from which to attempt nasty exploits. Thus, once your site is built and your images have been created/loaded, you should drop the security down from read/write to read. ie: change from CHMOD 777 down to 644 for files, and to 755 for folders. #### File/Folder permissions settings On Linux/Unix hosts, generally, permission-setting recommendations for basic security are: folders/directories: 755 files: 644 On Windows hosts, setting files read-only is usually sufficient. Should double-check that the Internet Guest Account has limited (read-only) access. #### Folder Purposes The folders for which installation suggests read-write access for setup are these. If your site supports .htaccess protection, then you should use it for these folders. (The .htaccess files included with v1.3.9 and newer should already cover the basics.) /cache This is used to cache session and database information. The BEST security protection for this is to move it to a folder "above" the webroot (public_html or htdocs or www) area, so that it's not accessible via a browser. (Requires changes to DIR_FS_SQL_CACHE setting in configure.php files as well as Admin > Configuration > Sessions > Session Directory.) /images See other suggestions earlier. /includes/languages/english/html_includes See other suggestions earlier. /media This is only suggested read-write for the sake of being able to upload music-product media files via the admin. Could be done by FTP as an alternative. /pub This is used on Linux/Unix hosts to have downloadable products made available to customers via a secure delivery method which doesn't disclose the 'real' location of files/data on your server (so that people can't share a URL and have their friends steal downloads from your site) /admin/backups This is used by automated backup routines to store database backups. Optional. /admin/images/graphs This is used by the Admin > Tools > Banner Manager for updating/displaying bar graphs related to banner usage. If not writable, feature is ignored. # Remove the print URL from your browser's headers To stop the browser from printing a URL on the invoice or any other document on the web, follow these steps: For Internet Explorer: o Click on File then Page Setup o At page setup, remove this two character combination: "&u" from the header or footer text box. For Firefox: o Click on File then Page Setup o On page setup window click on the tab "Margins & Header/Footer". In the "Header & Footer" section set all of the drop downs to --blank--. (Or at least remove all references to "Title" and "URL".) # Things to Check Up on Regularly Be sure you've done all the steps listed in this document Keep good backups of your website files and database Check your server's errorlog regularly for odd or suspicious activity look for any links that went to a page that isn't in your site look for links that have http after the index.php Check your website files regularly to be sure nothing's been added or altered Ask your webhost what they have done to be sure the server you're on is safe and secure so that outsiders cannot do any harm, and so that other websites on your server cannot be used to get to your site and cause any harm (in case they have security holes in them) If your business warrants, or you still want additional assurance (esp if running forum software on your site, or other scripts outside of Zen Cart), hire a security consultant to check your site regularly and give you peace of mind in exchange for a few dollars

版权所有 2010 Zen Cart 中文版