xampp安全性设置

xampp安全性设置
xampp安全性设置

Xampp 安全设置

1.简介

文档记录:杨培豪

记录时间:2011年6月2日

Xampp版本:1.7.3

+ Apache 2.2.14 (IPV6 enabled)

+ MySQL 5.1.41 (Community Server) with PBXT engine 1.0.09-rc + PHP 5.3.1 (PEAR, Mail_Mime, MDB2, Zend)

+ Perl 5.10.1 (Bundle::Apache2, Apache2::Request,

默认用户:

(xampp安装后没有经过任何配置)

1) MySQL:

User: root

Password:

(means no password!)

2) FileZilla FTP:

User: newuser

Password: wampp

User: anonymous

Password: some@https://www.360docs.net/doc/d617696388.html,

3) Mercury:

Postmaster: postmaster (postmaster@localhost)

Administrator: Admin (admin@localhost)

TestUser: newuser

Password: wampp

4) WEBDA V:

User: wampp

Password: xampp

2.不安全因素

密码保持默认,没有修改,这样很容易被别人注入

1.PhpAdmin可以经过网络随意访问,这样别人把自己所有的数据删除了,自己还可能不知道

2.Xampp的目录没有保护密码,这样别人可以任意登录你的xampp的主页,对你的一些设置做更改。

3.密码长度不够,密码不复杂….等因素也可以对你的web服务造成影响4.最后就是配置文件的一些安全设置参数了,默认的设置可能会给别有用心的人留下入口。

3.Xampp面板上设置说明

Shell :表示打开xampp的命令行管理

Setup:打开xampp的命令行设置

Port-Check:检查各个端口的占用情况:

Explore:直接打开本地的xampp的安装目录

SCM:运行本地的服务控制项

Refresh:刷新本地模块的状态

Help:就是关于面板的帮助信息

复选框:表示作为一个nt服务安装模块

Admin:表示管理各个模块

4. Xampp各种服务端口介绍

功过面板上的Port-Check:就可以轻松的获取各个端口的使用情况了,如果发现服务不能正常启动,就需要看看该服务的端口是不是被占用了。如果占用,在任务管理器停止相应的程序就可以达到释放相应端口的目的。

5.设置mysql密码

1.在浏览器输入http://localhost进入xampp的主页

2.点击左边栏的安全选项卡进入安全设置

3.进入后首先会检查系统的一般安全问题如图

5.点击下面的http://local...... 的衔接进入到mysql的密码设置页面,如图

6.在这里就可以对mysql的root密码进行设置了

7.Php认证最好选用http模式,因为选用cookie的话,有的浏览器默认禁止了cookie了,这样你就不能登陆了。

8.下面的yes or no最好选择yes ,可以生成随机的密码

9.下面的复选框也勾上,这样就可以生成一个txt文件保存随机生成的pma 密码了,并且root的密码也记录在内

10.建议转移自己的密码文件,放在一个安全的地方,不容易被被人访问到。

11.设置成功重新进入phpMyAdmin就需要输入自己设置的密码如图:

6.设置设置xampp的目录保护

1.承接mysql的密码设置,在和设置mysql密码的同一个页面设置xampp 的密码保护,如图:

2.输入用户名和密码,则密码会被加密放到.htaccess文件中,查看该文件,发现里面的用户名和密码指向xampp/security/https://www.360docs.net/doc/d617696388.html,ers

打开该文件:发现里面的密码是被加密的

如图:

3.重新使用浏览器打开http://localhost就需要输入密码了。如图:

7.密码优化

这里的密码优化主要是使用xampp系统提供的随机密码的功能,随机生成16位以上的随机密码,包含数字,大写字母,小写字母,这个密码相对就是比较安全的。

Mysql设置:

1.登录进入phpmyadmin的主页

2.点击权限选项卡

3.可以看到mysql存在的每一个用户:

4.如图:

5.点击授权后面的编辑项,就可以进入对该用户的权限编辑页

