bc.googleusercontent.comのブロック対応について

久々に猛烈なサーバアラートが来たので調査。

犯人はこちらでした

*.bc.googleusercontent.com

というサブドメイン。一見グーグルっぽいですが、一切関係ないと思ってください

ここからのアタックを食らうと、サーバリソースが枯渇します。

主にCPU、LA、受信トラフィックあたりに強烈な影響が出るので、とりあえずブロックかけました。

以下、3パターンを記載。

■htaccessパターン
—————
order allow,deny
allow from all
deny from *.bc.googleusercontent.com
—————

■httpd.conf記述パターン
—————
<Location />
order allow,deny
allow from all
deny from *.bc.googleusercontent.com
</Location>
—————

■nginxパターン(ここはIP帯でブロック。とりあえず出てきたやつだけ)
—————
location ~ ^/ {
deny 35.221.0.0/16;
deny 35.236.0.0/16;
deny 34.78.0.0/16;
deny 35.210.0.0/16;
deny 34.71.0.0/16;
deny 35.200.0.0/16;
deny 35.190.0.0/16;
deny 34.97.0.0/16;
}
—————

■iptablesパターン(以下は例。ご自身の設定に合わせてください)

—————
-A INPUT -s 35.236.0.0/16 -j DROP
-A INPUT -s 34.78.0.0/16 -j DROP
-A INPUT -s 35.210.0.0/16 -j DROP
-A INPUT -s 34.71.0.0/16 -j DROP
-A INPUT -s 35.200.0.0/16 -j DROP
-A INPUT -s 35.190.0.0/16 -j DROP
-A INPUT -s 34.97.0.0/16 -j DROP
—————

■netstatでのIPリスト出力コマンドは下記
netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n

かなり豪快なやつでしたが、10分で対応完了。怖かったw

コメント

タイトルとURLをコピーしました