2012-01-19 28 views
6

Tôi có syslog_rules.xml chuẩn (OSSEC 2.6.0). Đây là quy tắc tiêu chuẩn cho các từ xấu trong file /var/log/messages:OSSEC | Cách thêm quy tắc ngoại lệ

<var name="BAD_WORDS">core_dumped|failure|error|attack|bad |illegal |denied|refused|unauthorized|fatal|failed|Segmentation Fault|Corrupted</var> 
.....  
<rule id="1002" level="2"> 
<match>$BAD_WORDS</match> 
<options>alert_by_email</options> 
<description>Unknown problem somewhere in the system.</description> 
</rule> 
..... 

Làm thế nào tôi có thể thêm hoặc sửa đổi quy tắc này có sử dụng $BAD_WORDS, nhưng không bao gồm các cụm từ auxpropfunc error? Tức là, một cái gì đó như thế này:

<match>$BAD_WORDS</match> 
<match>!auxpropfunc error</match> 
<options>alert_by_email</options> 

Bất kỳ ý tưởng nào?

Trả lời

9

Tùy chọn tốt nhất của bạn có thể là viết quy tắc để bỏ qua cụm từ đó. Bạn có thể thêm một cái gì đó như sau để /var/ossec/rules/local_rules.xml:

<rule id="SOMETHING" level="0"> 
    <if_sid>1002</if_sid> 
    <match>auxpropfunc error</match> 
    <description>Ignore auxpropfunc error.</description> 
</rule> 

Sau đó, bạn có thể chạy toàn bộ thông điệp log qua OSSEC-logtest để xem cách OSSEC sẽ phân tích nó. Bạn có thể cần phải thêm một tùy chọn khác vào quy tắc này hoặc bạn có thể không.

5

Nếu bạn có nhiều hơn một từ, bạn có thể thêm một cái gì đó như sau để /var/ossec/rules/local_rules.xml

<var name="GOOD_WORDS">error_reporting|auxpropfunc error</var> 

<rule id="100002" level="0"> 
    <if_sid>1002</if_sid> 
    <match>$GOOD_WORDS</match> 
    <description>Ignore good_words.</description> 
</rule> 
Các vấn đề liên quan