Feb
24
2010

配置 Debian Server – openvpn with mysql

apt-get install openvpn

openvpn常规配置参加其它

mysql -u root -p

create database vpn;

GRANT ALL ON vpn.* TO vpn@localhost IDENTIFIED BY ‘vpn123′;

flush privileges;

use vpn;

CREATE TABLE vpnuser ( name char(20) NOT NULL, password char(128) default NULL, active int(10) NOT NULL DEFAULT 1, PRIMARY KEY (name) );

insert into vpnuser (name,password) values(‘xhuang’,password(‘xhuang’));

vi /etc/pam.d/openvpn

auth sufficient pam_mysql.so user=vpn passwd=vpn123 host=localhost db=vpn \
table=vpnuser usercolumn=name passwdcolumn=password \
where=active=1 sqllog=0 crypt=2
account required pam_mysql.so user=vpn passwd=vpn123 host=localhost db=vpn \
table=vpnuser usercolumn=name passwdcolumn=password \
where=active=1 sqllog=0 crypt=2

需要自己编译openvpn-auth-pam.so

下载openvpn 2.0.9源码:wget http://openvpn.net/release/openvpn-2.0.9.tar.gz

apt-get install make gcc libpam0g-dev

cd openvpn-2.0.9/plugin/auth-pam

make

cp openvpn-auth-pam.so /etc/openvpn/

chmod 775 /etc/openvpn/openvpn-auth-pam.so

vi /etc/openvpn/openvpn.conf

port 443
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh1024.pem
server 10.8.0.0 255.255.0.0
push “redirect-gateway def1″
push “dhcp-option DNS 208.69.228.30″
push “dhcp-option DNS 4.2.2.1″
ifconfig-pool-persist ipp.txt
keepalive 10 120
tls-auth ta.key 0
plugin ./openvpn-auth-pam.so openvpn
client-cert-not-required
username-as-common-name
comp-lzo
max-clients 20
user nobody
group nobody
persist-key
persist-tun
status openvpn-status.log
verb 4
client:

client
dev tun
proto udp
remote ip 443
remote-random
resolv-retry infinite
nobind
persist-key
persist-tun
ca pca.crt
auth-user-pass
ns-cert-type server
tls-auth pta.key 1
comp-lzo
verb 4

Feb
24
2010

配置 Debian Server – PPTP VPN

apt-get install pptpd

vi /etc/pptpd.conf

localip 10.20.0.1
remoteip 10.20.0.100-200

vi /etc/ppp/pptpd-options

ms-dns 208.69.228.30
ms-dns 4.2.2.1

vi /etc/ppp/chap-secrets

username pptpd password *

vi /etc/sysctl.conf

net.ipv4.ip_forward=1

sysctl -p /etc/sysctl.conf

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

/etc/init.d/pptpd restart

Feb
24
2010

配置 Debian Server-nginx+mysql+php

http://www.howtoforge.com/installing-nginx-with-php5-and-mysql-support-on-debian-lenny

记住,千万不要用php5.3,否则就麻烦咯

Jan
26
2010

unixbench测试

1.VPS/openvz/192M/E5300/

INDEX VALUES
TEST                                        BASELINE     RESULT      INDEX
Dhrystone 2 using register variables        376783.7  5247702.6      139.3
Double-Precision Whetstone                      83.1      964.2      116.0
Execl Throughput                               188.3     4576.3      243.0
File Copy 1024 bufsize 2000 maxblocks         2672.0   105728.0      395.7
File Copy 256 bufsize 500 maxblocks           1077.0    35252.0      327.3
File Read 4096 bufsize 8000 maxblocks        15382.0   822425.0      534.7
Pipe-based Context Switching                 15448.6   215811.8      139.7
Pipe Throughput                             111814.6  1083985.5       96.9
Process Creation                               569.3    13649.9      239.8
Shell Scripts (8 concurrent)                    44.8      623.8      139.2
System Call Overhead                        114433.5   995473.2       87.0
=========
FINAL SCORE                                                     188.5

INDEX VALUES            TEST                                        BASELINE     RESULT      INDEX
Dhrystone 2 using register variables        376783.7  5247702.6      139.3Double-Precision Whetstone                      83.1      964.2      116.0Execl Throughput                               188.3     4576.3      243.0File Copy 1024 bufsize 2000 maxblocks         2672.0   105728.0      395.7File Copy 256 bufsize 500 maxblocks           1077.0    35252.0      327.3File Read 4096 bufsize 8000 maxblocks        15382.0   822425.0      534.7Pipe-based Context Switching                 15448.6   215811.8      139.7Pipe Throughput                             111814.6  1083985.5       96.9Process Creation                               569.3    13649.9      239.8Shell Scripts (8 concurrent)                    44.8      623.8      139.2System Call Overhead                        114433.5   995473.2       87.0                                                                 =========     FINAL SCORE                                                     188.5

2.VPS/XenVPS/128M/256swap/1*X3220

INDEX VALUES

