| |
| |
| |
| |
|
|
|
|
| class message(object): |
| def __init__(self): |
| '''register our criteria for being passed a message |
| as a list of lower case strings or values to match with an event's dictionary of keys or values |
| set the priority if you have a preference for order of plugins to run. 0 goes first, 100 is assumed/default if not sent |
| ''' |
| |
| self.registration = ['auditd', 'audisp-json'] |
| self.priority = 2 |
|
|
| def onMessage(self, message, metadata): |
| |
| |
|
|
| |
| if ('details' in message and |
| 'parentprocess' in message['details'] and |
| message['details']['parentprocess'] == 'gmond' and |
| 'duser' in message['details'] and |
| message['details']['duser'] == 'nobody' and |
| 'command' in message['details'] and |
| message['details']['command'] == '/bin/sh -c netstat -t -a -n'): |
| return(None, metadata) |
|
|
| |
| if ( |
| ('details' in message and |
| 'parentprocess' in message['details'] and |
| message['details']['parentprocess'] == 'beam.smp' and |
| 'duser' in message['details'] and |
| message['details']['duser'] == 'rabbitmq' and |
| 'command' in message['details'] |
| ) and |
| ( |
| message['details']['command'] == '/usr/lib64/erlang/erts-5.8.5/bin/epmd -daemon' or |
| message['details']['command'].startswith('inet_gethost 4') or |
| message['details']['command'].startswith('sh -c exec inet_gethost 4') or |
| message['details']['command'].startswith('/bin/sh -s unix:cmd') or |
| message['details']['command'].startswith('sh -c exec /bin/sh -s unix:cmd'))): |
| return(None, metadata) |
|
|
| |
| if ('details' in message and |
| 'parentprocess' in message['details'] and |
| message['details']['parentprocess'] == 'sshd' and |
| 'duser' in message['details'] and |
| message['details']['duser'] == 'root' and |
| 'command' in message['details'] and |
| message['details']['command'] == '/usr/sbin/sshd -R'): |
| return(None, metadata) |
|
|
| |
| if ( |
| ('details' in message and |
| 'parentprocess' in message['details'] and |
| message['details']['parentprocess'] == 'chkconfig' and |
| 'suser' in message['details'] and |
| message['details']['suser'] == 'root' and |
| 'command' in message['details'] |
| ) and |
| ( |
| message['details']['command'].startswith('/sbin/runlevel') or |
| message['details']['command'].startswith('sh -c /sbin/runlevel'))): |
| return(None, metadata) |
|
|
| |
| if ( |
| ('details' in message and |
| 'duser' in message['details'] and |
| message['details']['duser'] == 'nagios' and |
| 'suser' in message['details'] and |
| message['details']['suser'] == 'root' and |
| 'command' in message['details'] |
| ) and |
| ( |
| message['details']['command'].startswith('/usr/lib64/nagios/plugins') or |
| message['details']['command'].startswith('sh -c /usr/lib64/nagios/plugins'))): |
| return(None, metadata) |
|
|
| |
| if 'details' in message and isinstance(message['details'], dict): |
| if 'auid' in message['details'] and message['details']['auid'] == "4294967295": |
| message['details']['auid'] = '-1' |
| if 'ses' in message['details'] and message['details']['ses'] == "4294967295": |
| message['details']['ses'] = '-1' |
| |
| for k, v in message['details'].items(): |
| if v == '(null)' and 'id' in k: |
| message['details'][k] = -1 |
|
|
| |
| if 'details' in message and isinstance(message['details'], dict): |
| if 'gid' in message['details'] and ',' in message['details']['gid']: |
| |
| |
| |
| message['details']['gidstring'] = message['details']['gid'] |
| del message['details']['gid'] |
|
|
| |
| if 'details' in message and isinstance(message['details'], dict): |
| if 'dhost' in message['details']: |
| |
| message['hostname'] = message['details']['dhost'] |
| del message['details']['dhost'] |
|
|
| |
| if 'category' not in message: |
| message['category'] = 'auditd' |
| |
| message['type'] = 'auditd' |
|
|
| return (message, metadata) |
|
|