顯示具有 Research 標籤的文章。 顯示所有文章
顯示具有 Research 標籤的文章。 顯示所有文章

2012/06/13

MySQL 的安全漏洞

http://thehackernews.com/2012/06/cve-2012-2122-serious-mysql.html


看起來是 5.1.61, 5.2.11, 5.3.5, 5.5.22 以前的版本都有漏洞

輸入網頁中的那個指令 有一定的機率能拿到root

2012/02/06

webmin及openwebmail安裝

以下都是透過yum方式安裝,rpm及tarball方式請自行google。
一、安裝webmin
        參考:http://webmin.com/rpm.html

Using the Webmin YUM repository

If you like to install and update Webmin via RPM, create the/etc/yum.repos.d/webmin.repo file containing :[Webmin]
name=Webmin Distribution Neutral
#baseurl=http://download.webmin.com/download/yum
mirrorlist=http://download.webmin.com/download/yum/mirrorlist
enabled=1
You should also fetch and install my GPG key with which the packages are signed, with the commands :wget http://www.webmin.com/jcameron-key.asc
rpm --import jcameron-key.asc
You will now be able to install with the command :yum install webminAll dependencies should be resolved automatically.


二、安裝openwebmail


How to install openwebmail from yum repository
==============================================
Thomas Chung <tchung@openwebmail.org>
2008.05.29
UPDATE 2010.05.24
Install perl-Text-Iconv from rpmforge for your arch if you're running RHEL or CentOS:
http://dag.wieers.com/rpm/packages/perl-Text-Iconv/
$ su -
# cd /etc/yum.repos.d
# lftpget http://openwebmail.org/openwebmail/download/redhat/rpm/release/openwebmail.repo
# yum install openwebmail
fedora 100% |=========================| 2.1 kB 00:00
openwebmail 100% |=========================| 951 B 00:00
updates 100% |=========================| 2.3 kB 00:00
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package openwebmail.i386 0:2.53-1 set to be updated
--> Processing Dependency: openwebmail-data = 2.53-1 for package: openwebmail
--> Processing Dependency: perl-suidperl for package: openwebmail
--> Processing Dependency: perl-Text-Iconv for package: openwebmail
--> Running transaction check
---> Package openwebmail-data.i386 0:2.53-1 set to be updated
---> Package perl-suidperl.i386 4:5.8.8-32.fc8 set to be updated
---> Package perl-Text-Iconv.i386 0:1.5-1.fc8 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing for dependencies:
openwebmail i386 2.53-1 openwebmail 2.3 M
openwebmail-data i386 2.53-1 openwebmail 7.0 M
perl-Text-Iconv i386 1.5-1.fc8 fedora 20 k
perl-suidperl i386 4:5.8.8-32.fc8 updates 60 k
Transaction Summary
=============================================================================
Install 4 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 9.4 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): perl-Text-Iconv-1. 100% |=========================| 20 kB 00:00
(2/4): openwebmail-2.53-1 100% |=========================| 2.3 MB 00:03
(3/4): perl-suidperl-5.8. 100% |=========================| 60 kB 00:00
(4/4): openwebmail-data-2 100% |=========================| 7.0 MB 00:10
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID cfb164d8
Importing GPG key 0xCFB164D8 "Thomas Chung <tchung@openwebmail.org>" from http://openwebmail.org/.../RPM-GPG-KEY-openwebmail
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: perl-Text-Iconv ######################### [1/4]
Installing: perl-suidperl ######################### [2/4]
Installing: openwebmail ######################### [3/4]
Permission and Ownership for openwebmail files have been fixed!
Please execute following tool first as a root:
/var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init
After restarting httpd service, login with non-root account from
http://localhost.localdomain/cgi-bin/openwebmail/openwebmail.pl
or http://localhost.localdomain/webmail
If SELinux enabled, you may need to set it 'permissive' in
/etc/sysconfig/selinux or system-config-selinux
Installing: openwebmail-data ######################### [4/4]
Dependency Installed: openwebmail.i386 0:2.53-1 openwebmail-data.i386 0:2.53-1 perl-Text-Iconv.i386 0:1.5-1.fc8 perl-suidperl.i386 4:5.8.8-32.fc8
Complete!
三、 openwebmail安裝好後的設定
        修改/var/log/openwebmail.log的 selinux設定
參考:http://j796160836.pixnet.net/blog/post/21882397-%5B%E7%AD%86%E8%A8%98%5D%5B%E6%A5%B5%E9%87%8D%E8%A6%81%5Dopenwebmail%E7%9A%84%E9%97%9C%E9%8D%B5%E8%A8%AD%E5%AE%9A%EF%BC%8C%E8%A8%AD%E5%AE%9Aselinu



2011/10/31

取得檔案的版本資訊 file version information


int   iVerInfoSize;
char   *pBuf;
AnsiString   asVer;
VS_FIXEDFILEINFO   *pVsInfo;
unsigned   int   iFileInfoSize   =   sizeof(   VS_FIXEDFILEINFO   );

iVerInfoSize   =   GetFileVersionInfoSize(Application->ExeName.c_str(), NULL);
if(iVerInfoSize!=   0)
{
pBuf   =   new   char[iVerInfoSize];
if(GetFileVersionInfo(Application->ExeName.c_str(),0, iVerInfoSize, pBuf   )   )
{
if(VerQueryValue(pBuf, L"\\",(void **)&pVsInfo,&iFileInfoSize))
{
asVer = IntToStr( HIWORD(pVsInfo-> dwFileVersionMS) ) + ".";
asVer+= IntToStr( LOWORD(pVsInfo-> dwFileVersionMS) ) + ".";
asVer+= IntToStr( HIWORD(pVsInfo-> dwFileVersionLS) ) + ".";
asVer+= IntToStr( LOWORD(pVsInfo-> dwFileVersionLS) );
}
}
delete   []pBuf;
}

2011/10/28

TMemo AutoScroll

參考來源:
http://www.programmer-club.com.tw/showSameTitleN/cb/7076.html

MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/bb787577(v=vs.85).aspx

Memo1->Perform(WM_VSCROLL,SB_BOTTOM ,0);
直接用SB_BOTTOM就好。

2011/08/10

Windows XP 更新 會跑到這一個網頁 http://support.microsoft.com/kb/2497281/

今天在灌XP的時候發生了問題,查了老半天後才知道有東西要更新。
發生的原因是這個 Windows XP 更新 會跑到這一個網頁 http://support.microsoft.com/kb/2497281/
解決方式就如連結內所敘述,直接找一台正常的XP的wuweb.dll,然後複製到新主機上覆蓋過去就好。

2011/08/04

Install snort 2.9.0.5 on CentOS 5.5