6.可以设置该用户对各个数据库和各个表之间的权限,很全,很方便

7.也可以看到修改密码的栏,如图:

8.点击最下面的生成密码,就可以随机生成16位的密码了。

8.设置filezilla ftp服务器的密码

说明filezilla ftp服务器是集成在xampp中并且跨平台的ftp服务器

1.打开xampp的控制面板

2.开启filezilla服务

如图:

3.点击filezilla后面的Admin进入filezilla的管理界面

a)如图

4.点击edit选项卡进入users管理如图:

5.在右侧选择不同的用户就可以对该用户设置相应的权限点击newuser

6.在密码栏,删除原来的密码,输入新密码,然后点击左边的ok'键,那么

newuser用户密码就设置完成。

7.重新再浏览器输入http://localhost/security就可以看到上面的提示,filezill

的默认密码已经改变,

如图

9.filezilla FTP服务器用户配置

9.1 更改本地用户的主目录位置

本地ftp用户默认的主目录是在xampp/htdocs,这就意味着,可以对这些目录下面的任意目录做更改了,但是这个目录下面放的有xampp的本地项目和phpadmin项目,如果对这些项目做了更改或者删除了一些必要的文件,将造成访问xampp主页和phpmyadmin的数据库管理存在问题,所以在这里

推荐更换主目录。

操作:edit --->users 右边选择newuser用户,左边选择share folders

如图

把原来的主目录remove掉,然后点击add按钮重新添加新的文件夹。例如我的是用my document文件夹下新建了个ftp文件夹,在这个目录下进行ftp的各种操作。

9.2 对目录的权限设置

接上面的图片,如图,在shared folders右边有许多的复选框,这些框,就可以对ftp的权限进行设置。

Files下的

read 表示对选中的文件夹有读取文件的权限

Write 表示对选中的文件夹有写入文件的权限

Delete 表示对选中的文件夹有删除文件的权限

Append 表示对选中的文件夹有添加文件的权限

Directories下的

Create 表示对选中的文件夹有创建文件夹的权限

Delete 表示对选中的文件夹有删除文件夹的权限

List 表示对选中的文件夹有查看里面文件的权限

+subdir 表示对选中的文件夹有上传文件夹的权限

9.3限制上传下载的速度

通过这个可以对上传和下载的速度进行限制。

可以直接更改相应的按钮进行更改上传下载的速度。

可以实现的功能:

使用默认的限制

不限制(不推荐使用)

始终一种速度

使用速度限制表可以限制某个用户在某个时段的上传下载速度。

如图(限制周六,周日两天的上传下载速度为8kb/s)

9.4 进行ip过滤

可以实现功能:

对某一个IP进行限制访问ftp服务器

对某一个网段进行限制访问ftp服务器

对网段中的某一个IP设置允许访问ftp服务器

10.filezilla ftp 服务器的基本配置

10.1 设置欢迎标语:

打开edit --->setting

点击welcome messages 就可以对欢迎标语进行更改。

注意,这里的欢迎语只能在dos下可以看见,其他登录不可见。

如图

10.2绑定ip

通过这个设置可以绑定指定的IP访问这台服务器,其他的IP不可以访问。默认情况是* 表示允许所有IP访问服务器。

10.3 过滤IP

在这里设置可以过滤特定的客户机IP地址。

功能:

1.不禁可以过滤单独IP还可以过滤一个ip范围,一个网段,或者域

2.可以重新允许一个IP访问服务器

10.4 被动模式设置

这种设置可以在防火墙或者代理服务器后面进行设置,通过访问这台机器,这台机器再访问相应的主机就可以实现ftp的使用了。

10.5管理员接口设置

在这里可以更改管理员连接的端口

绑定管理员的IP端口到指定的IP地址上。

允许访问到管理员端口的IP地址

更改管理服务器的密码

10.6日志设置

功能:启用日志

日志限制大小

每天都是用不同log文件,并且2周后对日志进行清空。

10.7上传下载的速度设置:

