
最近、いくつかのセキュリティ上の問題があり、私のコードが安全であるかどうかは完全にはわかりませんでした。
これを行うためのツールはありますか?
答え1
Linux監査システムがあり、デフォルトでDebianにインストールされているかどうかはわかりませんが、次の方法でインストールできます。
$ sudo apt-get install auditd audispd-plugins
ここで構成する必要があり、構成ファイルはであり、/etc/audit/audit.rules
目的に適した規則は次のとおりです。
# Delete all previous rules
-D
# Set buffer size
-b 8192
# Make the configuration immutable -- reboot is required to change audit rules
-e 2
# Panic when a failure occurs
-f 2
# Generate at most 100 audit messages per second
-r 100
# -w: Watch a file or directory
# -p: Parameters to watch in this case are [w]rite and [a]ttributes,
# you can also add [r]ead and e[x]ecute but I think those
# are not needed in your case
# -k: An optional friendly name to facilitate searching the logs
-w /path/to/your/repo -p wa -k name_for_easy_searching
監査設定が準備されました。 auditdデーモンを再起動して新しいルールをロードし、実際にロードされていることを確認してくださいauditctl -l
。
これでリポジトリがカーネルレベルで監視されるため、すべての変更が記録されます。
ausearch -k name_for_easy_searching
リポジトリに対するすべての変更のリストを取得するために使用されます。
ここでは、ログを解析し、ユーザーが変更した内容を無視し、電子メールを送信し、クローンタスクを設定して定期的に確認する方法を学びます。
頑張ってください。
答え2
別のオプションは、AIDE(高度な侵入検知環境)です。無料で、サンプル設定ファイルのいずれかを使用して簡単に起動できます。