-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add cpanel decoders and rules. #1036
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alex-front
wants to merge
6
commits into
ossec:master
Choose a base branch
from
alex-front:cpanel
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bf0c989
Add cpanel decoders and rules.
8d6a66b
Fix broken cpanel-access-failed decoder failing tests
e5f636e
Merge branch 'master' into cpanel
alex-front fc5939d
Add support for cpanel rules to other setup types: agent, local, hybrid.
205b643
Merge branch 'cpanel' of github.com:alex-front/ossec-hids into cpanel
fbf75a8
Fix cpanel rules and decoders.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| <!-- Authors: Alexandr Garaga, Paul Klymenko | ||
| - | ||
| - This program is a free software; you can redistribute it | ||
| - and/or modify it under the terms of the GNU General Public | ||
| - License (version 2) as published by the FSF - Free Software | ||
| - Foundation. | ||
| - | ||
| - License details: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html | ||
| --> | ||
|
|
||
| <!-- cPanel messages --> | ||
| <group name="syslog,"> | ||
|
|
||
| <!-- Two same rules but with different decoders because logs have different format --> | ||
| <rule id="11000" level="5"> | ||
| <if_sid>2501</if_sid> | ||
| <decoded_as>cpanel-login</decoded_as> | ||
| <regex>FAILED LOGIN</regex> | ||
| <description>Possible attack on the cpanel services</description> | ||
| </rule> | ||
|
|
||
| <rule id="11001" level="5"> | ||
| <if_sid>50500</if_sid> | ||
| <decoded_as>postgresql_log</decoded_as> | ||
| <regex>FAILED LOGIN</regex> | ||
| <description>Possible attack on the cpanel services</description> | ||
| </rule> | ||
|
|
||
| <rule id="11002" level="5"> | ||
| <if_sid>2501</if_sid> | ||
| <decoded_as>web-accesslog</decoded_as> | ||
| <regex>FAILED LOGIN</regex> | ||
| <description>Possible attack on the cpanel services</description> | ||
| </rule> | ||
|
|
||
| <!-- We raise level to send alert considering frequency (6 see doc why) and timeframe (6 minutes) --> | ||
| <rule id="11003" level="10" frequency="4" timeframe="360"> | ||
| <if_matched_sid>11001</if_matched_sid> | ||
| <description>Possible breakin attempt</description> | ||
| </rule> | ||
|
|
||
| <rule id="11004" level="10" frequency="4" timeframe="360"> | ||
| <if_matched_sid>11000</if_matched_sid> | ||
| <description>Possible breakin attempt</description> | ||
| </rule> | ||
|
|
||
| <rule id="11005" level="10" frequency="4" timeframe="360"> | ||
| <if_matched_sid>11002</if_matched_sid> | ||
| <description>Possible breakin attempt</description> | ||
| </rule> | ||
|
|
||
| <rule id="11006" level="3"> | ||
| <decoded_as>cpanel-login</decoded_as> | ||
| <match>SUCCESS LOGIN</match> | ||
| <description>Cpanel login success</description> | ||
| </rule> | ||
|
|
||
| <rule id="11007" level="3"> | ||
| <if_sid>50500</if_sid> | ||
| <decoded_as>postgresql_log</decoded_as> | ||
| <match>SUCCESS LOGIN</match> | ||
| <description>Cpanel login success</description> | ||
| </rule> | ||
|
|
||
| <rule id="11008" level="3"> | ||
| <decoded_as>cpanel-session</decoded_as> | ||
| <match>PURGE</match> | ||
| <description>Cpanel session purge</description> | ||
| </rule> | ||
|
|
||
| <rule id="11009" level="3"> | ||
| <if_sid>50500</if_sid> | ||
| <decoded_as>postgresql_log</decoded_as> | ||
| <match>PURGE</match> | ||
| <description>Cpanel session purge</description> | ||
| </rule> | ||
|
|
||
| </group> <!-- SYSLOG --> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this decoder is causing the failures, but I'm not sure why yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The log message associated with this didn't seem to match a decoder (at least on my setup), so using this decoder things seem to work so far:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested your proposed decoder and I am confirming it is working as expected and CI tests are passing. I have added the fix to pull request. Please merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the postgresql_log log decoder should be fixed to avoid clashes with and duplication of the cpanel decoders and rules like I proposed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's wrong with the postgresql_log decoder exactly?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem with postgresql_log decoder is that it will decode messages like:
'[2017-02-03 01:21:31 -0500]' and not like '[2017-02-03 01:21:31 +0500]' (note the '+' sign). So to handle both cases I had to duplicate all rules and decoders for cpanel. One way to avoid this is to fix the postgresql_log decoder to be more specific to avoid it clashing with cpanel decoders altogether but I don't have much knowledge of their log format so can't propose how to do it.