-
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
base: master
Are you sure you want to change the base?
Changes from 5 commits
bf0c989
8d6a66b
e5f636e
fc5939d
205b643
fbf75a8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2907,7 +2907,6 @@ Jul 26 13:57:56 mx1.example.org outbound/smtp: 127.0.0.1 1406297159-06f4a35b4df2 | |
| <order>srcip,url</order> | ||
| </decoder> | ||
|
|
||
|
|
||
| <!-- Exim | ||
| - Examples: | ||
| - 2017-01-23 03:44:14 dovecot_login authenticator failed for (hydra) [10.101.1.18]:35686: 535 Incorrect authentication data (set_id=user) | ||
|
|
@@ -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> | ||
|
|
||
|
|
||
| <!-- cPanel decoder. | ||
| - Examples: | ||
| - [2016-11-18 09:32:19 +0000] info [cpsrvd] 10.1.5.19 - admin "POST /login/?login_only=1 HTTP/1.1" FAILED LOGIN whostmgrd: user password hash is missing from system (user probably does not exist) | ||
| - [2016-04-18 13:07:02 +0400] info [cpsrvd] 10.1.5.19 - root - SUCCESS LOGIN whostmgrd | ||
| --> | ||
| <decoder name="cpanel-login"> | ||
| <prematch>^[\S+ \S+ \S+] info [cpsrvd] \S+ -</prematch> | ||
| <regex>info [cpsrvd] (\S+) - (\S+)</regex> | ||
| <order>srcip,user</order> | ||
| </decoder> | ||
|
|
||
| <!-- cPanel decoder. | ||
| Because of default postgresql decoder overwrites cpanel-login-log rule in case time offset with minus (-0500). This rule is necessary to cover all cases of logs | ||
| - Examples: | ||
| - [2016-11-21 04:14:58 -0500] info [cpsrvd] 10.1.5.19 - admin "POST /login/?login_only=1 HTTP/1.1" FAILED LOGIN whostmgrd: user password hash is missing from system (user probably does not exist) | ||
| - [2017-01-25 03:16:27 -0500] info [cpsrvd] 10.1.5.19 - root "POST /login/?login_only=1 HTTP/1.1" FAILED LOGIN whostmgrd: user password incorrect | ||
| - [2017-01-25 05:37:47 -0500] info [cpsrvd] 10.1.5.19 - root "POST /login/?login_only=1 HTTP/1.1" FAILED LOGIN cpaneld: root login is not permitted to cpaneld | ||
| - [2017-01-25 06:01:10 -0500] info [cpsrvd] 10.1.5.19 - test "POST /login/?login_only=1 HTTP/1.1" FAILED LOGIN cpaneld: invalid cpanel user test (loadcpdata failed) | ||
| - [2017-01-25 06:08:58 -0500] info [cpsrvd] 10.1.5.19 - test@domain.com "POST /login/?login_only=1 HTTP/1.1" FAILED LOGIN whostmgrd: login attempt to whm by a non-reseller/root | ||
| - [2016-04-18 13:07:02 -0400] info [cpsrvd] 10.1.5.19 - root - SUCCESS LOGIN whostmgrd | ||
| - [2016-04-18 13:07:13 -0400] info [cpsrvd] 10.1.5.19 - root - SUCCESS LOGIN cpaneld | ||
| - [2016-04-18 13:07:15 -0400] info [cpsrvd] 10.1.5.19 - reseller (possessor: root) - SUCCESS LOGIN cpaneld | ||
| - [2016-04-18 13:08:24 -0400] info [cpsrvd] 10.1.5.19 - reseller - SUCCESS LOGIN webmaild | ||
| - [2016-04-18 13:08:27 -0400] info [cpsrvd] 10.1.5.19 - emailaccount@reseller.com (possessor: reseller) - SUCCESS LOGIN webmaild | ||
| --> | ||
|
|
||
| <decoder name="cpanel-login2"> | ||
| <parent>postgresql_log</parent> | ||
| <prematch offset="after_parent">^info [cpsrvd] \S+ -</prematch> | ||
| <regex>info [cpsrvd] (\S+) - (\S+)</regex> | ||
| <order>srcip,user</order> | ||
| </decoder> | ||
|
|
||
| <!-- cPanel decoder. | ||
| - Examples: | ||
| - 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"> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's wrong with the postgresql_log decoder exactly?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: |
||
| <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> | ||
|
|
||
| <!-- cPanel decoder. | ||
| - Examples: | ||
| - [2017-01-25 06:15:38 -0500] info [cpsrvd] 10.1.5.19 PURGE root:Nmm4xzhSpA2Sddv3 logout | ||
| - [2017-01-25 06:15:38 +0000] info [cpsrvd] 10.1.5.19 PURGE root:Nmm4xzhSpA2Sddv3 logout | ||
| --> | ||
| <decoder name="cpanel-session"> | ||
| <prematch>^[\S+ \S+ \S+] info [cpsrvd] \S+ PURGE</prematch> | ||
| <regex>info [cpsrvd] (\S+) \S+ (\w+):</regex> | ||
| <order>srcip,user</order> | ||
| </decoder> | ||
|
|
||
| <decoder name="cpanel-session2"> | ||
| <parent>postgresql_log</parent> | ||
| <prematch offset="after_parent">^info [cpsrvd] \S+ PURGE</prematch> | ||
| <regex>info [cpsrvd] (\S+) \S+ (\w+):</regex> | ||
| <order>srcip,user</order> | ||
| </decoder> | ||
|
|
||
| <!-- EOF --> | ||
| 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>cpanel-access-failed</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 --> |
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.
You lost the
</decoder>from the exim decoder here.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.
Oops, fixed.