OSX: Snort: ОШИБКА: /etc/snort/../rules/local.rules(0) Невозможно открыть файл правил "/etc/snort/../rules/local.rules": такого файла или каталога нет

13668
Drew

Я пытаюсь настроить и запустить Snort IDS на Mac с помощью своего рода учебника: https://discussions.apple.com/thread/3370709?start=0&tstart=0

OSX Yosemite (10.10.2); PostgreSQL 9.4.1 (установлен с Homebrew) Snort: стабильный 2.9.7.0 (установлен с Homebrew)

Когда я наконец пытаюсь сыграть это так:

$ sudo /usr/local/bin/snort -d -e -i en0 -c /etc/snort/snort.conf 

Получение этого:

Password:  Running in IDS mode  --== Initializing Snort ==-- Initializing Output Plugins! Initializing Preprocessors! Initializing Plug-ins! Parsing Rules file "/etc/snort/snort.conf" ... ERROR: /etc/snort/../rules/local.rules(0) Unable to open rules file "/etc/snort/../rules/local.rules": No such file or directory.  Fatal Error, Quitting.. 

Правило фактически на месте в /etc/snort/rules/local.rules

RULE_PATHустанавливается в /etc/snort/snort.confк/etc/snort/rules

Так:

$ echo $RULE_PATH /etc/snort/rules 

пробую это:

$ grep RULE_PATH /etc/snort/snort.conf  var RULE_PATH ../rules var SO_RULE_PATH ../so_rules var PREPROC_RULE_PATH ../preproc_rules ... 

Хорошо после смены

var RULE_PATH ../rules var SO_RULE_PATH ../so_rules var PREPROC_RULE_PATH ../preproc_rules 

в

var RULE_PATH /etc/snort/rules var SO_RULE_PATH /etc/snort/so_rules var PREPROC_RULE_PATH /etc/snort/preproc_rules 

Получение:

$ sudo /usr/local/bin/snort -d -e -i en0 -c /etc/snort/snort.conf Running in IDS mode  --== Initializing Snort ==-- Initializing Output Plugins! Initializing Preprocessors! Initializing Plug-ins! Parsing Rules file "/etc/snort/snort.conf" ... ERROR: /etc/snort/snort.conf(741) Unknown output plugin: "database" Fatal Error, Quitting.. 

Строка 741 в /etc/snort/snort.confэто:

output database: log, postgresql, user=snort password=password dbname=snort host=localhost

Так как прямой вывод базы данных snort 2.9.3.0 больше не поддерживается. Я должен использовать унифицированный вывод snort. Я мог бы использовать Barnyard2 вместо того, чтобы перенаправить на postgresql.

-2

2 ответа на вопрос

2
agtoever

Note: this answer is composed from a dialog in the comments of the original question.


The problem with the rule directory
From the error it's clear that somewhere (probably in snort.conf) there is a .., pointing to the wrong path. Based on the error, I'd say that var RULE_PATH ../rules is in the config file. You should change that either to var RULE_PATH ./rules or use an absolute path: var RULE_PATH /etc/snort/rules. You should do this for SO_RULE_PATH and PREPROC_RULE_PATH too. So your config now has:

var RULE_PATH /etc/snort/rules var SO_RULE_PATH /etc/snort/so_rules var PREPROC_RULE_PATH /etc/snort/preproc_rules 

The problem with outputting data to a database
Since snort 2.9.3.0, direct database output isn't supported anymore. You should use snort's unified output (like this" output unified2: filename merged.log, limit 128, mpls_event_types, vlan_event_types). You could use Barnyard2 instead to redirect to postgresql. Explaining how to set this up would go (in my opinion) too far for this answer. A basic start can be found here. A far more elaborate explanation (and specific targeted for OSX) can be found here.

0
matias figueroa

ОШИБКА: /etc/snort/../rules/local.rules(0) Невозможно открыть файл правил "/etc/snort/../rules/local.rules": такого файла или каталога нет.

Фатальная ошибка, выход ..

Я смог решить эту ошибку, комментируя следующие строки:

#var RULE_PATH ../rules #var SO_RULE_PATH ../so_rules #var PREPROC_RULE_PATH ../preproc_rules   #var WHITE_LIST_PATH ../rules #var BLACK_LIST_PATH ../rules 

Эти строки относятся к пользователю Windows!