Skip to content
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

Add cpanel decoders and rules. #1036

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

alex-front
Copy link

@alex-front alex-front commented Jan 27, 2017

This change is Reviewable

etc/decoder.xml Outdated
- 10.1.5.19 - paul [11/18/2016:09:35:43 -0000] "GET" FAILED LOGIN cpdavd: Could not fetch system home directory for paul
-->

<decoder name="cpanel-access-failed">
Copy link
Member

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.

Copy link
Member

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:

<decoder name="cpanel-access-failed">
  <!--<parent>web-accesslog</parent>
  <prematch offset="after_parent">^FAILED LOGIN</prematch>-->
  <prematch>^\S+ \S+ \S+ [\d\d/\d\d/\d\d\d\d:\d\d:\d\d:\d\d \S*\d+] "\S+" FAILED LOGIN</prematch>-->
  <regex>^(\S+) \S+ (\S+)</regex>
  <order>srcip,user</order>
</decoder>

Copy link
Author

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.

Copy link
Author

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.

Copy link
Member

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?

Copy link
Author

@alex-front alex-front Feb 3, 2017

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.

etc/decoder.xml Outdated
@@ -2943,6 +2942,68 @@ Jul 26 13:57:56 mx1.example.org outbound/smtp: 127.0.0.1 1406297159-06f4a35b4df2
<prematch offset="after_parent">^SMTP call from </prematch>
<regex offset="after_prematch">[(\S+)]:\d+ dropped: too many syntax or protocol errors</regex>
<order>srcip</order>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You lost the </decoder> from the exim decoder here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, fixed.

@atomicturtle
Copy link
Member

We should also capture these as tests in ossec-testing so we dont end up with collisions on other rules. As I recall cpanel environments frequently use windows timestamp format for example, I know that would overlap with the windows decoder

@ddpbsd
Copy link
Member

ddpbsd commented Feb 2, 2017

I want to hold off on these until PRs #1011 #1042 #1037 #1045 get merged. Those are a lot simpler, I think. then when that churn is done I will devote more time to this PR.

This fix should detect successful logins from cpanel session_log instead of login_log and thus work on older versions of cpanel. In addition, the logout decoders and rules are made more specific since there are other 'PURGE' events in cpanel session_log with a different format and semantics than logout events.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants