PHP头条
热点:

Win2000ApachePHPMySQL安装及安全手册_MySQL


Apache手册mysql安装


  所需要的程序:
  
  apache
  http://www.apache.org/dist/httpd/binaries/win32/
  我们选用apache_1.3.28-win32-x86-no_src.msi,或者apache_2.0.47-win32-x86-no_ssl.msi
  都可以,勿使用低版本的程序,它们有缺陷,很容易遭到internet上的攻击
  
  php
  http://cn2.php.net/get/php-4.3.3-Win32.zip/from/a/mirror
  php-4.3.3
  
  mysql
  http://www.mysql.com/get/Downloa ... 5-win.zip/from/pick
  mysql-4.0.15
  注:低于这个版本的mysql,有缺陷,勿使用
  
  ZendOptimizer-2[1].1.0a-Windows-i386.exe
  php的优化器,支持加密php脚本
  
  MySQL-Front
  一个运行于ms平台的gui的mysql的管理器,非常好用
  
  phpMyAdmin-2.5.0-php.zip
  基于php脚本的mysql管理器
  
  phpencode.exe
  php加密编译器
  
  install~
  1.安装apache
  由于安装很简单,pass~!,只是要注意的是,请勿安装到系统分区上
  因为这样,无论从备份,维护,灾难性恢复上,都是有优势的.
  假设安装到了d:\2.安装php
  具体安装过程请参考php目录里的install.txt
  需要注意的是,请勿使用cgi方式
  以下为引用资料
  ------------------------------------------------------------------
  Title 17/2/2002
  PHP for Windows Arbitrary Files Execution (GIF, MP3)
  Summary
  Through PHP.EXE, an attacker can cause PHP to interpret any file as a PHP file,
  even if its extensions are not PHP. This would enable the remote attacker to
  execute arbitrary commands, leading to a system compromise.
  Details
  Vulnerable systems:
  PHP version 4.1.1 under Windows
  PHP version 4.0.4 under Windows
  An attacker can upload innocent looking files (with mp3, txt or gif extensions)
  through any uploading systems such as WebExplorer (or any other PHP program that
  has uploading capabilities), and then request PHP to execute it.
  Example:
  After uploading a file a \"gif\" extension (in our example huh.gif) that contains
  PHP code such as:
  #------------
    phpinfo();
  ?>
  #------------
  An attacker can type the following address to get in to cause the PHP file to be
  executed:
  http://www.example.com/php/php.exe/UPLOAD_DIRECTORY/huh.gif
  Notice: php/php.exe is included in the URL.
  Additional information
  The information has been provided by CompuMe and RootExtractor.
  ps:大部分版本都有这个毛病.包括一些最新版本,所以请不要以cgi安装!切记...
  3.安装mysql
  安装到d:\\,也很简单,具体过程pass.
  只是mysql安装后的默认设置实在让人担心
  
  默认安装的mysql服务不安全因素涉及的内容有:
  
  一.mysql默认的授权表
  
  由于mysql对身份验证是基于mysql这个数据库的,也叫授权表。所有的权限设置都在这里了。
  我们只讨论最为重要的一个表 user表。它控制的是接受或拒绝连接。
  先看一下
  select host,user,password,Delete_priv from user;
  +-----------+------+------------------+-------------+
  | host | user | password | Delete_priv |
  +-----------+------+------------------+-------------+
  | localhost | root | 67457e226a1a15bd | Y |
  | % | root | | Y |
  | localhost | | | Y |
  | % | | | N |
  +-----------+------+------------------+-------------+
  现在新的版本,安装完毕都会出现一个快速设置窗口,用于设置口令。
  以上,就是user表里的内容(略了点)看看有什么问题?
  我们知道mysql的验证方式是比较特殊的,它基于两个2个信息来进行的
  1.从那里连接
  2.用户名
  第一条没什么问题,当然口令必须是安全的。
  第二条从任何主机,以用户root,不需要口令都可以连接,权限为所有的权限。(注:这里的权限是全局权限)
  第三条从本地主机,任何用户名(注:user为空白,不表示不需要用户名),不需要口令,都可以连接,所有的权限
  第四条从任何主机,任何用户名,不需要口令,都可以连接,无任何权限。
  可以看出,2\\3\\4都是不安全的,如何攻击这里就不说了,请参看资料文库。
  如果你mysql只允许本地连接,删除host的%和user中的nul(表示空)
  delete from user where host=‘%‘;
  delete from host where user=‘‘;
  最后的user表,看起来因该是这个样子
  +-----------+------+------------------+-------------+
  | host | user | password | Delete_priv |
  +-----------+------+------------------+-------------+
  | localhost | root | 67457e226a1a15bd | Y |
  +-----------+------+------------------+-------------+
  最后需要刷新授权表,使其立刻生效
  flush privileges;
  如果你的mysql需要被远程使用,需要为%段中的root帐号,加上一个安全的密码
  update user set password=password(‘youpass‘) where host=‘%‘;
  其中youpass,就是口令
  mysql> select host,user,password,Delete_priv from user;
  +-----------+------+------------------+-------------+
  | host | user | password | Delete_priv |
  +-----------+------+------------------+-------------+
  | localhost | root | 67457e226a1a15bd | Y |
  | % | root | 77c590fa148bc9fb | Y |
  +-----------+------+------------------+-------------+
  更好的做法是,对远程主机的连接,指定为特定的
  修改host中的%为允许连接的主机,比如:
  192.168.0.% 允许一个特定的子网
  www.sandflee.net 允许一个特定的主机
  帐号默认的名字也是担心的问题。有可能导致被暴力破解
  update user set user=‘localadmin‘ where host=‘localhost‘;
  update user set user=‘remoteadmin‘ where host=‘%‘;
  最后的user表看起来像是这个样子
  mysql> select host,user,password,Delete_priv from user;
  +-----------+-------------+------------------+-------------+
  | host | user | password | Delete_priv |
  +-----------+-------------+------------------+-------------+
  | localhost | localadmin | 67457e226a1a15bd | Y |
  | % | remoteadmin | 77c590fa148bc9fb | Y |
  +-----------+-------------+------------------+-------------+
  更为详细的资料,请去参考晏子的《MySQL中文参考手册》。随便那都有下
  
  二.缺乏日志能力
  
  mysql安装完成以后,会在%SystemRoot%目录下产生my.ini的设置文件
  默认的内容如下:
  ——————————————————————————————
  basedir=C:/mysql
  #bind-address=192.168.0.1
  datadir=C:/mysql/data
  #language=C:/mysql/share/your language directory
  #slow query log#=
  #tmpdir#=
  #port=3306
  #set-variable=key_buffer=16M
  [WinMySQLadmin]
  Server=C:/mysql/bin/mysqld-nt.exe
  user=root
  password=root
  ———————————————————————————————
  注意log#=这个
  它没有被定义,且被注销掉了。
  更改为一个适合的路径,比如:
  log=c:/mysql/logs/mysql.log
  
  三.my.ini文件泄露口令
  
  我们看到my.ini最后,有这两句
  user=root
  password=root
  如果,你安装完成时,使用了mysql所提供的快速设置功能,(较新的版本)你的帐号和口令将被写到my.ini文件中。
  这也是mysql写到启动组里的winmysqladmin.exe工具,运行时需要读取的。它提供的mysql服务
  的一些监视功能。这样winmysqladmin.exe才能获得mysql服务的状态信息。
  其实,这个也不算漏洞,我们看看my.ini默认的权限,它可以被user组用户读取。
  从而导致口令被泄露
  解决方法:
  从新设定my.ini文件的权限.
  从新设定帐号及口令
  不使用快速设置
  
  四.服务默认被绑定全部的网络接口上
  
  服务被绑定到了所有的网络接口上,比如,你只需要一个运行在内网的mysql服务,但是你的机器有
  外网的接口,mysql也会被绑定上,从而带来一些不必要的麻烦和威胁。
  在my.ini里的这句
  #bind-address=192.168.0.1
  它默认被注销掉了
  应该打开它
  如果,只是本地使用,更改为
  bind-address=127.0.0.1
  如果是其它情况,应该选者一个合适的网络接口
  
  五.默认安装路径下的mysql目录权限
  
  mysql默认的安装路径为c:\\mysql,基本上都难得改,要改的话也是麻烦,还要去改my.ini。
  但,这样就有个问题
  通常c:\\的权限是everyone组-所有的权限。这是默认的

www.phpzy.comtrue/phpyy/7100.htmlTechArticleWin2000ApachePHPMySQL安装及安全手册_MySQL Apache手册mysql安装 所需要的程序: apache http://www.apache.org/dist/httpd/binaries/win32/ 我们选用apache_1.3.28-win32-x86-no_src.msi,或者apache_2.0.47-win32-x86-no_ssl.msi...

相关文章

相关频道:

PHP之友评论

今天推荐