Google 的 Load balancer:Seesaw

前幾天因為流感而睡太多,來消化一些文章。

上個星期 Google 放出一套用 Go 寫的 Load balancer,叫 Seesaw:「Seesaw: scalable and robust load balancing」。

比較有趣的是 BGP 與 anycast VIP 的能力:

Seesaw v2 provides full support for anycast VIPs - that is, it will advertise an anycast VIP when it becomes available and will withdraw the anycast VIP if it becomes unavailable.

Google 這個規模玩的是不同 scale 的花樣...

OpenSSH client 的重大安全性更新

CVE-2016-0777 與 CVE-2016-0778 安全性漏洞是關於 OpenSSH client 的部分:(USN-2869-1: OpenSSH vulnerabilities)

It was discovered that the OpenSSH client experimental support for resuming connections contained multiple security issues. A malicious server could use this issue to leak client memory to the server, including private client user keys.

這下除了要更新以外,要重新生 ssh key 然後更新一堆機器了...

讓 nginx 看到 5xx 回應時,去另外一台有開 debug-mode 的 server 上再跑一次

Debug 模式會比一般的模式來的慢,但可以看到更多資訊。以往的問題是 5xx 難以重製,而 NGINX 的「Capturing 5xx Errors with a Debug Server」這篇文章介紹了如何用 nginx 實作標題的功能。

如果是隨機造成的問題就沒辦法重製,但如果是 client 的狀態造成的問題,就很有可能可以抓出來... 不是解決所有問題,但可以幫助解掉以前不太好解的狀況。

Let's Encrypt 的 Limited Beta

Let's Encrypt 在拿到 IdenTrust 提供的 cross sign (參考「Let's Encrypt 正式出發」) 後所啟動的計畫:「Beta Program Announcements」。

要先透過 Google Forms 填單等待,等通過後要指定 production server 才會發出來。

要注意的是,Let's Encrypt 發出來的 SSL certificate 會比較短,只有 90 天有效,設計上是依靠自動機制在更新,所以理論上不會有問題:

Certificates from Let's Encrypt are valid for 90 days. We recommend renewing them every 60 days to provide a nice margin of error. As a beta participant, you should be prepared to manually renew your certificates at that time. As we get closer to General Availability, we hope to have automatic renewal tested and working on more platforms, but for now, please play it safe and keep track.

再來是有註冊限制,分成 Registrations/IP address 與 Certificates/Domain 兩個限制:

There are two rate limits in play: Registrations/IP address, and Certificates/Domain.

前者的限制是每天 10 次:

Registrations/IP address limits the number of registrations you can make in a given day; currently 10. This means you should avoid deleting the /etc/letsencrypt/accounts folder, or you may not be able to re-register.

後者的限制是每個 domain 只給 4 個 certificate:

Certificates/Domain you could run into through repeated re-issuance. This limit measures certificates issued for a given combination of Top Level Domain + Domain. This means if you issue certificates for the following domains, at the end you would have what we consider 4 certificates for the domain example.com.

拿來測試應該是夠用。

對 Zeus Web Server 的 Timing Attack

Update:這應該是在講 Zeus C&C 系統,不是 Zeus Web Server... ~_~

在「Timing attack vulnerability in most Zeus server-sides」這邊看到難得的 HTTP-based timing attack,藉由程式的漏洞而產生出能夠偵測出來的 timing attack:

雖然 Zeus Web Server 已經收攤了,不過這還是示範了很好玩的攻擊手法...

Apache 2.4.17:內建支援 HTTP/2

Zite 上突然看到 mod_h2 的文章,想說不是早就放出來很久了嗎... 仔細看才發現是 Apache HTTP Server 2.4.17 發行了:「how to h2 in apache」。

Support for HTTP/2 is finally being released with Apache httpd 2.4.17! This pages gives advice on how to build/deploy/configure it. The plan is to update this as people find out new things (read: bugs) or give recommendations on what works best for them.

另外在「Apache HTTP Server 2.4.17 Released」這邊可以看到公告,不過官方每次改版都直接改掉這個檔案 (沒有存檔),如果要看歷史紀錄的話到 Internet Archive: Wayback Machine 的頁面上看吧:「https://web.archive.org/web/*/https://www.apache.org/dist/httpd/Announcement2.4.html」。

這樣兩個主流 web server 都支援 HTTP/2 了,接下來最主要的問題是 Android 對 HTTP/2 的支援度:「HTTP/2 protocol」,要等舊版逐漸淘汰掉...

測試 HTTPS 設定的 shell script

