标题:
[BUG反馈]
wdcp nginx php5.2.17存在跨站,以及解决方法。
[打印本页]
作者:
hackhyj
时间:
2013-3-16 13:13
标题:
wdcp nginx php5.2.17存在跨站,以及解决方法。
nginx php5.2.17存在跨站,没有像apache那样可以限制open_base_dir限制目录的功能。
但是可以通过修改源码解决跨站问题。
tar zxvf php-5.2.17.tar.gz 解压
gzip -cd php-5.2.17-fpm-0.5.14.diff.gz | patch -fd php-5.2.17 -p1 php5.2.17打上php-fpm补丁,5.2不支持!
cd php-5.2.17
vim main/fopen_wrappers.c
找到234行,添加如下代码:
code
//nginx 5.2.17防止跨站
///*添加开始, add by 黄云建 QQ:22327635*/
char *env_doc_root;
env_doc_root = sapi_getenv("DOCUMENT_ROOT", sizeof("DOCUMENT_ROOT")-1 TSRMLS_CC);
if(env_doc_root){
int res_root = php_check_specific_open_basedir(env_doc_root, path TSRMLS_CC);
efree(env_doc_root);
if (res_root == 0) {
return 0;
}
}
// 添加的内容结束
如图一所示
下载
(49.42 KB)
2013-3-16 13:12
编译
./configure --prefix=/www/wdlinux/nginx_php-5.2.17 \--with-config-file-path=/www/wdlinux/nginx_php-5.2.17/etc \
--with-mysql=/www/wdlinux/mysql --with-mysqli=/www/wdlinux/mysql/bin/mysql_config \
--with-iconv=/usr \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-bz2 \
--with-libxml-dir=/usr \
--enable-xml --disable-rpath \
--enable-discard-path \
--enable-inline-optimization \
--with-curl --enable-mbregex \
--enable-mbstring \
--with-mcrypt=/usr \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-ftp \
--enable-sockets \
--enable-zip \
--enable-fastcgi \
--enable-fpm \
--with-fpm-conf=/www/wdlinux/etc/php-fpm.conf
make
make install
修改php.ini
open_basedir = "/tmp;/var/tmp;/proc"
重启service php-fpm restart
图片附件:
1.jpg
(2013-3-16 13:12, 49.42 KB) / 下载次数 6499
http://wdlinux.cn/bbs/attachment.php?aid=2530&k=cb12b05252d9d5e3c10065def27c2963&t=1729382514&sid=vW5QVe
作者:
admin
时间:
2013-3-16 17:34
这个修改方式,很早的时候就有了,只是没实际应用过,不确定是否有影响,所以默认没加上
作者:
sanlang
时间:
2013-3-17 16:08
回复
2#
admin
老大 求助您一个问题
linux装了wd
安装phpwind9无法登陆 地址:www.tongren365.com
提示错误:
Sorry, CSRF verification failed(token missing or incorrect),refresh to try again.
环境哪里配置的有问题? 该怎么做?
作者:
marquis
时间:
2013-3-18 21:20
回复
3#
sanlang
是论坛首页不能登录?
作者:
sanlang
时间:
2013-3-20 09:32
回复
4#
marquis
解决了
作者:
企鹅
时间:
2013-11-12 15:12
回复
1#
hackhyj
按照你的办法,一切都ok了。但是问题还没解决,webshell 还是可以访问所有的目录。
欢迎光临 WDlinux官方论坛 (http://wdlinux.cn/bbs/)
Powered by Discuz! 7.2