kernel.org 將要關閉 FTP 服務

kernel.org 將關閉 FTP 服務:「Shutting down FTP services」。

三月將關閉 ftp://ftp.kernel.org/,而 12 月將關閉 ftp://mirrors.kernel.org/。現在透過 HTTP 更新已經是主流了,對於 firewall 設定與 cache 都有比較好的支援。

Cisco 與 Fortinet 防火牆的 RCE 漏洞

NSA 使用這些漏洞來大量監聽企業的流量:「Leaked Exploits are Legit and Belong to NSA: Cisco, Fortinet and Snowden Docs Confirm」。

Cisco 已經確認這個安全性漏洞了,全系列包括已經停產的 Cisco PIX、上個世代的 Cisco ASA 5500 (但還有些型號還在賣),以及目前主力的 Cisco ASA 5500-X,另外還包括了安全模組系列也中獎:「Cisco Adaptive Security Appliance SNMP Remote Code Execution Vulnerability」。

  • Cisco ASA 5500 Series Adaptive Security Appliances
  • Cisco ASA 5500-X Series Next-Generation Firewalls
  • Cisco ASA Services Module for Cisco Catalyst 6500 Series Switches and Cisco 7600 Series Routers
  • Cisco ASA 1000V Cloud Firewall
  • Cisco Adaptive Security Virtual Appliance (ASAv)
  • Cisco Firepower 4100 Series
  • Cisco Firepower 9300 ASA Security Module
  • Cisco Firepower Threat Defense Software
  • Cisco Firewall Services Module (FWSM)*
  • Cisco Industrial Security Appliance 3000
  • Cisco PIX Firewalls*

標星號的是目前已經沒有在維護的產品,這次只確認受到影響,但不會更新:

Cisco Firewall Service Modules and Cisco PIX Firewalls have passed the last day of software support milestone as stated in the published End of Life (EoL) documents. Further investigations into these devices will not be performed, and fixed software will not be made available.

這次 Cisco 的安全性問題是 SNMP 的洞造成的:

Administrators are advised to allow only trusted users to have SNMP access and to monitor affected systems using the snmp-server host command.

這個洞被 NSA 用來寫 exploit 植入系統:

This flaw was included inside two NSA exploits, dubbed EPICBANANA as well as JETPLOW, which is an enhanced version of EPICBANANA, but with better persistence capabilities, Cisco's Omar Santos said in a blog post.

在 NSA 洩漏出來的文件裡可以看到 ace02468bdf13579 這個特殊辨識字串,而在受感染的樣本上也找到了這個痕跡:

而且不只是 Cisco,其他幾家也中獎了,可以參考「The NSA Leak Is Real, Snowden Documents Confirm」這邊更多的資訊 @_@

DigitalOcean 提供 Floating IP 功能

DigitalOcean 推出的新功能,可以註冊 IP 並且動態掛到某個 droplet 上:「Floating IPs: Start Architecting Your Applications for High Availability」。

如果沒有掛到 droplet 上會收取 USD$0.006/hour 的費用,以一個月 720 小時來計算,大約是 USD$4.32/month。另外也限制在同一個 data center 內才能換來換去。

類似的功能在 Linode 很久前就有了 (2007 年底),雖然不是完全一樣:「Support for High Availability / IP Failover」,但 Amazon EC2 的 Elastic IP 功能幾乎就相同了,在 2008 年初開放:「New EC2 Features: Static IP Addresses, Availability Zones, and User Selectable Kernels」,所以只能算是補產品線,把大家都有的功能實作出來...

以往只能用 DNS 做 High Availability 的,現在可以用這種方法做,使得 downtime 可以更低。另外這樣做也可以架設 proxy server,使得對外的 IP 不變,讓 firewall 設定變得單純。

AWS WAF (Web Application Firewall)

Amazon 推出了 AWS WAF,也就是 Web Application Firewall:「New – AWS WAF」。

架構在 CloudFront 上的安全服務,可以想像到會依照 request 數量收費外,rule 本身也要收費,不太便宜的感覺:

AWS WAF is available today anywhere CloudFront is available. Pricing is $5 per web ACL, $1 per rule, and $0.60 per million HTTP requests.

這個收費標準看起來不像是會把 ModSecurity 預設的 rule 丟進去養... 不過 WAF 主要是用在對軟體主體沒有修改能力時的替代方案 (沒有 source code,或是線上服務緊急需要防堵),以這個角度來看的話好像還好?

另外一點也許可以找人問問看,WAF 不是設計在 ELB 上,算是策略考量嗎?

用 Intel 網卡上的 Flow Director 過濾封包

在「Traffic filtration using NIC capabilities on wire speed (10GE, 14Mpps)」這邊看到的技巧。