和前面讲的用户的速度限制差不多。

11.实战篇

11.1 设置ftp服务器

需求:

匿名用户可以在目录ftp下的pub目录下进行各种操作

匿名用户可以在work目录下进行作业的上缴

ftp目录统一由newuser来控制,拥有最大权限

分析:

通过需求可以看出是newuser用户管理匿名用户,所以newuser用户的主目录应该是匿名用户主目录的上一级目录。

目录结构:

Ftp{pub ,work}

Newuser对ftp目录拥有全部的权限

匿名用户对pub拥有全部的权限,对work拥有部分的权限

实施步骤:

1.建立目录结构:

a)在我的文档下建立ftp文件夹,并在里面建立pub和work

2.设置匿名用户的主目录,并设置权限

a)在filezilla的主控制窗口点击edit——>>users

b)然后点击share folders 并选择anonymous用户

如图,在里面需要添加三个目录,分别是:

ftp目录

ftp下的pub目录

ftp下的work目录

分别设置权限如下:

ftp目录:并设置为主目录

ftp下的pub目录:(权限全满)

ftp下work目录的权限

这样就满足了匿名用户的需求了。

3.设置newuser的目录权限和主目录

a)前面的同上的配置

b)用户需要选择newuser

c)添加目录ftp,权限全部添加上。

如图:

然后点击左边的ok键,配置成功。

12.邮件服务器配置

这里待完善.........

Xampp自述文件:

附录:

Readme.txt

###### Apache Friends XAMPP (Basis Package) version 1.7.3 ######

+ Apache 2.2.14 (IPV6 enabled)

+ MySQL 5.1.41 (Community Server) with PBXT engine 1.0.09-rc

+ PHP 5.3.1 (PEAR, Mail_Mime, MDB2, Zend)

+ Perl 5.10.1 (Bundle::Apache2, Apache2::Request, Bundle::Apache::ASP, Bundle::Email, Bundle::DBD::mysql, DBD::SQlite, Randy Kobes PPM)

+ XAMPP Control Version 2.5.8 (ApacheFriends Edition)

+ XAMPP CLI Bundle 1.6

+ XAMPP Port Check 1.5

+ XAMPP Security 1.1

+ SQLite 2.8.17

+ SQLite 3.6.20

+ OpenSSL 0.9.8l

+ phpMyAdmin 3.2.4

+ ADOdb v5.10

+ FPDF v1.6

+ Zend Framework 1.9.6 Minimal Package (via PEAR)

+ Mercury Mail Transport System v4.72

+ msmtp 1.4.19 (a sendmail compatible SMTP client)

+ FileZilla FTP Server 0.9.33

+ Webalizer 2.21-02 (with GeoIP lite)

+ apc 3.1.3p1 for PHP

+ eAccelerator 0.9.6-rc1 for PHP

+ Ming 0.4.3 for PHP

+ PDF with pdflib lite v7.0.4p4 for PHP

+ rar 2.0.0-dev for PHP

+ Xdebug 2.0.6-dev for PHP

+ libapreq2 v2.12 (mod_apreq2) for Apache

---------------------------------------------------------------

* System Requirements:

+ 128 MB RAM

+ 320 MB free fixed disk

+ Windows 2000, XP (Server 2003), Vista (Server 2008), 7

+ all systems 32 bit (64 bit should also work)

---------------------------------------------------------------

* QUICK INSTALLATION:

[NOTE: Unpack the package to your USB stick or a partition of your choice. It must be on the highest level like E:\ or W:\. It will build E:\xampp or W:\xampp or something like this.]

Step 1: Please start the "setup_xampp.bat" and beginning the installation. Note: XAMPP makes no entries in the windows registry or adds new system variables. Step 2: Start Apache with the Control Panel (xampp-control.exe) or with => \xampp\apache_start.bat.

Stop Apache with the Control Panel (xampp-control.exe) or with => \xampp\apache_stop.bat.

