09/03 20
Here are the notes for installing Zope and Plone from source in Ubuntu. I took this notes installing on 7.10 (Gutsy) but should work without problems for earlier Ubuntu versions, and for other Linux platforms
Tags: , ,
09/03 19

PHP 才入门? 不指定

jason , 14:50 , 我的收藏 » PHP , 评论(0) , 引用(0) , 阅读(596) , Via 本站原创
刚看到一篇文章 <40个迹象表明你还是PHP菜鸟> 。
补充一篇:  PHP程序员的40点陋习
贴出来,给大家评评。。。
Tags:
09/03 15
VitrualBox2.0.4下安装的Ubuntu8.10默认分辨率只有800x600,非常小,看起来很不舒服(全屏也是这个大小,周围全是黑色)。
解决方法如下:....
Tags:
09/03 11
If you've graduated from using Ferret you may have heard of the joys of Sphinx Search. Regardless of which plugin you use (there are several) you'll need to install Sphinx itself. If you're running Ubuntu Intrepid Ibex then these instructions are for you. That said, this will work on Debian or Ubuntu Hardy as well.
Tags: ,
09/03 10
改变ubuntu 下mysql 的 datadir
Tags: ,
09/03 9
Tokyo Cabinet是日本人平林幹雄开发的一款DBM数据库,该数据库读写非常快。但是单单的TC数据库,用处不大,宿主程序需要进行很多开发。TC的作者开发了Tokyo Tyrant(TT)这个网络服务程序,除了自己的二进制协议,还提供了现在被广泛应用的HTTP协议,memcached协议来访问TC数据库,这样一来,一下子就扩展了TC的使用范围,让TC从一个单纯的开发库变成了易用,高效的数据库系统。

Tokyo Tyrant是由同一作者开发的 Tokyo Cabinet 数据库网络接口。它拥有Memcached兼容协议,也可以通过HTTP协议进行数据交换。
Tokyo Tyrant 加上 Tokyo Cabinet,构成了一款支持高并发的分布式持久存储系统,对任何原有Memcached客户端来讲,可以将Tokyo Tyrant看成是一个Memcached,但是,它的数据是可以持久存储的。
Tags:
09/03 7

一. 介绍
mod_security是一个集入侵检测和防御引擎功能的开源web应用安全程序(或web应用程序防火墙).
它以Apache Web服务器的模块方式运行, 目标是增强web应用程序的安全性, 防止web应用程序
受到已知或未知的攻击.

本文使用的系统是Redhat linux高级服务器版3, 推荐大家使用modsecurity的最新稳定发行版,
现在是1.8.7, 安装方式是通过DSO(动态共享对象)把mod_security集成到Apache Web Server.
(提示, 本文的步骤在其它linux发行版上也是适用的.)

二. 准备
1. 需要的软件包
1). apache的源代码包
下载地址:
http://apache.justdn.org/httpd/apache_1.3.33.tar.gz

2). mod_security的源代码包
下载地址:
http://www.modsecurity.org/download/modsecurity-1.8.7.tar.gz

3). mod_security基本规则
http://fedoranews.org/jorge/mod_security/mod_security.conf

2. 下载和解压缩Apache HTTP软件包.
建议从apache的官方网站获得可靠的apache HTTP软件包.
下载网址: http://apache.justdn.org/httpd/apache_1.3.33.tar.gz

1) 创建apache软件包存放的目录.
#mkdir -p /usr/local/src/webserver

2) 使用wget命令获得源代码包.
#wget http://apache.tarchive.com/httpd/apache_1.3.33.tar.gz
(如不能下载, 可直接通过浏览器保存或ftp上传到webserver目录)

3) 确认下载软件的完整性.
首先, 我们下载和检查分离的签名文件apache_1.3.33.tar.gz.md5, 然后进行
比较软件包和软件包md5签名文件的md5 checksum.

检查apache_1.3.33.tar.gz.md5内容
# cat apache_1.3.33.tar.gz.md5
MD5 (apache_1.3.33.tar.gz) = 3dfd2c3778f37a2dfc22b97417a61407

检查apache_1.3.33.tar.gz的md5 checksum
# md5sum apache_1.3.33.tar.gz
3dfd2c3778f37a2dfc22b97417a61407 apache_1.3.33.tar.gz

比较上面两个步骤的md5 checksum内容是一致的, 从而可以确认apache软件包
的完整性.

4) 解压缩源代码包, 在webserver目录下会生成一个新的目录apache_1.3.33
#tar zpxf apache_1.3.33.tar.gz