今天裝Snort 2.9.0.5到CentOS 5.5上,遭遇很多問題。
所以寫這篇紀錄如何安裝。這篇完全用tarball方式安裝,RPM部份請參考(http://forum.icst.org.tw/phpbb/viewtopic.php?f=11&t=20365)。
這邊是安裝好CentOS 5.5並且將全部套件更新到最新版後的安裝方式。

1.事前準備
  1.1 從snort官網下載snort-2.9.0.5.tar.gz, dag-0.5.tar.gz
  1.2 下載snort的rule,免費的即可,前提是你要先註冊一個帳號。將來有想要升級的話也可以升級上去。
        snortrules-snapshot-2904.tar.gz, snortrules-snapshot-2905.tar.gz
  1.3 到http://www.tcpdump.org 下載libpcap-1.1.1.tar.gz
  1.4 到http://libdnet.sourceforge.net 下載libdnet-1.11.tar.gz
  1.5 將snort,dag,libdnet及libpcap解開(請自行到鳥哥那瞭解如何解壓縮),到各自目錄夾。
        通常解開的目錄就是檔案去掉tar.gz的部份。
        例:snort-2.9.0.5.tar.gz解開後目錄名稱為snort-2.9.0.5。
2.開始安裝
  2.1 用瀏覽器打開 Install_Snort_2.8.6_on_CentOS_5.5.pdf
       請依照裡面的 Snort Installation and Setup章節安裝。裡面會要你用yum安裝很多套件。
       安裝完後會到 Making directories and building/installing Snort: 章節。
       接下來的請依順序安裝,不然會有錯誤訊息。
  2.2 安裝libdnet
cd libdnet-1.11
./configure --prefix=/usr
make
make install

  2.3 安裝libpcap
cd libpcap-1.1.1
./configure --prefix=/usr
make
make install

  2.4 安裝dag
cd dag-0.5
./configure --prefix=/usr
make
make install

  2.5 安裝snort
cd snort-2.9.0.5
./configure --with-mysql --enable-dynamicplugin --enable-ipv6 --enable-gre --enable-mpls --enable-targetbased --enable-decoder-preprocessor-rules --enable-ppm --enable-perfprofiling --enable-zlib --enable-active-response --enable-normalizer --enable-reload --enable-react --enable-flexresp3
make
make install

  2.6 接著就接續Making directories and building/installing Snort:後面章節的部份繼續安裝下去。

3. PHP Pear部份
   3.1 安裝php pear

yum -y install php-pear
pear upgrade --force http://download.pear.php.net/package/PEAR-1.9.1.tgz
pear install Numbers_Roman
pear install channel://pear.php.net/Numbers_Words-0.16.2
pear install Image_Color
pear install channel://pear.php.net/Image_Canvas-0.3.2
pear install channel://pear.php.net/Image_Graph-0.7.2


4. adodb
wget http://sourceforge.net/projects/adodb/files/adodb-php5-only/adodb-511-for-php5/adodb511.tgz/download


5. secureideas
wget http://sourceforge.net/projects/secureideas/files/BASE/base-1.4.5/base-1.4.5.tar.gz/download


6. Barnyard2
安裝裡面的網站已經不存在了,現在換到這個https://nodeload.github.com/firnsy/barnyard2/tarball/master。
  6.1 請參閱doc裡面的INSTALL文件
        如果發生 AM_PATH_LIBPRELUDE 錯誤的話,依下面方式處理。

cp snort-2.9.0.5/m4/libprelude.m4 /usr/share/aclocal

snort-2.9.0.5可以改成你實際解開的目錄。
  6.2 之後就./configure --with-mysql --prefix=/usr沒問題的話就可以安裝了

7. 修改snort.conf
     把ipvar部份全部改成var。

全部做完後就可以開始使用Snort了。

2011/06/07

VS2005,VS2008,VS2010 出現automation伺服程式無法產生物件 解決方式

解決方式:
請執行 Regsvr32 scrrun.dll

2011/03/23

在開始上傳前檢查檔案大小(IE僅能檢查圖片)

這篇其實不是單純只能檢查圖片而已,連一般檔案都可以檢查。目前還沒在Safari瀏覽器上實驗過就是了。
2011/3/24 04:18 剛確認了IE如果是圖片以外的檔案,確實要用額外的方式處理。

[JavaScript] 在開始上傳前檢查圖片檔案大小
最近有此功能需求,因此查了些相關的資料,最後在不使用 Flash 及 ActiveX 等技術的情況下,只用JavaScript完成了多瀏覽器的功能實作,在此分享。

目前已測試過的瀏覽器:IE 6 , IE 7 , IE 8 , Firefox , Chrome;另外 Firefox 與 Chrome 的版本須為支援 Html 5 的版本。


以下為 HTML (此部分與 Bryan(不來ㄣ)大大的版本相同 ):
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=big5">
    <title>上傳</title>
</head>
<body>
    <form action="upload.asp" method="POST" name="FileForm" enctype="multipart/form-data">
    <div align="center">
        圖片:
    <input type="file" name="file1" size="20" id="file1" />
    <input type="button" value="確定上傳" onclick="checkFile()" /></div>
    </form>
</body>
</html>


以下為 JavaScript:
<script src="http://code.jquery.com/jquery-1.4.2.min.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
    var fileSize = 0; //檔案大小
    var SizeLimit = 1024; //上傳上限,單位:byte
    function checkFile() {
    var f = document.getElementById("file1");
    //FOR IE
    if ($.browser.msie) {
            var img = new Image();
            img.onload = checkSize;
            img.src = f.value;
        }
        //FOR Firefox,Chrome
        else {
            fileSize = f.files.item(0).size;
            checkSize();
        }
    }
    //檢查檔案大小
    function checkSize() {
        //FOR IE FIX
        if ($.browser.msie) {
            fileSize = this.fileSize;
        }
        if (fileSize > SizeLimit) {
            Message((fileSize / 1024).toPrecision(4), (SizeLimit / 1024).toPrecision(2));
        } else {
            document.FileForm.submit();
        }
    }
    function Message(file, limit) {
        var msg = "您所選擇的檔案大小為 " + file + " kB\n已超過上傳上限 " + limit + " kB\n不允許上傳!"
        alert(msg);
    }
</script>

參考資料:
topcat 姍舞之間的極度凝聚 - [轉貼]上傳檔案前,JavaScript檢查檔案格式、大小:http://www.dotblogs.com.tw/topcat/archive/2009/02/20/7250.aspx (Bryan(不來ㄣ)大大的版本 – For IE)
簡單過生活 - Check 上傳檔案大小:http://iammic.pixnet.net/blog/post/11866034 (iammic大大的版本 – For IE[ActiveX] & Firefox , Chrome)

2010/09/22 更新:
在 o 大大的指正後,將標題略為修改為針對圖片檔案的上傳之檔案大小的檢查,以避免因標題誤導了想找資料的訪客。
另外,在支援 HTML 5 的 Firefox 與 Chrome 的瀏覽器版本上,是可正確抓到各類型檔案大小的;而 IE 瀏覽器仍須透過 Flash 或 ActiveX 等技術才能取得圖片類型以外的檔案大小,在此作以上更正。

2011/02/16

CentOS Yum Repo

CentOS預設安裝的Yum有蠻多東西都沒有的。
所以下面是幾個目前常用的repo及安裝方式。

1.remi

wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm

2.rpmforge

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
rpm -Uvh rpmforge-release-0.5.2-2.el5.rf.i386.rpm

3.IUS

wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1.0-8.ius.el5.noarch.rpm
rpm -Uvh ius-release*.rpm


PS:請注意上面是i386版本,若是64bit版的,必須把i386的字串改為x86_64。
PS2:RHEL已經有6版了,但不建議在系統不是6版的狀況下裝6版的repo。
2012/07/02 redhar的域名修正

2011/02/15

Wireshark的cli版 tshark

TShark 1.0.15
Dump and analyze network traffic.
See http://www.wireshark.org for more information.

Copyright 1998-2010 Gerald Combs and contributors.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Usage: tshark [options] ...

Capture interface:
-i name or idx of interface (def: first non-loopback)
-f packet filter in libpcap filter syntax
-s packet snapshot length (def: 65535)
-p don't capture in promiscuous mode
-y link layer type (def: first appropriate)
-D print list of interfaces and exit
-L print list of link-layer types of iface and exit

Capture stop conditions:
-c stop after n packets (def: infinite)
-a ... duration:NUM - stop after NUM seconds
在幾秒後停止
filesize:NUM - stop this file after NUM KB
在檔案大小為幾KB後停止
files:NUM - stop after NUM files
在幾個檔案後停止
Capture output:
-b ... duration:NUM - switch to next file after NUM secs
在幾秒後換新檔案
filesize:NUM - switch to next file after NUM KB
在檔案大小為幾KB後換新檔案
files:NUM - ringbuffer: replace after NUM files
在幾次後後換覆蓋檔案(類似logrotate的功能)
Input file:
-r set the filename to read from (no pipes or stdin!)

Processing:
-R packet filter in Wireshark display filter syntax
-n disable all name resolutions (def: all enabled)
-N enable specific name resolution(s): "mntC"
-d ==, ...
"Decode As", see the man page for details
Example: tcp.port==8888,http
Output:
-w set the output filename (or '-' for stdout)
將抓到的資料存放到 (或輸入 '-' 來輸出到stdout也就是顯示在螢幕上)
-C start with specified configuration profile
-F set the output file type, default is libpcap
an empty "-F" option will list the file types
-V add output of packet tree (Packet Details)
-S display packets even when writing to a file
-x add output of hex and ASCII dump (Packet Bytes)
-T pdml|ps|psml|text|fields
format of text output (def: text)
-e field to print if -Tfields selected (e.g. tcp.port);
this option can be repeated to print multiple fields
-E= set options for output when -Tfields selected:
header=y|n switch headers on and off
separator=/t|/s| select tab, space, printable character as separator
quote=d|s|n select double, single, no quotes for values
-t ad|a|r|d|dd|e output format of time stamps (def: r: rel. to first)
-l flush standard output after each packet
-q be more quiet on stdout (e.g. when using statistics)
-X : eXtension options, see the man page for details
-z various statistics, see the man page for details

Miscellaneous:
-h display this help and exit
-v display version info and exit
-o : ... override preference setting

2010/11/17

[PHP]解決網站被 SQL injection 攻擊

其實這個安全性的問題,在目前台灣網站都存在這樣的問題,大家平常用 $_POST,$_GET 用得很順利,但是沒有想過帳號密碼被 SQL injection 破解,當網站被破解了,基本上你損失就是相當嚴重,網路上也有很多攻擊方式,不過這方法是最常被拿出來講的,我自己有一套解決方式,除了比較重要的地方,就是輸入帳號密碼的地方要加強防護之外,加上數字驗證碼,還要 check 帳號的特性,我底下是我驗證帳號密碼機制

if($user_name == '' || $user_passwd == ''){
ErrMsg("帳號或密碼不得空白");
}
if (!preg_match('/^\w+$/', $user_name)){
ErrMsg("請勿攻擊本站台");
}


上面可以解決帳號只能輸入數字加上英文,然後底下在過濾很多特殊字元加上 addslashes 或者是用 mysql_escape_string()

if( !get_magic_quotes_gpc() )
{
if( is_array($_GET) )
{
while( list($k, $v) = each($_GET) )
{
if( is_array($_GET[$k]) )
{
while( list($k2, $v2) = each($_GET[$k]) )
{
$_GET[$k][$k2] = addslashes($v2);
}
@reset($_GET[$k]);
}
else
{
$_GET[$k] = addslashes($v);
}
}
@reset($_GET);
}

if( is_array($_POST) )
{
while( list($k, $v) = each($_POST) )
{
if( is_array($_POST[$k]) )
{
while( list($k2, $v2) = each($_POST[$k]) )
{
$_POST[$k][$k2] = addslashes($v2);
}
@reset($_POST[$k]);
}
else
{
$_POST[$k] = addslashes($v);
}
}
@reset($_POST);
}

if( is_array($_COOKIE) )
{
while( list($k, $v) = each($_COOKIE) )
{
if( is_array($_COOKIE[$k]) )
{
while( list($k2, $v2) = each($_COOKIE[$k]) )
{
$_COOKIE[$k][$k2] = addslashes($v2);
}
@reset($_COOKIE[$k]);
}
else
{
$_COOKIE[$k] = addslashes($v);
}
}
@reset($_COOKIE);
}
}

上面那段,可以避免利用特殊字元做 SQL injection 攻擊,這部份程式碼是我去 trace PHPBB2 code 裡面寫的^^。

文章來源:[PHP]解決網站被 SQL injection 攻擊

2010/11/12

如何Windows2003中建立智能DNS服务器

如何Windows2003中建立智能DNS服务器(BIND,附配置文件下载) - [Windows]


版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明

http://iamsam.blogbus.com/logs/29402246.html




前言

 随着原中国电信集团按南北地域分家,新的中国电信和网通集团随即成立,互联网的骨干网也被一分为二了,北有网通、南有电信。从此,细心的网民可以发现,有些经常访问的网站速度一下子慢了下来,有时候还有访问不到的情况出现。例如北方地区的网络用户访问中国网通的服务器会非常快,而访问中国电信的服务器时,感觉非常慢。这种现象不仅影响了网站的访问量,更严重的是它直接影响了一些经营性网站的经济效益。据分析,产生这个问题的根本原因是中国电信分家之后,电信与网通之间的互连存在问题。虽然信息产业部已经在规划南北互通计划,但在今后相当长的一段时期内,南北方网互连的问题还会长期存在。

解决方案

智能DNS策略解析很好的解决了上面所述的问题。DNS策略解析最基本的功能是可以智能的判断访问您网站的用户,然后根据不同的访问者把您的域名分别解析成不同的IP地址。如访问者是网通用户,DNS策略解析服务器会把你的域名对应的网通IP地址解析给这个访问者。如果用户是电信用户,DNS策略解析服务器会把您域名对应的电信IP地址解析给这个访问者。

 智能DNS策略解析还可以给你的多个主机实现负载均衡,这时来自各地的访问流量会比较平均的分布到你的每一个主机上。

软件的相关资源

官方网站: http://www.bind.com/



最新版本: 9.3.2 http://www.isc.org/index.pl?/sw/bind/view/?release=9.3.2-P2



帮助文档: http://www.isc.org/sw/bind/



配置文件样例: http://www.bind.com/bind.html





实施步骤:

1。 WINDOWS 2003 服务器

2。使用BIND9做智能DNS,自动根据客户端IP来判断,网通的用户解析出网通的IP,电信的解析出电信IP

测试做的域名

www.dnsany.com

电信IP 60.171.45.152

网通IP 220.248.236.152

电信用户PING www.dnsany.com会解析到60.171.45.152

网通用户PING www.dnsany.com会解析到220.248.236.152

配置步骤:

1.BIND 9.3.2

http://ftp.isc.org/isc/bind9/9.3.2-P2/BIND9.3.2-P2.zip

2. 安装BIND 9 .3.2

解压到一个临时目录,而后运行 BINDInstall.exe,一直默认安装就行了,不需要更改什么设置。

默认安装到 \windows\system32\dns目录下

3.配置

运行CMD进入安装目录(\windows\system32\dns)下面的bin目录,而后运行

rndc-confgen -a (运行完成后会在etc目录下生成rndc.key)

rndc-confgen > ..\etc\rndc.conf

进入etc目录,用 notepad 新建 named.conf 复制下面的内容,注意把rndc.conf中# Use with the following in named.conf, adjusting the allow list as needed: 以后的内容复制到named.conf文件中,去掉全面的#。

named.conf

######################named.conf############################



acl "trust-lan" { 127.0.0.1/8; 10.0.0.0/24;};

options {

directory "C:\WINDOWS\system32\dns\etc";

recursion no;

version "0.0.0";

allow-transfer { "trust-lan";};

allow-notify { "trust-lan"; };

auth-nxdomain no;

forwarders { 60.171.45.171;60.171.45.150;};



};



#这一段内容拷贝来自rndc.conf

key "rndc-key" {

algorithm hmac-md5;

secret "p30d5VTh6iP+QBiVsEI0lw==";

};



controls {

inet 127.0.0.1 port 953

allow { 127.0.0.1; } keys { "rndc-key"; };

};

#注意在C:\WINDOWS\system32\dns\log\ 下建dns_warnings.txt dns_logs.txt

logging {

channel warning

{ file "C:\WINDOWS\system32\dns\log\dns_warnings.txt" versions 3 size 1240k;

severity warning;

print-category yes;

print-severity yes;

print-time yes;

};

channel general_dns

{ file "C:\WINDOWS\system32\dns\log\dns_logs.txt" versions 3 size 1240k;

severity info;

print-category yes;

print-severity yes;

print-time yes;

};

category default { warning; };

category queries { general_dns; };

};

#将网通的地址范围数据

include "cnc.conf";

# 判断如果是网通的地址范围,则会执行此处,调用网通的解析

view "view_cnc" {

match-clients { CNC; };

zone "." {

type hint;

file "named.root";

};



zone "0.0.127.IN-ADDR.ARPA" {

type master;

file "localhost.rev";

};



include "master/cnc.def";

};



view "view_any" {

match-clients { any; };

zone "." {

type hint;

file "named.root";

};



zone "0.0.127.IN-ADDR.ARPA" {

type master;

file "localhost.rev";

};



include "master/telecom.def";

};



###################### named.conf############################

用notepad 新建 cnc.conf复制下面的内容



###################### cnc.conf############################

# jul/14/2006 09:44:25 by coolice

# software id = EFTB-IZN

#

acl "CNC" {

58.16.0.0/16;

58.17.0.0/17;

60.12.0.0/16;

222.163.128.0/17;

219.235.56.194;

};

###################### cnc.conf############################

用notepad 新建 named.root复制下面的内容



###################### named.root############################

; This file holds the information on root name servers needed to

; initialize cache of Internet domain name servers

; (e.g. reference this file in the "cache . "

; configuration file of BIND domain name servers).

;

; This file is made available by InterNIC

; under anonymous FTP as

; file /domain/named.root

; on server FTP.INTERNIC.NET

; -OR- RS.INTERNIC.NET

;

; last update: Jan 29, 2004

; related version of root zone: 2004012900

;

;

; formerly NS.INTERNIC.NET

;

. 3600000 IN NS A.ROOT-SERVERS.NET.

A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4

;

; formerly NS1.ISI.EDU

;

. 3600000 NS B.ROOT-SERVERS.NET.

B.ROOT-SERVERS.NET. 3600000 A 192.228.79.201

;

; formerly C.PSI.NET

;

. 3600000 NS C.ROOT-SERVERS.NET.

C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12

;

; formerly TERP.UMD.EDU

;

. 3600000 NS D.ROOT-SERVERS.NET.

D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90

;

; formerly NS.NASA.GOV

;

. 3600000 NS E.ROOT-SERVERS.NET.

E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10

;

; formerly NS.ISC.ORG

;

. 3600000 NS F.ROOT-SERVERS.NET.

F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241

;

; formerly NS.NIC.DDN.MIL

;

. 3600000 NS G.ROOT-SERVERS.NET.

G.ROOT-SERVERS.NET. 3600000 A 192.112.3***

;

; formerly AOS.ARL.ARMY.MIL

;

. 3600000 NS H.ROOT-SERVERS.NET.

H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53

;

; formerly NIC.NORDU.NET

;

. 3600000 NS I.ROOT-SERVERS.NET.

I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17

;

; operated by VeriSign, Inc.

;

. 3600000 NS J.ROOT-SERVERS.NET.

J.ROOT-SERVERS.NET. 3600000 A 192.58.128.30

;

; operated by RIPE NCC

;

. 3600000 NS K.ROOT-SERVERS.NET.

K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129

;

; operated by ICANN

;

. 3600000 NS L.ROOT-SERVERS.NET.

L.ROOT-SERVERS.NET. 3600000 A 198.32.64.12

;

; operated by WIDE

;

. 3600000 NS M.ROOT-SERVERS.NET.

M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33

; End of File



###################### named.root############################

新建master文件夹 并在里面新建cnc 和 telecom 文件夹

进入masrer文件夹 用notepad 新建cnc.def 和telecom.def

###################### cnc.def############################

zone "dnsany.com" {

type master;

file "C:\WINDOWS\system32\dns\etc\master\cnc\dnsany.com.txt";

};

###################### cnc.def############################

###################### telecom.def############################

zone "dnsany.com" {

type master;

file "C:\WINDOWS\system32\dns\etc\master\telecom\dnsany.com.txt";

};

###################### telecom.def############################

分别进入cnc和telecom文件夹建立dnsany.com.txt文件

#########################cnc\dnsany.com.txt##############################

$TTL 3600

$ORIGIN dnsany.com.

@ IN SOA ns.joysp.com. root. joysp.com.(

2006111520 ;Serial

3600 ; Refresh ( seconds )

900 ; Retry ( seconds )

68400 ; Expire ( seconds )

15 );Minimum TTL for Zone ( seconds )

;

@ IN NS ns.joysp.com.

@ IN A 220.248.236.152

www IN A 220.248.236.152

* IN A 220.248.236.152

;

;end

#########################cnc\dnsany.com.txt##############################

#########################telecom\dnsany.com.txt##############################

$TTL 3600

$ORIGIN dnsany.com.

@ IN SOA ns.joysp.com. root. joysp.com.(

2006111520 ;Serial

3600 ; Refresh ( seconds )

900 ; Retry ( seconds )

68400 ; Expire ( seconds )

15 );Minimum TTL for Zone ( seconds )

;

@ IN NS ns.joysp.com.

@ IN A 60.171.45.152

www IN A 60.171.45.152

* IN A 60.171.45.152

;

;end

#########################telecom\dnsany.com.txt##############################

全部配置完成后,可以进入Windows 服务管理器,找到那个叫 ISC Bind的服务,而后属性更改登陆为本地系统用户选择启动,如果出现错误,请打开你的事件查看器,到应用程序部分看看什么错误。如果没有问题,则已经运行起来了。

3.测试

运行CMD,而后输入: nslookup

C:\>nslookup

Default Server: ns.ahhfptt.net.cn

Address: 202.102.192.68



> server 60.171.45.152

Default Server: [60.171.45.152]

Address: 60.171.45.152



> set type=any

> dnsany.com

Server: [60.171.45.152]

Address: 60.171.45.152



dnsany.com

primary name server = ns.joysp.com

responsible mail addr = root.592365.com

serial = 2005121213

refresh = 3600 (1 hour)

retry = 900 (15 mins)

expire = 68400 (19 hours)

default TTL = 15 (15 secs)

dnsany.com nameserver = ns.joysp.com

dnsany.com internet address = 60.171.45.152



说明DNS服务器解析正常!



说明下dnsany.com.txt

#########################cnc\dnsany.com.txt##############################

$TTL 3600

$ORIGIN dnsany.com.

@ IN SOA ns.joysp.com. root. joysp.com.(

2006111520 ;Serial

3600 ; Refresh ( seconds )

900 ; Retry ( seconds )

68400 ; Expire ( seconds )

15 );Minimum TTL for Zone ( seconds )

;

@ IN NS ns.joysp.com.

@ IN MX 0 mail.

@ IN A 220.248.236.152

www IN A 220.248.236.152

webserver IN CNAME www

mail IN A 220.248.236.152

* IN A 220.248.236.152

;

;end

#########################cnc\dnsany.com.txt##############################

第一行是TTL设定,生存时间记录字段。它以秒为单位定义该资源记录中的信息存放在高速缓存中的时间长度。这里定义为604800秒,也就是1周.

第二行是$ORIGIN设定,说明下面的记录出自何处.请您加倍留意最后的一个小小数点"."

然后,第三行,是一个 SOA 记录的设定,在这里我们看到一个特殊字符 @ ,它就是 ORIGIN 的意思,也就是刚刚所定义的$ ORIGIN dnsany.com. 的内容,您可以写成 dnsany.com. 也可以用 @ 来代替。

假如这个文件前面没有定义 $ ORIGIN 的话, 那這个 @ 的值就以 named.conf 里的 zone .

接着 SOA 后面,指定了这个区域的授权主机和管理者的信箱,这里分别是"joysp.com." 和"root.joysp.com."。我们平时使用的信箱通常是“user@host”这样的格式,但因为@在 DNS 记录中是个保留字符,所以在 SOA 中就用“.”来代替了@。目前这个信箱是 "root@joysp.com."。

接下来的 SOA 设置,是被括在“( )”之间的 5 组数字,主要作为和 slave 服务器同步 DNS 资料所使用的资料:

Serial:其格式通常会是“年月日+修改次序”(但也不一定如此,您自己能够记得就行)。当 slave 要进行资料同步的时候,会比较这个号码。如果发现在这里的号码比它那边的数值“大”,就进行更新,否则忽略。不过设 serial 有一个地方您要留意:不能超过 10 位数字!

Refresh:这里是是告诉 slave 要隔多久要进行资料同步(是否同步要看 Serial 的比较结果)。

Retry:如果 slave 在进行更新失败后,要隔多久再进行重试。

Expire:这是记录逾期时间:当 slave 一直未能成功与 master 取得联系,那到这里就放弃 retry,同时这里的资料也将标识为过期(

expired )。

Minimum:这是最小默认 TTL 值,如果您在前面没有用“$TTL”来定义,就会以此值为准。

请注意:SOA 记录中这对 “ ( ) ”符号之第一个 “ (”括号一定要和 SOA 写在同一行,而不能用 Enter 断行到下一行去,而且其左边最好有一个空格键或 tab 建。而最后一个 “ )”括号也不能写在注解符号 “ ;”的右边。 置 DNS 的 RR 记录档,其格式要求非常严格,我们丝毫不能掉以轻心。比方说:如果句子不是以空格键、Tab 键、 或注解符号 ( ; )开头,也不在 SOA 的 “ ( ) ”之内,则表示要定义一个“新记录项 (Entry) ”;如果句子是以空格键或 tab 键开始的话,其设置被视为上一个“记录项”的内容。所以,如果您要为“同一个记录项”定义多个记录设置,而不想重复打字,您倒可以偷懒:在接着它的后面几行用空白或 Tab 来缩排就可以了。

NS表明负责dnsany.com.这个域的Name Server是ns.joysp.com这台主机

MX记录标明发往mail域的邮件由mail.dnsany.com这台服务器接收

A记录标明了IP地址和域名之间的对应关系











后记

DNS智能策略解析还可以给你的多个主机实现负载均衡,这时来自各地的访问流量会比较平均的分布到你的每一个主机上。

只需要在相应的CNC TELECOM文件中加@ www记录

#########################cnc\dnsany.com.txt##############################

$TTL 3600

$ORIGIN dnsany.com.

@ IN SOA ns.joysp.com. root. joysp.com.(

2006111520 ;Serial

3600 ; Refresh ( seconds )

900 ; Retry ( seconds )

68400 ; Expire ( seconds )

15 );Minimum TTL for Zone ( seconds )

;

@ IN NS ns.joysp.com.

@ IN A 220.248.236.152

@ IN A 220.248.236.153

@ IN A 220.248.236.154

@ IN A 220.248.236.155

www IN A 220.248.236.152

www IN A 220.248.236.153

www IN A 220.248.236.154

www IN A 220.248.236.155

* IN A 220.248.236.152

;

;end

#########################cnc\dnsany.com.txt##############################

#########################telecom\dnsany.com.txt##############################

$TTL 3600

$ORIGIN dnsany.com.

@ IN SOA ns.joysp.com. root. joysp.com.(

2006111520 ;Serial

3600 ; Refresh ( seconds )

900 ; Retry ( seconds )

68400 ; Expire ( seconds )

15 );Minimum TTL for Zone ( seconds )

;

@ IN NS ns.joysp.com.

@ IN A 60.171.45.152

@ IN A 60.171.45.153

@ IN A 60.171.45.154

@ IN A 60.171.45.155

www IN A 60.171.45.152

www IN A 60.171.45.153

www IN A 60.171.45.154

www IN A 60.171.45.155

* IN A 60.171.45.152

;

;end

#########################telecom\dnsany.com.txt##############################







C:\Documents and Settings\coolice>cd \



C:\>nslookup

Default Server: ns.ahhfptt.net.cn

Address: 202.102.192.68

>server ns.joysp.com

> set q=a

> dnsany.com

Server: ns.joysp.com

Address: 60.171.45.152



Non-authoritative answer:

Name: dnsany.com

Addresses: 60.171.45.152, 60.171.45.153, 60.171.45.154, 60.171.45.155



配置文件下载: http://iamsam.blogbus.com/files/12218213130.zip


官方配置文件示例:

http://www.bind.com/?path=dns

用Bind9架设自己的智能DNS

用Bind9架设自己的智能DNS

by ProdigYu on Oct.20, 2010, under CDN

中国的南北网络问题,是许多做网站的人的心病
除了使用双通或者多通机房以外,还可以通过多台镜像服务器的方法来提高用户的访问速度
但是,如果使用的双通机房并不是单IP的,或者使用多台镜像的做法,就会面临多个不同的服务器IP的问题
最早的时候,很多镜像服务器都是使用不同的域名的,比如说www1和www2,或者www和cnc
这样的做法,对用户相当不友好,而且不方便推广,比如说,你要告诉朋友一个网站,还要问他是什么线路才能给网址吗,或者可能你还不知道这个网站有一个专为网通的线路所设置的镜像
用统一的域名,然后根据用户的线路自动判断引导到不同的镜像服务器,正是智能DNS的功用(智能DNS其实是CDN的其中一部分,是最前端的部分)

现在还是有一些地方使用多域名,比如说下载网站的下载镜像服务器,因为智能DNS有一定的缺陷(并不一定选择到正确的线路,下面说),也提供给用户自由选择线路的权利

目前也有一些公司提供智能DNS解释服务,把你的域名NS指到他们服务器,然后输入网通和电信服务器的IP就ok了
也有一些公司提供比较完整的CDN服务,比如比较出名的就是chinacache,不少中型网站是使用他们的服务

最初的bind是不支持通过来源选择不同的ip的,因此只能通过iptables的辅助来实现智能DNS,方法也很简单,在DNS服务器上面启动两份bind,都不要用默认的端口,两份分别解析不同的线路,然后再用iptables将默认端口的DNS请求根据来源IP发送到不同的bind实例
这种方法缺点很明显,需要多个bind实例,如果需要更多的线路解释那就还要再开bind实例,另外iptables对来源的解释也会导致iptables太多规则

现在的bind支持了根据来源选择的功能,我不确定是不是bind9的新特性,不过bind9是重写过的,相比漏洞百出的bind8来说,稳定和安全很多,以下的配置以bind9为基础

我使用的是CentOS,由于bind服务没有其他服务(比如apache,squid)要求那么高,所以也没有必要自己编译一份,我是用过yum安装的,版本不是最新的稳定版

装好之后,可以用过/etc/init.d/named start成功启动服务
有一个文件named.conf出现在/etc下,就是bind的主config文件,我们只要改动他
(我只说明智能DNS实现部分,其他的bind设置自行修改,呵呵)
另外一个小技巧,可以通过/usr/sbin/named -g -u named来启动bind,可以立刻看到输出信息,方便调试

我们是通过bind9的view功能来分离判断的
首先,我们需要一份网通的IP列表,这是一份在网上流传的列表,呵呵

acl “CNC” {
58.16.0.0/16;
58.17.0.0/17;
58.17.128.0/17;
58.18.0.0/16;
58.19.0.0/16;
58.20.0.0/16;
58.21.0.0/16;
58.22.0.0/15;
58.240.0.0/15;
58.242.0.0/15;
58.244.0.0/15;
58.246.0.0/15;
58.248.0.0/13;
60.0.0.0/13;
60.8.0.0/15;
60.10.0.0/16;
60.11.0.0/16;
60.12.0.0/16;
60.13.0.0/18;
60.13.128.0/17;
60.14.0.0/15;
60.16.0.0/13;
60.24.0.0/14;
60.30.0.0/16;
60.31.0.0/16;
60.208.0.0/13;
60.216.0.0/15;
60.218.0.0/15;
60.220.0.0/14;
61.48.0.0/13;
61.133.0.0/17;
61.134.96.0/19;
61.134.128.0/17;
61.135.0.0/16;
61.137.128.0/17;
61.138.0.0/17;
61.138.128.0/18;
61.139.128.0/18;
61.148.0.0/15;
61.156.0.0/16;
61.159.0.0/18;
61.161.0.0/18;
61.161.128.0/17;
61.162.0.0/16;
61.163.0.0/16;
61.167.0.0/16;
61.168.0.0/16;
61.176.0.0/16;
61.179.0.0/16;
61.181.0.0/16;
61.182.0.0/16;
61.189.0.0/17;
125.32.0.0/16;
125.40.0.0/13;
202.96.0.0/18;
202.96.64.0/21;
202.96.72.0/21;
202.97.128.0/18;
202.97.224.0/21;
202.97.240.0/20;
202.98.0.0/21;
202.98.8.0/21;
202.99.64.0/19;
202.99.96.0/21;
202.99.128.0/19;
202.99.160.0/21;
202.99.168.0/21;
202.99.176.0/20;
202.99.208.0/20;
202.99.224.0/21;
202.99.232.0/21;
202.99.240.0/20;
202.102.128.0/21;
202.102.224.0/21;
202.102.232.0/21;
202.106.0.0/16;
202.107.0.0/17;
202.108.0.0/16;
202.110.0.0/17;
202.111.128.0/18;
203.93.8.0/24;
203.93.192.0/18;
210.13.128.0/17;
210.14.160.0/19;
210.14.192.0/19;
210.15.32.0/19;
210.15.96.0/19;
210.15.128.0/18;
210.21.0.0/16;
210.52.128.0/17;
210.53.0.0/17;
210.53.128.0/17;
210.74.96.0/19;
210.74.128.0/19;
210.82.0.0/15;
218.8.0.0/14;
218.12.0.0/16;
218.21.128.0/17;
218.24.0.0/14;
218.56.0.0/14;
218.60.0.0/15;
218.67.128.0/17;
218.68.0.0/15;
218.104.0.0/14;
219.154.0.0/15;
219.156.0.0/15;
219.158.0.0/17;
219.158.128.0/17;
219.159.0.0/18;
220.252.0.0/16;
221.0.0.0/15;
221.2.0.0/16;
221.3.0.0/17;
221.3.128.0/17;
221.4.0.0/16;
221.5.0.0/17;
221.5.128.0/17;
221.6.0.0/16;
221.7.0.0/19;
221.7.32.0/19;
221.7.64.0/19;
221.7.96.0/19;
221.8.0.0/15;
221.10.0.0/16;
221.11.0.0/17;
221.11.128.0/18;
221.11.192.0/19;
221.12.0.0/17;
221.12.128.0/18;
221.13.0.0/18;
221.13.64.0/19;
221.13.96.0/19;
221.13.128.0/17;
221.14.0.0/15;
221.192.0.0/15;
221.194.0.0/16;
221.195.0.0/16;
221.196.0.0/15;
221.198.0.0/16;
221.199.0.0/19;
221.199.32.0/20;
221.199.128.0/18;
221.199.192.0/20;
221.200.0.0/14;
221.204.0.0/15;
221.206.0.0/16;
221.207.0.0/18;
221.207.64.0/18;
221.207.128.0/17;
221.208.0.0/14;
221.212.0.0/16;
221.213.0.0/16;
221.216.0.0/13;
222.128.0.0/14;
222.132.0.0/14;
222.136.0.0/13;
222.160.0.0/15;
222.162.0.0/16;
222.163.0.0/19;
222.163.32.0/19;
222.163.64.0/18;
222.163.128.0/17;
};

如果觉得有哪些部分不是很准确的话,可以自行修改

由于这个部分太长了,所以写在一个专门的文件然后include进named.conf比较容易维护
例如,我们把上面这段配置保存为cnc_acl.conf
然后在named.conf写入

include “/data/named/cnc_acl.conf”;

即可

接下来就是view的配置,假设域名是xyz.com,呵呵

view “view_cnc” {
match-clients { CNC; };
zone “xyz.com” {
type master;
file “/data/named/cnc_xyz”;
};
};

view “view_any” {
match-clients { any; };
zone “xyz.com” {
type master;
file “/data/named/any_xyz”;
};
};

就这样就足够了

然后我们需要cnc\_xyz和any_xyz两个具体的zone file
两个文件基本是一模一样的,就是指向不同的ip

$TTL 2h
xyz.com. IN SOA ns.xyz.com. root.xyz.com. (
20071022
2h
40m
1w
2h
)

this6.com. IN NS ns.xyz.com.
this6.com. IN MX 1 mail.xyz.com.
ns IN A 1.1.1.1
mail IN A 1.1.1.1

www IN A 1.1.1.1

根据不同的线路把www指向不同的IP即可
这样,我们就实现了自己的智能DNS

后话,目前许多大型网站都是用这个来实现不同的线路来源访问不同的镜像,甚至还做到地区级别,例如,在佛山机房部署了一台镜像服务器,就将广东省的访问都指向这台服务器
另外,刚刚提到智能DNS也有缺陷,这里详细描述一下,bind9通过用户的来源IP来返回不同的解释IP,而实际上,并不是实际用户直接访问我们的 DNS,而是用户所使用的DNS(比如说广州ADSL用户的默认DNS)负责访问我们的DNS,网通的DNS就保存有我们网通的IP,如果用户自行修改了 DNS,比如说电信的用户硬要用网通的DNS,或者网通的用户使用国外的DNS(比如opendns之类的),就会导致判断失误

2010/11/03

修改vim的編碼

vim ~/.vimrc 後 i 寫入 enc=utf-8 \n fenc=utf-8 :wq

2010/11/02

[Linux] 在 windows底下讀寫linux

« [Linux] cwRsync [rsync for windows] SSH 加密異地備份
Ubuntu Edgy Release KDE 桌面環境 »
[Linux] 在 windows底下讀寫linux

Dec 15th, 2006 by appleboy 參觀者:9,215Views 機器人:1,295Views
推到 Twitter!
推到 Plurk!
推到 Facebook!

剛剛在ptt看到的,一連串討論

□ XP 認得 ext2/ext3 磁區嗎 ?

裡面有很多文章 寫的不錯,可以提供出來

問題:

想問一下,我有一個移動式硬碟 60G
所以只能format 成 NTFS or ext2/ext3

而在 Linux 下, 目前支援 NTFS 讀寫可能要另外掛 package…

所以想問,那 Windows XP 是否支援 ext2 / ext3
ext3好像不行, 因為剛剛在 Linux 下 format成 ext3了
並備份了一些東東,到進到了Windows XP底下好像認不得了,

想問,ext2 在 Windows XP 底下,OK嗎…
xp認得嗎?

解法如下

作者 wyocbu@kkcity.com.tw (wyocbu),

以前下載過一個商業軟體 Paragon Mount Everything
http://www.mount-everything.com/

印象中好像可以讀寫 ext3

作者 ogre0403 (肚子餓)

只要讀的話 試試這個 應該是free的
http://www.chrysocome.net/explore2fs
寫的話應該不行

作者 alpe (薛丁格的貓)

http://www.fs-driver.org/

IFS Drivewrs 讀寫可… 不過中文編碼就…

作者 adolf.bbs@cd.twbbs.org (蘇怡華 有人要死了),

> http://ext2fsd.sf.net/
> ext2 可讀可寫
> ext3 唯讀

其實這類的driver都可以正常寫ext3
只是把journal關掉而已…

http://pank.org/blog/archives/000621.html


作者 jlovet (阿我真是猜不透XD)

ext2 跟 ext3是相容的檔案系統
在只支援ext2的OS上面mount ext3可以正常讀寫
只是會略過journal

關於ntfs-3g的測試…網站上面就有了…
http://www.ntfs-3g.org/performance.html

Ubuntu 掛載 Windows 分割區

Ubuntu 6.10 (Edgy):
deb http://givre.cabspace.com/ubuntu/ edgy main
deb http://ntfs-3g.sitesweetsite.info/ubuntu/ edgy main
deb http://flomertens.keo.in/ubuntu/ edgy main

Ubuntu 6.06 (Dapper Drake):
deb http://givre.cabspace.com/ubuntu/ dapper main main-all
deb http://ntfs-3g.sitesweetsite.info/ubuntu/ dapper main main-all
deb http://flomertens.keo.in/ubuntu/ dapper main main-all

然後執行以下指令更新 repositories 及安裝 ntfs-3g:

wget http://flomertens.keo.in/ubuntu/givre_key.asc -O- | sudo apt-key add -
wget http://givre.cabspace.com/ubuntu/givre_key.asc -O- | sudo apt-key add -
sudo apt-get update
sudo apt-get install ntfs-3g

http://www.real-blog.com/linux-bsd-notes/290


文章來源

2010/08/23

Rsyslog Template for Fortigate Traffic


CREATE TABLE IF NOT EXISTS `Fortigate` (
`ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`log_time` datetime NOT NULL,
`log_id` int(10) unsigned NOT NULL,
`type` varchar(20) NOT NULL,
`subtype` varchar(20) NOT NULL,
`pri` varchar(20) NOT NULL,
`fwver` varchar(20) NOT NULL,
`vd` varchar(20) NOT NULL,
`msg` varchar(100) NOT NULL,
`action` varchar(20) NOT NULL,
`rem_ip` varchar(15) NOT NULL,
`loc_ip` varchar(15) NOT NULL,
`rem_port` int(10) unsigned NOT NULL,
`loc_port` int(10) unsigned NOT NULL,
`out_intf` varchar(20) NOT NULL,
`cookies` varchar(40) NOT NULL,
`user` varchar(20) NOT NULL,
`group` varchar(20) NOT NULL,
`xauth_user` varchar(20) NOT NULL,
`xauth_group` varchar(20) NOT NULL,
`vpn_tunnel` varchar(20) NOT NULL,
`status` varchar(20) NOT NULL,
`init` varchar(20) NOT NULL,
`mode` varchar(20) NOT NULL,
`dir` varchar(20) NOT NULL,
`stage` int(10) unsigned NOT NULL,
`role` varchar(20) NOT NULL,
`result` varchar(20) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

$template fortigate, "insert into Fortigate (log_time,log_id,type,subtype,pri,fwver,vd,msg,action,rem_ip,loc_ip,rem_port,loc_port,out_intf,cookies,user,group,xauth_user,xauth_group,vpn_tunnel,status,init,mode,dir,stage,role,result) values ('%timegenerated:::date-mysql%','%msg:R,ERE,1,BLANK:log_id=([a-zA-Z0-9]+)--end%','%msg:R,ERE,1,BLANK:type=([a-zA-Z0-9]+)--end%','%msg:R,ERE,1,BLANK:subtype=([a-zA-Z0-9]+)--end%','%msg:R,ERE,1,BLANK:pri=([a-zA-Z0-9]+)--end%','%msg:R,ERE,1,BLANK:fwver=([a-zA-Z0-9]+)--end%','%msg:R,ERE,1,BLANK:vd=([a-zA-Z0-9]+)--end%','%msg:R,ERE,1,BLANK:msg=([a-zA-Z0-9]+)--end%','%msg:R,ERE,1,BLANK:action=([a-zA-Z0-9]+)--end%',%msg:R,ERE,1,BLANK:rem_ip=([0-9]+.[0-9]+.[0-9]+.[0-9]+)--end%,'%msg:R,ERE,1,BLANK:loc_ip=([0-9]+.[0-9]+.[0-9]+.[0-9]+)--end%',%msg:R,ERE,1,ZERO:rem_port=([0-9]+)--end%,%msg:R,ERE,1,ZERO:loc_port=([0-9]+)--end%,
'%msg:R,ERE,1,BLANK:out_intf=([a-zA-Z0-9_]+)--end%',%msg:R,ERE,1,BLANK:cookies=([a-zA-Z0-9]+)--end%,'%msg:R,ERE,1,BLANK:user=([a-zA-Z0-9]+)--end%','%msg:R,ERE,1,BLANK:group=([a-zA-Z0-9]+)--end%','%msg:R,ERE,1,BLANK:xauth_user=([a-zA-Z0-9]+)--end%',%msg:R,ERE,1,BLANK:xauth_group=([a-zA-Z0-9]+)--end%,
%msg:R,ERE,1,BLANK:vpn_tunnel=([a-zA-Z0-9]+)--end%,'%msg:R,ERE,1,BLANK:status=([a-zA-Z0-9]+)--end%',%msg:R,ERE,1,BLANK:init=([a-zA-Z0-9]+)--end%,'%msg:R,ERE,1,BLANK:mode=([a-zA-Z0-9]+)--end%',%msg:R,ERE,1,BLANK:dir=([a-zA-Z0-9]+)--end%,'%msg:R,ERE,1,BLANK:stage=([a-zA-Z0-9]+)--end%',%msg:R,ERE,1,BLANK:role=([a-zA-Z0-9]+)--end%,%msg:R,ERE,1,BLANK:result=([a-zA-Z0-9]+)--end%)", SQL



CREATE TABLE IF NOT EXISTS `Fortigate2` (
`ID` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
`log_time` DATETIME NOT NULL ,
`log_id` INT( 10 ) UNSIGNED NOT NULL ,
`type` VARCHAR( 20 ) NOT NULL ,
`subtype` VARCHAR( 20 ) NOT NULL ,
`pri` VARCHAR( 20 ) NOT NULL ,
`vd` VARCHAR( 20 ) NOT NULL ,
`msg` VARCHAR( 100 ) NOT NULL ,
`action` VARCHAR( 20 ) NOT NULL ,
`user` VARCHAR( 20 ) NOT NULL ,
`status` VARCHAR( 20 ) NOT NULL ,
`reason` VARCHAR( 20 ) NOT NULL ,
`ui` VARCHAR( 20 ) NOT NULL ,
PRIMARY KEY ( `ID` ))
ENGINE = MYISAM DEFAULT CHARSET = utf8 AUTO_INCREMENT =1;

$template fortigate2, "insert into Fortigate2 (log_time,log_id,type,subtype,pri,vd,msg,action,user,status,reason) values ('%timegenerated:::date-mysql%','%msg:R,ERE,1,BLANK:log_id=([a-zA-Z0-9]+)--end%','%msg:R,ERE,1,BLANK:type=([a-zA-Z0-9]+)--end%','%msg:R,ERE,1,BLANK:subtype=([a-zA-Z0-9]+)--end%','%msg:R,ERE,1,BLANK:pri=([a-zA-Z0-9]+)--end%','%msg:R,ERE,1,BLANK:vd=([a-zA-Z0-9]+)--end%','%msg:R,ERE,1,BLANK:msg=([a-zA-Z0-9() .]+)--end%','%msg:R,ERE,1,BLANK:action=([a-zA-Z0-9]+)--end%','%msg:R,ERE,1,BLANK:user="([a-zA-Z0-9]"+)--end%','%msg:R,ERE,1,BLANK:status=([a-zA-Z0-9]+)--end%','%msg:R,ERE,1,BLANK:reason=([a-zA-Z0-9"_]+)--end%')", SQL

2010/08/17

Dialogic 卡片安裝步驟

http://www.dialogic.com/support/helpweb/divasvr/InbuiltDrivers.aspx

2010/08/15

修改遠端桌面的port

Windows XP『遠端桌面』功能預設以編號3389連接埠作訊息傳輸,但可因應需要而進行修改︰啟動Regedit
,到路徑HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TerminalServer\WinStations\RDP-Tcp
中DWORD值PortNumber,把數值由3389改為任何的數值便可,然後重新開機。

2010/08/14

ASP.NET AJAX 1.0 M$版

http://www.microsoft.com/downloads/details.aspx?FamilyID=ca9d90fa-e8c9-42e3-aa19-08e2c027f5d6&displaylang=en

2010/08/11

修改 Office 2007 序號 ( Change Office 2007 product license key)

1.關閉所有Office軟體,如:Word、Excel、Access 等

2.執行 regedit,找到此機碼HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0\Registration\{30120000-0011-0000-0000-0000000FF1CE}

3.在上方最後機碼或許不一樣,但進入該機碼中找到

DigitalProductID
ProductID

4.刪除該二個機碼值

5.開啟任一 Office 軟體,輸入新序號即可