[PHP]如何把 Yahoo! BBAuth 加入網站入口認證

最近很紅的一個 Yahoo APIBrowser-Based Authentication,這是目前蠻多網站開始支援的認證之一,在 XDite 網站看到他們去參加 Yahoo Open Hack Day 的參賽作品:「和多繽紛樂XDite 網站說明,裡面就有提供 OpenID 以及 Yahoo BBAuth 登入方式,等於是說目前你有 Yahoo 帳號或者是 OpenID 的帳號都可以直接進去 和多繽紛樂 做登入動作,這對於有使用者不使用註冊這麼多網站,也記太多帳號密碼而煩惱,而 Browser-Based Authentication 也提供了 Single Sign-On (SSO) 給大家使用,底下是大概講解一下 Yahoo BBAuth 是如何運作: bbauth

[Read More]

[jQuery] AJAX 學習筆記 (一) 如何使用 JSON 驗證使用者表單

最近開始摸了 jQuery,因為自己本身也很想學習,這是目前當紅的技術,許多網站已經開始在使用 jQuery AJAX 了,包含各大入口網站:Pixnet 痞客幫,大家會發現學習 jQuery 好處很多,重點是她將 javascript 整合了,讓你方便使用來讓網站 web 2.0 我想現在很多網站都是朝這個方向去進行了,如果想知道什麼是 AJAX 可以上網查維基百科解釋,已目前來說,大家都使用javascript 客戶端來取得資料,然而 AJAX 可以從Server端取的資料 show 在使用者端給大家看,底下會大概講解以及實做一個驗證。

[Read More]

[FreeBSD]安裝 apache2 (worker) + PHP5.2.6 + mod_fastcgi + php5-fcgi

今天把 FreeBSD web 改成了 apache worker 其實之前就已經這麼做了,只是今天加上 mod_fastcgi 我是參考 DarkKiller 大神 apache22 (worker) + mod_fastcgi + php5-fcgi,之前就把 Server 換成了 php5-fcgi,只不過我是搭配 Lighttpd,效能方面還不錯,可以參考這篇:[FreeBSD] Lighttpd + PHP + mod_proxy + FastCGI,那因為用 lighttpd 的外掛模組真的太少,不像 apache 支援這麼多 module,重點是還缺少了 .htaccess 這個功能,所以大大降低大家使用 lighttpd,近期內會把全部 server 換成 apache2 搭配 mod_fastcgi,那底下寫一下作法了:

[Read More]

[WWW] FTP 的主動模式( active )和被動模式( passive )

這一篇轉錄自 http://forum.icst.org.tw/phpBB2/viewtopic.php?t=79 目前 FTP 已經是大家必備的東西,那架站之前你必須先瞭解什麼是 主動模式( active )和被動模式( passive )

FTP 的主動模式( active )和被動模式( passive ) FTP 是一種檔傳輸協定 (File Transfer Protocol),它的連線模式有兩種﹕ 主動模式( active )和被動模式( passive )。以下說明 FTP 的連線是怎樣建立的﹕ 在 active 模式下 (一般預設的模式)﹕ 1. FTP client 開啟一個隨機選擇的TCP port 呼叫 FTP server 的 port 21請求連線。當順  利完成 Three-Way Handshake 之後,連線就成功建立,但這僅是命令通道的建立  。 2.當兩端需要傳送資料的時候,client 透過命令通道用一個 port command 告訴 server  ,client可以用另一個TCP port 做數據通道。 3.然後 server 用 port 20 和剛才 client 所告知的 TCP port 建立數據連線。請注意:連  線方向這是從 server 到 client 的,TCP 封包會有一個 SYN flag。 4.然後 client 會返回一個帶 ACK flag的確認封包﹐並完成另一次的 Three-Way  Handshake 手續。這時候,數據通道才能成功建立。 5.開始數據傳送。 在 passive 模式下 1.FTP client 開啟一個隨機選擇的TCP port 呼叫 FTP server 的 port 21請求連線,並完  成命令通道的建立。 2.當兩端需要傳送資料的時候,client 透過命令通道送一個 PASV command 給  server,要求進入 passive 傳輸模式。 3.然後 server 像上述的正常模式之第 2 步驟那樣,挑一個TCP port ,並用命令通道  告訴 client。 4.然後 client 用另一個TCP port 呼叫剛才 server 告知的 TCP port 來建立數據通道。此  時封包帶 SYN flag。 5.server 確認後回應一個 ACK 封包。並完成所有交握手續?成功建立數據通道。 6.開始數據傳送。 在實際使用上, active mode 用來登入一些開設在主機上及沒有安裝防火牆的 FTP server,或是開設於 client side 的 FTP server! Passive mode (簡稱 PASV)用來登入一些架設於防火牆保護下而又是開設於主機上的 FTP server! 如果您覺得太深奧而弄不清楚, 那就先用預設的 active mode 登入, 失敗改用 passive mode 登入就是了。 PS: 並不是每套 FTP 軟體都支援 passive mode 登入

[Read More]

[FreeBSD] 無線 AP 鎖定使用者 MAC Address

