ModSecurity をインストールした Nginx を再起動するタイミングで下記のようなクエリが出ることに気づいた。
# tcpdump -nn -i eth0 port 53
19:59:38.900056 IP 192.168.37.10.48175 > 204.13.200.240.53: 14893 A? GIXDQLRQFRGW6ZCTMVRXK4TJOR4SAU3U.MFXGIYLMN5XGKLBRFYZS4OJPGEXDGLRZ.FQ3S4OBPG4XDQIBSGAYDQLJQHEWTANJM.FBXHK3DMFEWDELRXFY3CYMDEHE3TCY3G.HE4WINTFHBTDENJUGRTDKNDFMU3GCMTG.GU3TCMTCGE2DAM3EMI2GG.1405076378.status.modsecurity.org. (238)
19:59:39.079151 IP 204.13.200.240.53 > 192.168.37.10.48175: 14893*- 1/1/1 A 204.13.200.240 (388)
すごく目立つので気になって調査
$ grep -r status.modsecurity.org *
apache2/msc_status_engine.h:#define STATUS_ENGINE_DNS_SUFFIX "status.modsecurity.org"
$ grep -r STATUS_ENGINE_DNS_SUFFIX *
apache2/msc_status_engine.c: length = str_enc_spl_len + strlen(STATUS_ENGINE_DNS_SUFFIX) +
apache2/msc_status_engine.c: (long) ltime, STATUS_ENGINE_DNS_SUFFIX);
apache2/msc_status_engine.c: "information visit: http://%s/", STATUS_ENGINE_DNS_SUFFIX);
apache2/msc_status_engine.h:#define STATUS_ENGINE_DNS_SUFFIX "status.modsecurity.org"
apache2/msc_status_engine.c
int DSOLOCAL msc_status_engine_prepare_hostname (char *hostname, const char *plain_data,
int max_length)
{
/* 投稿者による省略 */
apr_snprintf(hostname, max_length, "%s.%ld.%s", hostname,
(long) ltime, STATUS_ENGINE_DNS_SUFFIX);
failed_enc_spl:
free(tmp);
failed_strdup:
return_length:
failed_enc_spl_len:
return length;
}
int msc_status_engine_call (void) {
/* 投稿者による省略 */
hostname_len = msc_status_engine_prepare_hostname(hostname, beacon_str,
hostname_len);
if (hostname_len < 0) {
goto failed_hostname;
}
/* Perform the DNS query. */
if (gethostbyname(hostname)) {
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL,
"ModSecurity: StatusEngine call successfully sent. For more " \
"information visit: http://%s/", STATUS_ENGINE_DNS_SUFFIX);
} else {
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL,
"ModSecurity: StatusEngine call failed. Query: %s",
hostname);
}
ret = 0;
failed_hostname:
free(hostname);
failed_hostname_malloc:
failed_hostname_len:
free(beacon_str);
failed_beacon_string_malloc:
return ret;
}
2.8.0 から追加されたようだ。
ホスト名とMACアドレスをベースに生成したクエリを投げるらしい。
https://github.com/SpiderLabs/ModSecurity/commit/0c6a661c696e0cb248cf79e32a20aaccb95c3926
パッと見で怪しくて嫌なので止めたい。
$ grep -r msc_status_engine_call *
apache2/mod_security2.c: msc_status_engine_call();
apache2/msc_status_engine.c:int msc_status_engine_call (void) {
apache2/msc_status_engine.h:int msc_status_engine_call(void);
standalone/api.c: msc_status_engine_call();
apache2/mod_security2.c
if (status_engine_state != STATUS_ENGINE_DISABLED) {
msc_status_engine_call();
}
else {
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL,
"Status engine is currently disabled, enable it by set " \
"SecStatusEngine to On.");
}
SecStatusEngine On
で有効になるらしい。デフォルトでは無効?
https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#SecStatusEngine
という訳で、SecStatusEngine Off
を設定して解決。
modsecurity.conf-recommended をそのままコピーして使ってるせいで理解できていないな。