Jul
31
指向服务器经常受全链接攻击,以前的处理方法只是删除域名。原apache的256链接数经常因此占满。服务有问题。
相变更apache 链接数的想法是早就想操作了。但一直拖着。
今天趁着服务器再次因全链接受攻击而无法正常访问。实施链接数变更操作。
搜索了一下,发现操作不难。重编译一下apache即可。
方法如下:
apache1.3变更链接数。
vi /usr/local/apache_1.3.41/src/include/httpd.h
#ifndef HARD_SERVER_LIMIT
#ifdef WIN32
#define HARD_SERVER_LIMIT 1024
#elif defined(NETWARE)
#define HARD_SERVER_LIMIT 2048
#else
#define HARD_SERVER_LIMIT 256
#endif
#endif
将这里的256改成 2048支持2048个链接。
重编译后
编辑一下httpd.conf 将其最大链接数改成2048即可。
用/usr/local/apache/bin/ab -n 1000000 -c 1000 http://www.oicq6.cn/ 测试
OK链接数在超过700后。亦可以正常提供服务。操作完毕。
相变更apache 链接数的想法是早就想操作了。但一直拖着。
今天趁着服务器再次因全链接受攻击而无法正常访问。实施链接数变更操作。
搜索了一下,发现操作不难。重编译一下apache即可。
方法如下:
apache1.3变更链接数。
vi /usr/local/apache_1.3.41/src/include/httpd.h
#ifndef HARD_SERVER_LIMIT
#ifdef WIN32
#define HARD_SERVER_LIMIT 1024
#elif defined(NETWARE)
#define HARD_SERVER_LIMIT 2048
#else
#define HARD_SERVER_LIMIT 256
#endif
#endif
将这里的256改成 2048支持2048个链接。
重编译后
编辑一下httpd.conf 将其最大链接数改成2048即可。
用/usr/local/apache/bin/ab -n 1000000 -c 1000 http://www.oicq6.cn/ 测试
OK链接数在超过700后。亦可以正常提供服务。操作完毕。
Jul
29
vi .bashrc
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
datestamp_history(){
export infodate=`date "+: %c"`
export infohis=`history 1`
echo $infodate' => '$infohis >> $HOME/.history-timestamp
}
export PROMPT_COMMAND=datestamp_history
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
datestamp_history(){
export infodate=`date "+: %c"`
export infohis=`history 1`
echo $infodate' => '$infohis >> $HOME/.history-timestamp
}
export PROMPT_COMMAND=datestamp_history
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
查看history-timestamp即可
Jul
22
今天收到一老外反馈VS主机的网络问题,发现其使用的是MTR命令。赶紧google一下,才发现这是个不错的工具。
其是ping与tracert(traceroute)的结合体。
每次对路由过程中的主机发送16个ping数据包。接收到回应包与发送包的比例。 最小延迟,平均延迟及最大延迟数据。
[root@shbackup ~]# mtr -r google.com
HOST LOSS RCVD SENT BEST AVG WORST
211.152.50.1 0% 16 16 0.60 8.37 101.02
211.152.63.145 0% 16 16 0.65 0.78 1.14
211.152.63.122 0% 16 16 0.47 0.61 0.92
61.152.87.173 0% 16 16 1.14 6.86 20.33
61.152.86.58 0% 16 16 1.35 6.45 15.87
202.97.33.22 0% 16 16 1.11 5.32 14.42
202.97.33.190 0% 16 16 1.69 9.78 57.16
202.97.61.50 0% 16 16 32.20 37.33 49.55
202.97.62.214 0% 16 16 29.45 36.10 51.84
209.85.241.56 0% 16 16 32.31 37.81 46.64
209.85.252.105 0% 16 16 86.05 95.70 138.06
209.85.248.131 0% 16 16 398.81 407.71 456.25
216.239.43.193 7% 15 16 398.16 405.34 416.77
66.249.95.210 7% 15 16 401.69 410.23 441.94
209.85.242.255 19% 13 16 331.20 336.77 348.11
72.14.239.137 19% 13 16 333.17 346.07 429.56
72.14.236.175 7% 15 16 332.48 342.45 361.39
216.239.43.249 7% 15 16 332.46 339.97 349.59
jc-in-f99.google.com 7% 15 16 334.40 339.32 348.20
观察路由状况很好的工具~
[root@shbackup ~]# mtr -r --no-dns yahoo.com
HOST LOSS RCVD SENT BEST AVG WORST
211.152.50.1 0% 16 16 0.61 0.97 4.66
211.152.63.145 0% 16 16 0.65 0.75 1.20
211.152.63.122 0% 16 16 0.39 0.68 1.15
61.152.87.189 0% 16 16 0.93 1.14 1.50
61.152.86.22 0% 16 16 1.48 1.83 3.41
202.97.33.186 0% 16 16 24.43 27.29 33.02
202.97.51.150 0% 16 16 182.56 182.84 183.90
218.30.54.74 0% 16 16 182.52 182.97 187.00
216.115.107.59 0% 16 16 180.38 192.35 210.58
209.131.32.17 0% 16 16 180.31 189.12 210.32
68.180.206.184 7% 15 16 180.27 191.34 199.95
WinMTR description
WinMTR is a windows clone of popular Matt's traceroute Linux program
WinMTR is a windows clone of popular Matt's traceroute Linux program.
It's a combination between ping and tracert commands.
其是ping与tracert(traceroute)的结合体。
每次对路由过程中的主机发送16个ping数据包。接收到回应包与发送包的比例。 最小延迟,平均延迟及最大延迟数据。
[root@shbackup ~]# mtr -r google.com
HOST LOSS RCVD SENT BEST AVG WORST
211.152.50.1 0% 16 16 0.60 8.37 101.02
211.152.63.145 0% 16 16 0.65 0.78 1.14
211.152.63.122 0% 16 16 0.47 0.61 0.92
61.152.87.173 0% 16 16 1.14 6.86 20.33
61.152.86.58 0% 16 16 1.35 6.45 15.87
202.97.33.22 0% 16 16 1.11 5.32 14.42
202.97.33.190 0% 16 16 1.69 9.78 57.16
202.97.61.50 0% 16 16 32.20 37.33 49.55
202.97.62.214 0% 16 16 29.45 36.10 51.84
209.85.241.56 0% 16 16 32.31 37.81 46.64
209.85.252.105 0% 16 16 86.05 95.70 138.06
209.85.248.131 0% 16 16 398.81 407.71 456.25
216.239.43.193 7% 15 16 398.16 405.34 416.77
66.249.95.210 7% 15 16 401.69 410.23 441.94
209.85.242.255 19% 13 16 331.20 336.77 348.11
72.14.239.137 19% 13 16 333.17 346.07 429.56
72.14.236.175 7% 15 16 332.48 342.45 361.39
216.239.43.249 7% 15 16 332.46 339.97 349.59
jc-in-f99.google.com 7% 15 16 334.40 339.32 348.20
观察路由状况很好的工具~
[root@shbackup ~]# mtr -r --no-dns yahoo.com
HOST LOSS RCVD SENT BEST AVG WORST
211.152.50.1 0% 16 16 0.61 0.97 4.66
211.152.63.145 0% 16 16 0.65 0.75 1.20
211.152.63.122 0% 16 16 0.39 0.68 1.15
61.152.87.189 0% 16 16 0.93 1.14 1.50
61.152.86.22 0% 16 16 1.48 1.83 3.41
202.97.33.186 0% 16 16 24.43 27.29 33.02
202.97.51.150 0% 16 16 182.56 182.84 183.90
218.30.54.74 0% 16 16 182.52 182.97 187.00
216.115.107.59 0% 16 16 180.38 192.35 210.58
209.131.32.17 0% 16 16 180.31 189.12 210.32
68.180.206.184 7% 15 16 180.27 191.34 199.95
WinMTR description
WinMTR is a windows clone of popular Matt's traceroute Linux program
WinMTR is a windows clone of popular Matt's traceroute Linux program.
It's a combination between ping and tracert commands.
Jul
17
新申请了两台服务器用于对数据备份。硬件一般,就是硬盘空间大一点。都是500G*6理论上的将近3T的空间。
为了简单的原则,我将所有的数据都放置在一个目录下面。
为了跨硬盘进行读定。建LVM是理所当然的。
对于LVM两年前有专门学习了一下。现在当然是忘了。不过大概的思路还是记得的。对于现在这样的应用,应该是简单至极。
为了印象深刻点。再学习一下相关概念:
Linux逻辑卷管理器(Logical Volume Manager)
物理介质 The physical media
你应该感受“物理”这个单词有极大的延伸,虽然我们刚开始假设它仅仅是一个硬盘,或者一个分区。例如,/dev/hda,/dev/hda6,/dev/sda。你可以转换一个块设备上任何连续块到一个。。。
物理卷 Physical Volume (PV)
一个PV只不过是有许多管理数据添加在它里面的物理介质--一旦你添加了它,LVM就认为它是。。。的一个持有者。
物理分区 Physical Extents (PE)
物理分区真的象一些大的数据块,通常有几MB。PE可以分配给一个。。。
卷组 Volume Group (VG)
一个VG是由许多物理分区组成的(可能来自多个物理卷或硬盘)。虽然这可能容易让你认为一个VG就是由几个硬盘组成的(例如/dev/hda和/dev/sda),但是更确切的说,它包含由这些硬盘提供的许多PE。
>;从这个卷组,PE可以分配给一个。。。
逻辑卷 Logical Volume (LV)
Yes,我们最终到达某处。一个逻辑卷是我们工作的最终结果,这里是我们存储信息的地方。这等同于传统分区的想法。
象用通常的分区一样,在逻辑卷上你能代表性的创建一个。。。
文件系统 Filesystem
创建流程:分区-》做物理卷PV(lvm pvcreate)-》做卷组(lvm vgcreate)-》逻辑卷(lvcreate) ->格式化罗辑卷,建文件系统。(mkfs.ext3 -j )等 改/etc/fstab -》OK
Jul
15
今天发现有反馈一个系统运维平台无法正常登陆了。经查看,是因为迁移过服务器的原因。再查发现意是其WEB程序有使用两个非正常端口进行连接。同时连接对像亦是127.0.0.1
再细查发现,旧服务器上的开放这两个对应端口的服务是stunnel
打开搜索引擎,了解stunnel相关信息。(这里我想到了黑客帝国里的功夫训练模块)现在的东西,我们搜索一下就能找到相关的东西与模块进行学习。
了解一下大概的常识:
1.stunnel官方介绍:
Stunnel is a program that allows you to encrypt arbitrary TCP connections inside SSL (Secure Sockets Layer) available on both Unix and Windows. Stunnel can allow you to secure non-SSL aware daemons and protocols (like POP, IMAP, LDAP, etc) by having Stunnel provide the encryption, requiring no changes to the daemon's code.
stunnel只是一个加密程序,可在tcp链接上使用SSL,同时因其不用更改系统内核,只在tcp connections设置即可,是以对安全性有要求的连接,只要加个stunnel即可。什么都可以不用再做了,非常方便。
了解了相关的信息,我们就可以很容易的推断出我们现在运行的那个WEB程序使用127.0.0.1端口的原因了。原理更是清楚了。做起来就简单了。
下载。安装,使用配置档stunnel.conf 将证书放置在合适的位置。启动!测试~OK~
其实我更愿意将stunnel看成的端口转换工具。再加SSL功能。相信以后会经常用到他的。旧版本的是使用命令行的方式实现。现在新版的是使用配置档文件。在这两者间的对应关系,配置档格式还耗费了我不少时间
stunnel [filename] | -help | -version | -sockets | -install | -uninstall
filename - use specified config file instead of stunnel.conf
-help - get config file help
-version - display version and defaults
-sockets - display default socket options
-install - install NT service
-uninstall - uninstall NT service
相关的stunnel文档资料有:http://www.stunnel.org/
developerWorks 中国 使用stunnel加密:http://www.ibm.com/developerworks/cn/security/s-stun/index.html
再细查发现,旧服务器上的开放这两个对应端口的服务是stunnel
打开搜索引擎,了解stunnel相关信息。(这里我想到了黑客帝国里的功夫训练模块)现在的东西,我们搜索一下就能找到相关的东西与模块进行学习。
了解一下大概的常识:
1.stunnel官方介绍:
Stunnel is a program that allows you to encrypt arbitrary TCP connections inside SSL (Secure Sockets Layer) available on both Unix and Windows. Stunnel can allow you to secure non-SSL aware daemons and protocols (like POP, IMAP, LDAP, etc) by having Stunnel provide the encryption, requiring no changes to the daemon's code.
stunnel只是一个加密程序,可在tcp链接上使用SSL,同时因其不用更改系统内核,只在tcp connections设置即可,是以对安全性有要求的连接,只要加个stunnel即可。什么都可以不用再做了,非常方便。
了解了相关的信息,我们就可以很容易的推断出我们现在运行的那个WEB程序使用127.0.0.1端口的原因了。原理更是清楚了。做起来就简单了。
下载。安装,使用配置档stunnel.conf 将证书放置在合适的位置。启动!测试~OK~
其实我更愿意将stunnel看成的端口转换工具。再加SSL功能。相信以后会经常用到他的。旧版本的是使用命令行的方式实现。现在新版的是使用配置档文件。在这两者间的对应关系,配置档格式还耗费了我不少时间
stunnel [filename] | -help | -version | -sockets | -install | -uninstall
filename - use specified config file instead of stunnel.conf
-help - get config file help
-version - display version and defaults
-sockets - display default socket options
-install - install NT service
-uninstall - uninstall NT service
相关的stunnel文档资料有:http://www.stunnel.org/
developerWorks 中国 使用stunnel加密:http://www.ibm.com/developerworks/cn/security/s-stun/index.html