在之前的文章已經提到如何利用一張無線網卡架設 AP 伺服器,[FreeBSD] 無線網卡架設AP Server DWL-G520 Ralink RT2561,但是如何跟外面賣得產品一樣可以鎖mac呢,雖然mac的竄改相當普遍,linux底下只要下一個指令就可以達到了,不過你要知道別人的mac還蠻難的吧,除非你跟她同一網域,所以底下就介紹在freebsd底下如何做到。 在linux底下其實很簡單,因為google一下就好了 http://madwifi.org/wiki/UserDocs 這個網頁相當豐富,教你如何在linux底下實做ap跟鎖MAC。

Steps 1. First, make sure your card is not set to any particular mode or essid. 2. Run: * To flush the list of MAC addresses: iwpriv ath0 maccmd 3 * To make the list a whitelist: iwpriv ath0 maccmd 1 3. Put the card in master mode: iwconfig ath0 mode master essid test ifconfig ath0 up 4. At this point, nothing will be able to connect to the AP, since the whitelist is empty. To rectify this, you need to add some MACs to the list: iwpriv ath0 addmac 00:01:02:03:04:05 在 FreeBSD 底下,作法也蠻容易的,就是利用 ifconfig 這個指令就可以做到了,底下是我 man ifconfig 看到的

[Read More]

[FreeBSD] Smokeping 安裝 架設

昨天看到 sayya 的 firedragen 個人版,看到 smokeping 的一些圖片,還蠻帥的,就想到要架設來玩看看 安裝方式如下:

[FreeBSD][root][ ~ ]# cd /usr/ports/net/smokeping/ 進去之後

make install clean 然後底下是安裝好之後的訊息

NOTE: A set of sample configuration files have been installed: /usr/local/etc/smokeping/config /usr/local/etc/smokeping/smokemail /usr/local/etc/smokeping/basepage.html /usr/local/etc/smokeping/tmail You *MUST* edit these to suit your requirements. Please read the manpages ‘smokeping_install’ and ‘smokeping_config’ for further details on installation and configuration. If you are upgrading from a previous version of Smokeping, the manpage ‘smokeping_upgrade’ may be of help. Once configured, you can start SmokePing by adding: smokeping_enable=”YES” to /etc/rc.conf, and then running, as root: /usr/local/etc/rc.d/smokeping start To enable Apache web access, add the following to your /usr/local/etc/apache/httpd.conf: ScriptAlias /smokeping.cgi /usr/local/smokeping/htdocs/smokeping.cgi Alias /smokeimg/ /usr/local/smokeping/htdocs/img/ 上面就是寫:請在 /etc/rc.conf 加入 smokeping_enable=”YES” 然後編輯 /usr/local/etc/apache/httpd.conf 在最後面加上 ScriptAlias /smokeping.cgi /usr/local/smokeping/htdocs/smokeping.cgi Alias /smokeimg/ /usr/local/smokeping/htdocs/img/ 修改 根目錄底下權限 Options Indexes FollowSymLinks ExecCGI 然後底下這段原本mark,請把他取消 AddHandler cgi-script .cgi 然後最後加上 Options Indexes FollowSymLinks ExecCGI AllowOverride Limit Order Deny,Allow Deny from all Allow from 192.168 底下附上設定檔,DarkKiller 在 firedragen 版 的連結,不過連結已經失效,好顯自己有存檔 http://blog.wu-boy.com/wp-content/uploads/2007/04/smokeping.txt 最後 NCTU NetFlow’s somkeping demo: http://netflow.ntcu.net/smokeping/smokeping.cgi?target=Album

[Read More]

Lftp 使用FXP以及使用implicit mode加密傳輸

其實 lftp 是一個相當好用的文字介面ftp軟體,目前我在玩 linux,就是搭配這套軟體,這套軟體可以搭配shell script,來做到備份的工作,相當不錯,之前在網路上看到 segaa大大寫的一篇 [freebsd] lftp安裝與應用 使用起來很方便,不過我遇到的server都是利用 explicit mode 方式加密,如果利用 implicit mode方式連接,指令可能有些不同,底下來介紹一下

如果你的server端用 explicit 方式來連接,你可使用

1
lftp -d -u appleboy -p PORT url

如果你用 implicit 方式的話,就用下面

1
2
3
4
5
[appleboy@appleboy-dorm][~][20:23:03]$ lftp
lftp :~> open -d ftps://username:password@url:port 
#
# 注意 是 ftps://
#
[Read More]

[Linux] CentOS 4.4 安裝 Openwebmail + spamassassin 擋垃圾信的設定方法

其實以現在linux安裝方式已經相當容易了,不像以前都要tarball安裝,相當複雜,昨天安裝 openwebmail 只花了幾分鐘的時間,目前系統CentOS4.4 主機相當好,所以安裝起來特別快

想利用 yum install 的安裝方式,不過發現沒有 openwebmail 的套件,所以上網找了rpm

注意:要架設 Open Webmail 前,請務必先將 postfix(架設mail伺服器)、dovecot(POP3伺服器) 架設好

[Read More]