作者建議另外安裝 driver,因為 Linux kernel 內的 driver 功能有限:「Intel Ethernet Drivers and Utilities」。

重點在 ethtool 這個工具,可以看到條件設定:

ethtool --help:
        ethtool -N|-U|--config-nfc|--config-ntuple DEVNAME    Configure Rx network flow classification options or rules
        rx-flow-hash tcp4|udp4|ah4|esp4|sctp4|tcp6|udp6|ah6|esp6|sctp6 m|v|t|s|d|f|n|r... |
        flow-type ether|ip4|tcp4|udp4|sctp4|ah4|esp4
            [ src %x:%x:%x:%x:%x:%x [m %x:%x:%x:%x:%x:%x] ]
            [ dst %x:%x:%x:%x:%x:%x [m %x:%x:%x:%x:%x:%x] ]
            [ proto %d [m %x] ]
            [ src-ip %d.%d.%d.%d [m %d.%d.%d.%d] ]
            [ dst-ip %d.%d.%d.%d [m %d.%d.%d.%d] ]
            [ tos %d [m %x] ]
            [ l4proto %d [m %x] ]
            [ src-port %d [m %x] ]
            [ dst-port %d [m %x] ]
            [ spi %d [m %x] ]
            [ vlan-etype %x [m %x] ]
            [ vlan %x [m %x] ]
            [ user-def %x [m %x] ]
            [ action %d ]
            [ loc %d]] |
        delete %d

看起來 stateless 的過濾可以在上面做...

m0n0wall 的終結

m0n0wall 算是元老級的 firewall 套件,看到「End of the m0n0wall project」這個消息還是有點感慨啊...

有很多類似的 project 興起取代掉了 m0n0wall 的位置 (像是 pfSense),這讓我想到前陣子 esr 在「Defending GCC considered futile」提到 GCC 的沒落時講的話:

Obsolescence happens; this is nobody's fault. It will happen to clang/LLVM someday, too, but today is not that day.

用 Docker 測試 Mesos

照著「Deploy a Mesos Cluster with 7 Commands Using Docker」上面的方法做,遇到一些小狀況,解決後總算是搞定了。

文章作者的目的是利用 Docker 在不弄髒環境下讓人很容易上手測試,不需要處理一堆 Java 以及設定檔的問題。讓沒有用過的人可以感受一下 MesosMarathon 的界面與操作。

總共會跑起四個 docker instance,分別是 ZooKeeper、Mesos Master、Marathon、Mesos Slave Container。

我遇到的問題是我在 Ubuntu 上面的 UFW 設為 default deny,造成這四隻程式之間溝通不良,最後是針對 docker0 這個 interface 放行:

# ufw allow in on docker0

有些感覺之後就可以看官網看更進階的功能操作。

用 pfSense 架設 Firewall (以及 NAT)

pfSense 是一套很不錯的 firewall 以及 NAT 服務,上面還可以跑一切服務 (像是 OpenVPN 或是 Squid),不過後來都是用商用的硬體方案來處理...

看到「Build your own pro-grade firewall」這篇突然想到要查 pfSense 是否可以 High Availability,如果做的夠好的話,其實可以用兩台機器來跑,成本相對低很多。

結果查到這篇官方文件「Configuring pfSense Hardware Redundancy (CARP)」,裡面有幾個關鍵字,像是 XMLRPC Sync 似乎暗示了設定也可以同步?

官方文件裡的配置圖。

該測試看看了,兩台 server 也才十萬,但兩台能跑到 500Mbps+ 的硬體防火牆的價錢就貴多了... (不過比較省電?)

用 UFW 控制 iptables

之前都是自己設定 iptables,這次灌完家裡的系統後用 UFW 設定,對於基本的 firewall 功能來說相當簡單,但也夠用了:

sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw enable

如果有需要開某些 port 也可以設定,比起之前自己設 INPUT policy 方便...

Debian 重開機後維持 iptables 設定值的作法

標題所提到的問題在 lenny 以及更早的版本沒有標準解,一般 Google 到的解法是在 /etc/network/if-up.d/ 裡面放一個 script,當介面起來的時候會跑 iptables-restoreiptables 的規則倒回去,這是「會動」的方法,但我不喜歡這種 hacking...

剛剛找到 iptables-persistent,在 squeeze 以及 sid 都可以裝,雖然沒有文件,但看了一下程式很快就可以理解他的用法。

apt-get install iptables-persistent 安裝完畢之後,理論上就會把 script 裝好,並且把目錄建好,接下來只要跑 iptables-save > /etc/iptables/rules 就可以把目前的 iptables 設定倒進去。

這個方式看起來會是比較好的作法...