TEST                                        BASELINE     RESULT      INDEX

Dhrystone 2 using register variables        376783.7  5954617.8      158.0

Double-Precision Whetstone                      83.1     1309.4      157.6

Execl Throughput                               188.3     1898.4      100.8

File Copy 1024 bufsize 2000 maxblocks         2672.0    54459.0      203.8

File Copy 256 bufsize 500 maxblocks           1077.0    15178.0      140.9

File Read 4096 bufsize 8000 maxblocks        15382.0   406666.0      264.4

Pipe Throughput                             111814.6   317361.7       28.4

Pipe-based Context Switching                 15448.6    91247.9       59.1

Process Creation                               569.3     4368.9       76.7

Shell Scripts (8 concurrent)                    44.8      528.6      118.0

System Call Overhead                        114433.5   271997.7       23.8

=========

FINAL SCORE                                                      96.7

3.dell 2950/Xeon 5130*2/4G/raid 0(2*146)

INDEX VALUES

TEST                                        BASELINE     RESULT      INDEX

Dhrystone 2 using register variables        376783.7 20154868.8      534.9

Double-Precision Whetstone                      83.1     1080.4      130.0

Execl Throughput                               188.3     8746.1      464.5

File Copy 1024 bufsize 2000 maxblocks         2672.0   146493.0      548.3

File Copy 256 bufsize 500 maxblocks           1077.0    38212.0      354.8

File Read 4096 bufsize 8000 maxblocks        15382.0  1363281.0      886.3

Pipe-based Context Switching                 15448.6   561180.6      363.3

Pipe Throughput                             111814.6  1515846.2      135.6

Process Creation                               569.3    27917.4      490.4

Shell Scripts (8 concurrent)                    44.8     1915.7      427.6

System Call Overhead                        114433.5  2119432.0      185.2

=========

FINAL SCORE                                                     353.1

4.dell 2850/Xeon 3.0*2/2g/raid5 (3*146)

INDEX VALUES

TEST                                        BASELINE     RESULT      INDEX

Dhrystone 2 using register variables        376783.7  8832282.0      234.4

Double-Precision Whetstone                      83.1      593.7       71.4

Execl Throughput                               188.3     5678.6      301.6

File Copy 1024 bufsize 2000 maxblocks         2672.0   102169.0      382.4

File Copy 256 bufsize 500 maxblocks           1077.0    30361.0      281.9

File Read 4096 bufsize 8000 maxblocks        15382.0   821021.0      533.8

Pipe-based Context Switching                 15448.6   236686.0      153.2

Pipe Throughput                             111814.6   981097.0       87.7

Process Creation                               569.3    17623.3      309.6

Shell Scripts (8 concurrent)                    44.8     1238.6      276.5

System Call Overhead                        114433.5  1283837.1      112.2

=========

FINAL SCORE                                                     211.3

5.ibm 365/Xeon 2.8*2/4G/raid5(4*146)

INDEX VALUES

TEST                                        BASELINE     RESULT      INDEX

Dhrystone 2 using register variables        376783.7  6704488.6      177.9

Double-Precision Whetstone                      83.1      517.7       62.3

Execl Throughput                               188.3     5169.7      274.5

File Copy 1024 bufsize 2000 maxblocks         2672.0    97765.0      365.9

File Copy 256 bufsize 500 maxblocks           1077.0    27526.0      255.6

File Read 4096 bufsize 8000 maxblocks        15382.0   657348.0      427.3

Pipe-based Context Switching                 15448.6   252913.1      163.7

Pipe Throughput                             111814.6  1373811.4      122.9

Process Creation                               569.3    14007.6      246.0

Shell Scripts (8 concurrent)                    44.8      865.7      193.2

System Call Overhead                        114433.5  1572901.6      137.5

=========

FINAL SCORE                                                     195.5

6.macbook pro/2G/Core 2 Duo 2.26G

INDEX VALUES

TEST                                        BASELINE     RESULT      INDEX

Dhrystone 2 using register variables        376783.7  9436477.8      250.4

Double-Precision Whetstone                      83.1     1904.4      229.2

Execl Throughput                               188.3     1155.1       61.3

File Copy 1024 bufsize 2000 maxblocks         2672.0    83321.0      311.8

File Copy 256 bufsize 500 maxblocks           1077.0    22021.0      204.5

File Read 4096 bufsize 8000 maxblocks        15382.0   465187.0      302.4

Pipe Throughput                             111814.6   692730.0       62.0

Pipe-based Context Switching                 15448.6   114287.7       74.0

Process Creation                               569.3     4800.8       84.3

Shell Scripts (8 concurrent)                    44.8      394.0       87.9

System Call Overhead                        114433.5   744941.5       65.1

=========

FINAL SCORE                                                     127.9

Jan
24
2010

某些”砖”家开始抨击希拉里了…

按照他们的习惯,把别人的话直接省略几个关键词后开始抨击…反正你国内普通草根翻不了墙,我说怎么样就怎么样.人家发言是反对基于政治目的的审查,支持对于暴力等的审查,到丫嘴里就变成了反对审查,然后又说美国自己在公众图书馆禁止色情网站,我晶