3. 下载和解压缩modsecurity软件包.
建议从modsecurity官方网站获得可靠的软件包.
下载网址: http://www.modsecurity.org/download/index.html

1) 使用wget命令获得源代码包.
#wget http://www.modsecurity.org/download/modsecurity-1.8.7.tar.gz
(如不能下载, 可直接通过浏览器保存或ftp上传到webserver目录)

# ls -al modsecurity-1.8.7.tar.gz
-rw-r--r-- 1 root root 313004 Mar 5 23:47 modsecurity-1.8.7.tar.gz

# pwd
/usr/local/src/webserver

2) 确认下载软件的完整性.
首先, 我们下载和检查分离的签名文件modsecurity-1.8.7.tar.gz.md5, 然后进行
比较软件包和软件包md5签名文件的md5 checksum.

下载modsecurity的签名文件
#wget http://www.modsecurity.org/download/modsecurity-1.8.7.tar.gz.md5

检查modsecurity-1.8.7.tar.gz.md5内容
#cat modsecurity-1.8.7.tar.gz.md5
0dd48656e451c711358c097dc80e0369 modsecurity-1.8.7.tar.gz

检查modsecurity-1.8.7.tar.gz的md5 checksum
# md5sum modsecurity-1.8.7.tar.gz
0dd48656e451c711358c097dc80e0369 modsecurity-1.8.7.tar.gz

比较上面两个步骤的md5 checksum内容是一致的, 从而可以确认modsecurity软件包
的完整性.

3) 解压缩源代码包, 在webserver目录下会生成一个新的目录modsecurity-1.8.7
#tar zpxf modsecurity-1.8.7.tar.gz

4. 下载modsecurity规则文件
#cd /usr/local/src/webserver
#wget http://fedoranews.org/jorge/mod_security/mod_security.conf


三. 安装Apache和Modsecurity

1. 安装Apache

请参考文章:
在Redhat Linux 9上通过DSO方式搭建Apache HTTP服务器
http://bbs.islab.org/showthread.php?t=370

注: 在Red Hat 9上安装Apache的步骤亦可用其它系统上.

2. 安装Modsecurity

到modsecurity的apache 1.X 模块目录运行apxs(你必须要root权限才能运行下面命令).

#cd /usr/local/src/webserver/modsecurity-1.8.7/apache1