Step 3: Start MySQL with the Control Panel (xampp-control.exe) or with => \xampp\mysql_start.bat.

Stop MySQL with the Control Panel (xampp-control.exe) or with => \xampp\mysql_stop.bat.

Step 4: Start your browser and type http://127.0.0.1/ or http://localhost/. You should

see our pre-made start page with certain examples and test screens.

Step 5: The root directory (main document) f黵HTTP(S) is => \xampp\htdocs. PHP files have the extension *.php, SSI *.shtml , CGI *.cgi (e.g. also for Perl scripts), Perl *.pl and ASP *.asp

Step 6: XAMPP UNINSTALL? Simply remove the "XAMPP" directory.

You can also use "uninstall_xampp.bat" to do this task.

---------------------------------------------------------------

* PASSWORDS:

1) MySQL:

User: root

Password:

(means no password!)

2) FileZilla FTP:

User: newuser

Password: wampp

User: anonymous

Password: some@https://www.360docs.net/doc/d617696388.html,

3) Mercury:

Postmaster: postmaster (postmaster@localhost)

Administrator: Admin (admin@localhost)

TestUser: newuser

Password: wampp

4) WEBDA V:

User: wampp

Password: xampp

---------------------------------------------------------------

* WINDOWS SERVICES:

- \xampp\apache\apache_installservice.bat

===> Install Apache as service

- \xampp\apache\apache_uninstallservice.bat

===> Uninstall Apache as service

- \xampp\mysql\mysql_installservice.bat

===> Install MySQL as service

- \xampp\mysql\mysql_uninstallservice.bat

===> Uninstall MySQL as service

- \xampp\filezilla\filezilla_installservice.bat

===> Install FileZilla as service

- \xampp\filezilla\filezilla_uninstallservice.bat

===> Uninstall FileZilla as service

- \xampp\mercury\mercury_installservice.bat

===> Install Mercury as service

- \xampp\mercury\mercury_uninstallservice.bat

===> Uninstall Mercury as service

Or just use the "Svc" checkboxes in the Control Panel.

----------------------------------------------------------------

A matter of security (A MUST READ!)

As mentioned before, XAMPP is not meant for production use but only for developers in a development environment. The way XAMPP is configured, is to be open as possible and allowing the developer anything he/she wants.

For development environments this is great but in a production environment it could be fatal.

Here a list of missing security in XAMPP:

- The MySQL administrator (root) has no password.

- The MySQL daemon is accessible via network.

- phpMyAdmin is accessible via network.

- Examples are accessible via network.

To fix most of the security weaknesses simply call the following URI:

http://localhost/security/

The root password for MySQL and phpMyAdmin, and also a XAMPP directory protection can being established here.

* NOTE: Some example sites can only access by the local systems, means over localhost.

---------------------------------------------------------------

* MYSQL NOTES:

MySQL starts with standard values for the username and the password. The preset username is "root", the password is "" (= no password). To access MySQL via PHP with the preset values, you'll have to use the following syntax:

mysql_connect("localhost", "root", "");

If you want to set a password for MySQL access, please use of MySQL Admin.

To set the passwort "secret" for the user "root", type the following:

\xampp\mysql\bin\mysqladmin.exe -u root -psecret

After changing the password you'll have to reconfigure phpMyAdmin to use the new password, otherwise it won't be able to access the databases. To do that, open the file config.inc.php in \xampp\phpmyadmin\ and edit the following lines: $cfg['Servers'][$i]['user'] = 'root'; // MySQL User

$cfg['Servers'][$i]['auth_type'] = 'cookie'; // HTTP authentification So first the 'root' password is queried by the MySQL server, before you can access phpMyAdmin.

---------------------------------------------------------------

* CPAN/PEAR:

CPAN and PEAR are preinstalled with only the basic packages. If you need additional packages,

you can use the XAMPP Shell (xampp_shell.bat) and install them with the command line tools:

- cpanp i Foo

- pear install Foo

相关主题
相关文档
最新文档