这傻鸟还举了德国google限制色情网站的例子,人家希拉里明明说的是反对有政治动机的审查,丫傻傻地还举了这个例子.完了还说不能让美国人掌控互联网,这东西明明是人家自己搞的,然后说我有个东西你玩不玩,然后中国说,我玩,玩了没几天,发现这东西上面真玩意太多了,老百姓能自由发布自己的政治目的,不对劲阿,于是开始封锁,砸了无数金钱,发现还是封不住,然后大叫:我要改游戏规则…

能给你改游戏规则么,一边举例美国佬封索马里域名(我真不知道封过),自己至今一直在劫持facebook,twitter,youtube等知名网站的域名解析那就别说了,因为这些网站危害了国家安全,那各地运营商的dns域名解析一直都在植入广告该怎么说呢?晶!

附上人家讲话内容:美国国务院将向促进网络自由的草根运动提供资金;呼吁减少中东地区女性利用社交网站惹来杀身之祸的案例;美国政府将把互联网视为美国长期在海外推进“民主”的重要工具;互联网安全等。

另关于网络审查:我希望拒绝支持有政治动机的审查,能成为美国技术公司的招牌商标。它应当成为我们的国家品牌的一部分。

原文在此:http://www.state.gov/secretary/rm/2010/01/135519.htm

中文pdf下载:internet freedom

Jan
20
2010

Twitter is over capacity.

据说…

Jan
19
2010

看到一篇置顶贴

http://bbs.weiphone.com/read-htm-tid-621827.html

最近风声很紧,为了论坛着想,禁止发一切有违政策法规的帖子,包括但不限于:

1、fan墙
2、Google某事
3、西部某地区某事
4、国产软件的破解或序列号
5、………………其它杂七杂八有违政策法规的帖子

默哀

Jan
17
2010

hulu&p2p

周末在家看hulu,3M的adsl非常流畅,得意ing,觉得我的vps真强,速度真不错,然后顺手netstat -an| grep ESTABLISHED一下,发现无数连接,正奇怪呢,突然想起来hulu貌似用了p2p,果然…

看来p2p也应该是视频网站上高清的出路,如果时延性能做好,视频会议也应该是p2p

Jan
13
2010

nginx fastcgi cache启用前后性能对比

测试环境:

ramhost的vps,192M内存,跑wordpress,用apache的ab测试一个page

先看不启用cache的

Server Software: nginx/0.7.64

Server Hostname: www.xhuang.net

Server Port: 80

Document Path: /about/

Document Length: 18015 bytes

Concurrency Level: 20

Time taken for tests: 207.347340 seconds

Complete requests: 1000

Failed requests: 982

(Connect: 0, Length: 982, Exceptions: 0)

Write errors: 0

Total transferred: 18304372 bytes

HTML transferred: 18048116 bytes

Requests per second: 4.82 [#/sec] (mean)

Time per request: 4146.947 [ms] (mean)

Time per request: 207.347 [ms] (mean, across all concurrent requests)

Transfer rate: 86.21 [Kbytes/sec] received

接着启用cache

Server Software: nginx/0.7.64

Server Hostname: www.xhuang.net

Server Port: 80

Document Path: /about/

Document Length: 18064 bytes

Concurrency Level: 20

Time taken for tests: 66.140248 seconds

Complete requests: 1000

Failed requests: 998

(Connect: 0, Length: 998, Exceptions: 0)

Write errors: 0

Total transferred: 18323035 bytes

HTML transferred: 18066267 bytes

Requests per second: 15.12 [#/sec] (mean)

Time per request: 1322.805 [ms] (mean)

Time per request: 66.140 [ms] (mean, across all concurrent requests)

Transfer rate: 270.53 [Kbytes/sec] received

good!

配置请看http://blog.chinaunix.net/u2/69948/showart_1885428.html

Jan
12
2010

防火防盗防迅雷

迅雷是个啥?迅雷=小偷+强盗

小偷:

迅雷现在不管你是否允许上传,自己在后台遍历你的文件,然后发现有用的就给你忽忽满速往上传,经常发现公司网络上行太慢,一看,我靠,有个家伙上行10M,得,又一迅雷受害者

http://www.google.cn/search?client=safari&rls=en&q=迅雷+偷偷上传&ie=UTF-8&oe=UTF-8

强盗:

做网站的都知道,放迅雷盗链是第一要务,要是你不小心谁给你扔了个热门mp3上去,那就完了,迅雷偷偷给你搞来无数链接,不管你多少带宽都能给你吃掉,经常把你的web server吃满,让人崩溃,更可恶的是居然伪造referer,让你防不胜防

http://www.google.cn/search?client=safari&rls=en&q=迅雷+盗链&ie=UTF-8&oe=UTF-8

这种流氓软件居然还在广泛流传,看来还是这片神奇的土地会产生无数神奇的故事阿…