Midnight Monologues

日々勉強したことを書いてきます

既知スキャナーのフィルタ (Blackholeの有効化)

概要

T-Potへの既知スキャンをフィルタしたい

  • T-Potには既知スキャナーのmasscanによるアクセスを防ぐ仕組みとしてBlackholeという機能がある
  • 公開されているスキャナーのIPアドレス※1をblacklistへ登録し、masscanによるアクセスをフィルタする
  • フィルタ対象IPは研究機関やshodan、censysなどのサイトが含まれる

※1 masscanスキャナーのIP一覧 https://raw.githubusercontent.com/stamparm/maltrail/master/trails/static/mass_scanner.txt

詳細

Blackhole の有効化

以下の内容を参考に、Blackhole を有効化する

github.com

  • 実行対象のファイルは /opt/tpot/bin/blackhole.sh を利用する
  • blackhole.sh add を実行して有効化する ( 無効化する場合は blackhole.sh del を実施する)
  • コマンドを実行すると/etc/blackhole/mass_scanner.txt にblacklist対象のリストがダウンロードされ、SuricataのIPsに適用される(2023年2月時点で7461件ある)
cd /opt/tpot/bin
./blackhole.sh add

### Downloading mass_scanner.txt list.

NOTICE  Downloading 1 item(s)
NOTICE  Download complete: /etc/blackhole/mass_scanner.txt

Download Results:
gid | stat | avg speed | path/URI
======+====+===========+=======================================================
***** | OK | 367KiB/s | /etc/blackhole/mass_scanner.txt

Status Legend:
(OK):download completed.

Now adding 7461 IPs to blackhole...................................................................
Added 7461 IPs to blackhole.

### Remember!
### As long as <blackhole.sh del> is not executed the routes will be re-added on T-Pot start through </opt/tpot/bin/updateip.sh>.
### Check with <ip r> or <dps.sh> if blackhole is enabled.



  • 実行後は ip rdps.sh を実施することでblackhole が有効化されていることを確認する
  • blackhole.sh del を実行しない限り、T-Pot起動時に/opt/tpot/bin/updateip.shにより永久的に有効化される
  • t-potのログイン画面でもblackhole が有効化されていることがわかる