在「Using testssl.sh」這邊看到「testssl.sh」這個工具。

需要新版的 OpenSSL 會掃的比較完整,不過看起來 Ubuntu 14.04 內建的就可以掃不少東西了 (當然還是少了 ChaCha20+Poly1305)。

Qualys 的「SSL Server Test」只能掃有開放給公開使用的站台,而這個工具就可以拿來掃內部網站了。

拿官方給的 screenshot 來看結果:

Percona 正式推出相容於 MongoDB 的產品「Percona Server for MongoDB」

Percona 正式推出與 MongoDB 相容的產品 Percona Server for MongoDB:「Percona Delivers Free, Open Source Percona Server for MongoDB」。

挑重點講,其實最重要的是 data engine 多了 Percona 自家的 PerconaFT 以及 FacebookRocksDB

Percona Server for MongoDB offers all the features of MongoDB 3.0 Community Edition, along with two additional storage engine options – PerconaFT and Facebook’s RocksDB

PerconaFT 是基於被併購的 Tokutek 所研發的 TokuDB (Fractal tree index) 而誕生的產品,在效能上有相當的優勢...

如果有機會的話來研究看看吧 :o

用 sysbench 測試 MySQL 效能

很久前是用 tpcc-mysql 測試 MySQL 效能:「用 tpcc-mysql 測試 LSI 的 Nytro MegaRAID NMR 8100-4i」,最近剛好又有測試需求,想說拿來學個新玩具測試,就想到 sysbench 的 oltp 測試。

先用 Google 找了找測試的方式,appleboy 之前寫的「Sysbench 測試 Percona XtraDB Server 效能」算是還不錯的文件,就拿來當起點了。

我是拿 AWS 測試,主要是因為幾乎所有的效能都是固定的,這樣測出來才有意義。

Amazon EC2 用 c4.8xlarge,用 10Gbps 網路測試會比較準確一點。硬碟的部份是掛上 100GB 的 SSD 硬碟,如果是測 I/O bound 的人就選擇有固定 IOPS 的 Provisioned 版本,但我這次測的都是 CPU bound,就只選用 General 版本了。

跑起 Ubuntu 14.04 後直接用 apt-get install sysbench 就可以裝起來了。

Percona 的 apt repository 設定可以參考官方的「Installing Percona Server on Debian and Ubuntu」這篇文章。設好後要裝什麼版本測試就是自己的選擇了。

都裝好後,測試的方式是先用 prepare 塞資料,再用 run 測試。

這是 prepare 部份的指令:(粗體字的 x 需要帶入自己對應的參數)

sysbench --test=oltp --db-driver=mysql --mysql-engine-trx=yes --mysql-table-engine=innodb --mysql-host=x --mysql-user=x --mysql-password=x --oltp-auto-inc=off --test=/usr/share/doc/sysbench/tests/db/oltp.lua --oltp-table-size=10000000 prepare

這是 run 部份的指令,我這邊用了 --oltp-read-only=on 只測 read transaction 的速度:

sysbench --test=oltp --db-driver=mysql --mysql-engine-trx=yes --mysql-table-engine=innodb --mysql-host=x --mysql-user=x --mysql-password=x --oltp-auto-inc=off --test=/usr/share/doc/sysbench/tests/db/oltp.lua --oltp-table-size=10000000 --oltp-read-only=on --num-threads=256 --report-interval=5 --max-time=60 --max-requests=0 run

大致上就是這樣測,然後用 gnuplot 畫圖。

nginx 宣佈了 Early Alpha 版本的 HTTP/2 支援

nginx 宣佈了 Early Alpha 的 HTTP/2 支援:「Announcing an Early Alpha Patch for HTTP/2」。

除了警告這是早期版本不應該用在 production 上,另外也說明了目前的 patch 會讓 SPDY 失效:

Applying this patch removes the SPDY module from the NGINX codebase and replaces it with the HTTP/2 module. After applying this patch, you can no longer configure NGINX to use SPDY.

而在這之後也不會讓 HTTP/2 與 SPDY 同時並存:

This will also be the case for the production-ready release of the HTTP/2 implementation in both NGINX and NGINX Plus. SPDY is being deprecated by Google in early 2016, so there is no need to support both.

但從 HTTP/2 的支援度SPDY 的支援度來看,行動裝置都還不支援 HTTP/2,但 iOS 8.4 以及 Android 3+ 都已經支援 SPDY 了,這樣看起來非常的傷啊...

不知道到年底會有什麼其他解決方案出現...