关闭nginx的日志
[
2009/01/14 16:37 | by askwan ]
2009/01/14 16:37 | by askwan ]
公司一下载服务器 配置的时候没有考虑日志问题 结果没几天 就20多G 相当恐怖啊
考虑这些日志对工作几乎没啥利用价值 直接关闭之
access_log /dev/null;
error_log /dev/null;
全部把他们丢到系统的黑洞里 这下安逸了
不用每时每刻都往系统磁盘疯狂的读写日志了 还延长硬盘的寿命
考虑这些日志对工作几乎没啥利用价值 直接关闭之
access_log /dev/null;
error_log /dev/null;
全部把他们丢到系统的黑洞里 这下安逸了
不用每时每刻都往系统磁盘疯狂的读写日志了 还延长硬盘的寿命
特别是做下载的站 不限制下客户端的连接线程数和客户端的下载带宽 web服务器有限的连接资源以及服务器带宽资源很快被耗尽 如今下载工具越来越强大 对做下载站的同仁都是比较棘手的事情 不仅如此 被其他工具或者其他网站盗链也是很头痛的事情 防盗链的方法相信各位都有高招应付 这里记录一下自己用nginx做下载用的服务器防盗链和限制线程和带宽的方法
先说防盗链
防盗链很多都是做rewrite,判断referer是否有效,对图片类比较有效,对web服务器来说,apache有rewrite模块支持
nginx则有ngx_http_referer_module模块支持,配置简单,nginx举例
但referer的伪造都很easy,所以这种方式的防盗链层次较浅
在nginx 的wiki站了解到一个第三方模块ngx_http_accesskey_module,通过自己测试,能有效的防盗链,特别是对于文件下载站的防盗链非常有效。
有关这个模块的一些文档在这里去看:http://wiki.codemongers.com/NginxHttpAccessKeyModule
举例一个
先说防盗链
防盗链很多都是做rewrite,判断referer是否有效,对图片类比较有效,对web服务器来说,apache有rewrite模块支持
nginx则有ngx_http_referer_module模块支持,配置简单,nginx举例
Quotation
location ~* \.(gif|jpg|png)$ {
valid_referers none blocked www.askwan.com baidu.com;
if ($invalid_referer) {
rewrite ^/ http://www.askwan.com/error.html;
}
}
valid_referers none blocked www.askwan.com baidu.com;
if ($invalid_referer) {
rewrite ^/ http://www.askwan.com/error.html;
}
}
在nginx 的wiki站了解到一个第三方模块ngx_http_accesskey_module,通过自己测试,能有效的防盗链,特别是对于文件下载站的防盗链非常有效。
有关这个模块的一些文档在这里去看:http://wiki.codemongers.com/NginxHttpAccessKeyModule
举例一个
网页截图工具khtml2png
[
2008/12/22 13:03 | by askwan ]
2008/12/22 13:03 | by askwan ]
khtml2png is a command line program to create PNG images out of webpages. Despite the name, it can also produce JPEG images.
下载:
http://khtml2png.sourceforge.net/
或者
http://www.sourceforgecn.net/Projects/k/kh/khtml2png/
Requirements:
g++
KDE 3.x
kdelibs for KDE 3.x (kdelibs4-dev)
zlib (zlib1g-dev)
cmake
我以centos5.2为例
Khtml2png基于KDE,要用到Konqueror浏览器
安装必须的包
安装中文语言包,否则中文字符乱码
编译安装cmake
安装khtml2png
下载:
http://khtml2png.sourceforge.net/
或者
http://www.sourceforgecn.net/Projects/k/kh/khtml2png/
Requirements:
g++
KDE 3.x
kdelibs for KDE 3.x (kdelibs4-dev)
zlib (zlib1g-dev)
cmake
我以centos5.2为例
Khtml2png基于KDE,要用到Konqueror浏览器
安装必须的包
Quotation
yum install gcc gcc-c++ automake autoconf nano zlib zlib-devel kdelibs kdelibs-devel
yum groupinstall "X Window System" "KDE (K Desktop Environment)"
yum install Xvfb xorg "xorg-x11-font*"
yum install qt*
yum groupinstall "X Window System" "KDE (K Desktop Environment)"
yum install Xvfb xorg "xorg-x11-font*"
yum install qt*
安装中文语言包,否则中文字符乱码
Quotation
yum install fonts-chinese fonts-ISO8859-2-75dpi
编译安装cmake
Quotation
wget http://www.cmake.org/files/v2.6/cmake-2.6.2.tar.gz
tar -zxvf cmake-2.6.2.tar.gz
cd cmake-2.6.2
./bootstrap
make
make install
tar -zxvf cmake-2.6.2.tar.gz
cd cmake-2.6.2
./bootstrap
make
make install
安装khtml2png
HTTP协议追踪与挂站脚本漏洞XST
[
2008/12/18 13:05 | by askwan ]
2008/12/18 13:05 | by askwan ]
在服务器漏洞常规扫描报告发现这个问题 这里小结一下
看标准漏洞描述:
简单的说就是如果web服务器支持HTTP TRACE 和 TRACK 方法就可能会扫描出这个缺陷或者漏洞,
导致可能的XST跨站方式的脚本攻击,而我们的web服务器,以apache为例,默认都是开启并支持TRACE TRACK的,随便
扫描一个网络的C类IP段,会发现七成web服务器都有这个问题,这不得不引起我们的重视。
看标准漏洞描述:
Quotation
The remote webserver supports the TRACE and/or TRACK methods. TRACE
and TRACK are HTTP methods which are used to debug web server
connections.
In addition, it has been shown that servers supporting the TRACE
method are subject to cross-site scripting attacks, dubbed XST for
"Cross-Site Tracing", when used in conjunction with various weaknesses
in browsers. An attacker may use this flaw to trick your legitimate
web users to give him their credentials.
and TRACK are HTTP methods which are used to debug web server
connections.
In addition, it has been shown that servers supporting the TRACE
method are subject to cross-site scripting attacks, dubbed XST for
"Cross-Site Tracing", when used in conjunction with various weaknesses
in browsers. An attacker may use this flaw to trick your legitimate
web users to give him their credentials.
简单的说就是如果web服务器支持HTTP TRACE 和 TRACK 方法就可能会扫描出这个缺陷或者漏洞,
导致可能的XST跨站方式的脚本攻击,而我们的web服务器,以apache为例,默认都是开启并支持TRACE TRACK的,随便
扫描一个网络的C类IP段,会发现七成web服务器都有这个问题,这不得不引起我们的重视。