[root@reakosys apache1]# /www/bin/apxs -cia mod_security.c
gcc -DLINUX=22 -DHAVE_SET_DUMPABLE -I/usr/include/gdbm -DUSE_HSREGEX -fpic
-DSHARED_MODULE -I/www/include -c mod_security.c
gcc -shared -o mod_security.so mod_security.o
[activating module `security' in /www/conf/httpd.conf]
cp mod_security.so /www/libexec/mod_security.so
chmod 755 /www/libexec/mod_security.so
cp /www/conf/httpd.conf /www/conf/httpd.conf.bak
cp /www/conf/httpd.conf.new /www/conf/httpd.conf
rm /www/conf/httpd.conf.new

复制modsecurity规则文件到apache的conf目录
#cd /usr/local/src/webserver
#cp mod_security.conf /www/conf/

创建日志目录
#mkdir - /var/log/httpd

修改apache配置文件
#vi /www/conf/httpd.conf
在文件末尾添加
Include conf/mod_security.conf

注: 到此为止, httpd.conf文件已包含下面三行代码(1,2条为自动, 3条手动添加)
LoadModule security_module libexec/mod_security.so
AddModule mod_security.c
Include conf/mod_security.conf

然后重启你的Apache Web Server..
# apachectl restart
/usr/sbin/apachectl restart: httpd not running, trying to start
/usr/sbin/apachectl restart: httpd started

检查一下是否生成日志文件
# ls -al
total 8
drwxr-xr-x 2 root root 4096 May 22 21:29 .
drwxr-xr-x 10 root root 4096 May 22 21:02 ..
-rw------- 1 root root 0 May 22 21:18 audit_log
-rw------- 1 root root 0 May 22 21:18 modsec_debug_log

modsecurity的配置文件mod_security.conf位于apache的配置目录conf中, 日志文件
是/var/log/httpd/audit_log.

modsecurity配置文件包含了一些非常基础的规则设置, 这对于一般的站点而言是足够了.
如果你有什么特殊的需求, 更多可以参考下面的网址:
http://www.modsecurity.org/documentation/index.html

下面将介绍mod_security.conf配置文件.


四. Modsecurity配置文件


# Turn the filtering engine On or Off
SecFilterEngine On

分析每一个http请求

# Make sure that URL encoding is valid
SecFilterCheckURLEncoding On

URL编码确认

# Only allow bytes from this range
SecFilterForceByteRange 32 126

字节范围检查, 以有效防止stack overflow attacks(栈溢出攻击).

# The audit engine works independently and
# can be turned On of Off on the per-server or
# on the per-directory basis
SecAuditEngine RelevantOnly

有效解决apache日志对某个用户或攻击者信息记录的不足. 如果要
对某一个用户或攻击者发出的一个请求的详细记录, 可以访问
/var/log/httpd/audit_log文件.

# The name of the audit log file
SecAuditLog /var/log/httpd/audit_log

SecFilterDebugLog /var/log/httpd/modsec_debug_log
SecFilterDebugLevel 0

设置调试模式下的输出文件.

# Should mod_security inspect POST payloads
#SecFilterScanPOST On

# Action to take by default
SecFilterDefaultAction "deny,log,status:406"

设置特别的行动, 406为行动名称, 前面的三个为行动参数.

# Redirect user on filter match
#SecFilter xxx redirect:http://www.webkreator.com

# Execute the external script on filter match
#SecFilter yyy log,exec:/home/ivanr/apache/bin/report-attack.pl

# Simple filter
#SecFilter 111

# Only check the QUERY_STRING variable
#SecFilterSelective QUERY_STRING 222

# Only check the body of the POST request
#SecFilterSelective POST_PAYLOAD 333

# Only check arguments (will work for GET and POST)
#SecFilterSelective ARGS 444

# Test filter
#SecFilter "/cgi-bin/keyword"

# Another test filter, will be denied with 404 but not logged
# action supplied as a parameter overrides the default action
#SecFilter 999 "deny,nolog,status:404"

# Prevent OS specific keywords
#SecFilter /etc/password

# Prevent path traversal (..) attacks
SecFilter "\.\./"

阻止目录周游攻击.

# Weaker XSS protection but allows common HTML tags
SecFilter "<( |\n)*script"

对不安全的(跨站点脚本)XSS进行保护, 但允许普通的HTML标识.

# Prevent XSS atacks (HTML/javascript injection)
SecFilter "<(.|\n)+>"

防止XSS攻击 (HTML/javascript注射)

# Very crude filters to prevent SQL injection attacks
SecFilter "delete[[:space:]]+from"
SecFilter "insert[[:space:]]+into"
SecFilter "select.+from"

防止SQL注射攻击

# Require HTTP_USER_AGENT and HTTP_HOST headers
SecFilterSelective "HTTP_USER_AGENT|HTTP_HOST" "^$"

需要 HTTP_USER_AGENT和HTTP_HOST头.

# Forbid file upload
#SecFilterSelective "HTTP_CONTENT_TYPE" multipart/form-data

# Only watch argument p1
#SecFilterSelective "ARG_p1" 555

# Watch all arguments except p1
#SecFilterSelective "ARGS|!ARG_p2" 666

# Only allow our own test utility to send requests (or Mozilla)
#SecFilterSelective HTTP_USER_AGENT "!(mod_security|mozilla)"

# Do not allow variables with this name
#SecFilterSelective ARGS_NAMES 777

# Do now allow this variable value (names are ok)
#SecFilterSelective ARGS_VALUES 888

# Stop spamming through FormMail
# note the exclamation mark at the beginning
# of the filter - only requests that match this regex will
# be allowed
#
#SecFilterSelective "ARG_recipient" "!@webkreator.com$"
#

# when allowing upload, only allow images
# note that this is not foolproof, a determined attacker
# could get around this
#
#SecFilterInheritance Off
#SecFilterSelective POST_PAYLOAD "!image/(jpeg|bmp|gif)"
#


五. 更多

关于作者: os, 操作系统研究和安全工程师.
思蓝安全论坛是一个致力于linux安全的论坛. 欢迎技术交流.

原文出处: 思蓝安全论坛
http://bbs.islab.org/showthread.php?t=760

Tags:
09/03 6
GIT 是用于 Linux 内核开发的版本控制工具。与常用的版本控制工具 CVS, Subversion 等不同,它采用了分布式版本库的方式,不必服务器端软件支持,使源代码的发布和交流极其方便。 Git 的速度很快,这对于诸如 Linux kernel 这样的大项目来说自然很重要。 Git 最为出色的是它的合并跟踪(merge tracing)能力。
Tags:
分页: 21/24 第一页 上页 16 17 18 19 20 21 22 23 24 下页 最后页 [ 显示模式: 摘要 | 列表 ]