Referer header 的 extension,使用 chrome.experimental.webRequest.onBeforeSendHeaders.addListener 攔截所有的 url 然後處理 Referer header。之前只需要在 manifest.json 裡面加上 experimental 就可以使用,但是前陣子發現失效。剛剛在「onBeforeSendHeaders listeners aren’t triggering」這個 issue 裡面找到解法:現在需要多加上 <all_urls> 這組權限。
rm -r ~/.pulse ~/.asound* ~/.pulse-cookie sudo rm /etc/asound.conf
重開機後就有聲音了…
]]>Magnet URI 下載 BitTorrent 檔案其實只是多了一個抓 torrent 檔的步驟:首先先從 Magnet URI 內取得 SHA1 值,然後透過 DHT 抓到 torrent 檔的 metadata,然後後面就可以照舊進行… 至於 DHT 的初次建立,除了可以透過中央式的 router.utorrent.com 取得外,也可以透過其他 torrent 檔案下載所提供的 tracker 找到節點。在取得一批節點後,透過 PEX 交換出更多的節點。
DHT + PEX 的技術逐漸成熟 (愈來愈多程式支援),然後是最大的 torrent site 採用。之後的 public torrent site 應該都會改朝這個方向走…
]]>Password handling: As soon as you receive a password, hash it using scrypt or PBKDF2 and erase the plaintext password from memory.
Do NOT store users’ passwords. Do NOT hash them with MD5. Use a real key derivation algorithm. PBKDF2 is the most official standard; but scrypt is stronger.
Please keep in mind that even if YOUR application isn’t particularly sensitive, your users are probably re-using passwords which they have used on other, more sensitive, websites — so if you screw up how you store your users’ passwords, you might end up doing them a lot of harm.
其中 scrypt 是作者自己發展的演算法,這邊看看就好。
你可以用 PBKDF2 (RFC 2898)。這邊假設的前提是,你不需要常常重複計算使用者的密碼是否正確。在這個前提下,我們可以把演算法弄得很複雜,而且很耗時,要複雜到用硬體加速也無法產生實質上有效的攻擊。
如果你對密碼學這個領域並不熟,Colin Percival 這篇文章可以拿來當做起點,文章裡面告訴你,某些類型的問題會用某些工具解決。
]]>因為不想影響到系統舊版的 libTorrent 與 rTorrent,所以裝在自己的 home directory 下。
先安裝 libTorrent,用 ./configure --prefix=/home/gslin/foo 之後用 make 編完後 make install 就可以了,有缺軟體的部份會跳訊息出來,用 apt-get 補上 -dev 版本後再繼續安裝。
再來是 rTorrent,首先要注意的是要裝 libncursesw5-dev,也就是有 wide character support 的版本,不然顯示 UTF-8 會有問題 (實際在磁碟上的檔名不會有問題,但顯示會有問題),接著用 libtorrent_CFLAGS="-I/home/gslin/foo/include" libtorrent_LIBS="-L/home/gslin/foo/lib -ltorrent" ./configure --prefix=/home/gslin/foo 指定 libtrorrent 所在位置,然後用 make 編完後 make install。
接下來用 ~/foo/rtorrent 執行,應該就會是新版的 rTorrent 了…
A potential security vulnerability has been identified with certain HP printers and HP digital senders. The vulnerability could be exploited remotely to install unauthorized printer firmware.
另外可以參考 CVE-2011-4161 的說明:
The default configuration of the HP CM8060 Color MFP with Edgeline; Color LaserJet 3xxx, 4xxx, 5550, 9500, CMxxxx, CPxxxx, and Enterprise CPxxxx; Digital Sender 9200c and 9250c; LaserJet 4xxx, 5200, 90xx, Mxxxx, and Pxxxx; and LaserJet Enterprise 500 color M551, 600, M4555 MFP, and P3015 enables the Remote Firmware Update (RFU) setting, which allows remote attackers to execute arbitrary code by using a session on TCP port 9100 to upload a crafted firmware update.
能更新的就想辦法更新吧,無法更新的看看有沒有辦法處理 port 9100…
]]>併購的金額在:
Under terms of the agreement, Akamai will acquire all of the outstanding equity of Cotendo in exchange for a net cash payment of approximately $268 million
上個月月底的時候就有消息了:「Akamai Reportedly Buying Rival Cotendo For Up To $350 Million」,不過一直都是謠傳而已…
Cotendo 的產品在 Akamai 裡面都有對應的產品,這次併購看起來比較像是減少競爭對手,或是買專利…
]]>PS:隨便丟字進去測試的時候,發現 “test” 第五名是 tw.yahoo.com,這是怎麼了…?
]]>簡單的說,修改完 ~/.gitolite/hooks/common/ 裡的 hook script 後,需要下 gl-setup 指令,這個指令會把現在所有的 git repository 內的 hook script 再 symbolic link 一次。
另外,gitolite 的環境變數可能會影響 git 本身執行 (我是在 git pull -v 更新某個目錄下的 git repository 時失敗),這時可以用 /usr/bin/env -i /usr/local/bin/git 確保 git 執行時不會被環境變數影響…
gitolite 看起來是個好東西,不過光是靠官方的文件要搞定頗累… (週末都在 Stack Overflow 上度過)
]]>有玩過 HMAC 的人,讀這些文件應該不難…
TOTP 在預設的情況下,其實就是 HMAC-SHA-1 後取後面 32bits,然後轉成數字取 100000 的餘數,而 TOTP 文件是架構在 HOTP 的定義上,把時間切齊 (預設 30secs) 變成整數丟進去攪和,然後特地交代要處理 2038 年超過 Int32 的 case XDDD
最後 Google 那份文件是要輸出 QR code 讓手機可以讀的方式,建議不要用網路服務產生 QR code (因為有 secret key 啊),寧可自己抓 library 建一個用…
另外 Google Authenticator 一堆東西都只能用預設值 (Currently, the XXX is ignored by the Google Authenticator implementations.),所以也沒什麼好選的,就拿預設值吧… :o
Server side 的話,至少我在 CPAN 上面看到 Authen-OATH 可以用了,用起來也很簡單 :o
]]>