- 
                Notifications
    You must be signed in to change notification settings 
- Fork 9
Add auditd logging to platform for intrusion detection #314
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
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            8 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      6dd766b
              
                WIP add auditd to monitoring package
              
              
                rcrichton 145f1ab
              
                Merge remote-tracking branch 'origin/main' into auditd-logging
              
              
                rcrichton 443df2f
              
                Improve audit dashboard, add ability to filter by node
              
              
                rcrichton a0e6849
              
                Merge remote-tracking branch 'origin/main' into auditd-logging
              
              
                rcrichton 5cdaae0
              
                Fix audit dashboard to display data from multiple nodes
              
              
                rcrichton 2bbc9bd
              
                Fix deprecated ansible functions
              
              
                rcrichton 18042fe
              
                Merge branch 'main' into auditd-logging
              
              
                rcrichton 4d63774
              
                Update ansible readme with important missing details
              
              
                rcrichton 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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -4,3 +4,4 @@ | |
| - common | ||
| - docker | ||
| - ufw | ||
| - auditd | ||
  
    
      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,22 @@ | ||
| --- | ||
| - name: "install auditd" | ||
| apt: | ||
| name: auditd | ||
| state: latest | ||
|  | ||
| - name: "fetch best practice Auditd config" | ||
| get_url: | ||
| url: https://raw.githubusercontent.com/Neo23x0/auditd/master/audit.rules | ||
| dest: /etc/audit/rules.d/audit.rules | ||
|  | ||
| - name: Ensure name_format is set to HOSTNAME | ||
| lineinfile: | ||
| path: /etc/audit/auditd.conf | ||
| regexp: '^name_format\s*=' | ||
| line: "name_format = HOSTNAME" | ||
| state: present | ||
|  | ||
| - name: "restart auditd service" | ||
| ansible.builtin.service: | ||
| name: auditd | ||
| state: restarted | ||
  
    
      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 | 
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| --- | ||
| - include: reload_ufw.yml | ||
| - include: reload_docker.yml | ||
| - include: restart_docker.yml | ||
| - import_tasks: reload_ufw.yml | ||
| - import_tasks: reload_docker.yml | ||
| - import_tasks: restart_docker.yml | 
  
    
      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,277 @@ | ||
| { | ||
| "annotations": { | ||
| "list": [ | ||
| { | ||
| "builtIn": 1, | ||
| "datasource": { | ||
| "type": "grafana", | ||
| "uid": "-- Grafana --" | ||
| }, | ||
| "enable": true, | ||
| "hide": true, | ||
| "iconColor": "rgba(0, 211, 255, 1)", | ||
| "name": "Annotations & Alerts", | ||
| "target": { | ||
| "limit": 100, | ||
| "matchAny": false, | ||
| "tags": [], | ||
| "type": "dashboard" | ||
| }, | ||
| "type": "dashboard" | ||
| } | ||
| ] | ||
| }, | ||
| "editable": true, | ||
| "fiscalYearStartMonth": 0, | ||
| "graphTooltip": 0, | ||
| "links": [], | ||
| "liveNow": false, | ||
| "panels": [ | ||
| { | ||
| "datasource": { | ||
| "type": "datasource", | ||
| "uid": "grafana" | ||
| }, | ||
| "gridPos": { | ||
| "h": 4, | ||
| "w": 24, | ||
| "x": 0, | ||
| "y": 0 | ||
| }, | ||
| "id": 6, | ||
| "options": { | ||
| "code": { | ||
| "language": "plaintext", | ||
| "showLineNumbers": false, | ||
| "showMiniMap": false | ||
| }, | ||
| "content": "# Notes\n\n* Some `proctitles` are hex encoded due to the posibility of special chars. Use a hex to ascii decoder to view these.\n* Multiple lines might refer to the same event, in that case the audit identifier (i.e. `msg=audit(...:...)`) will be the same. Use the find input to easily see all line for an event by searching for this audit identifier.", | ||
| "mode": "markdown" | ||
| }, | ||
| "pluginVersion": "9.2.3", | ||
| "title": "Notes", | ||
| "type": "text" | ||
| }, | ||
| { | ||
| "datasource": { | ||
| "type": "loki", | ||
| "uid": "P00201832B18B88C3" | ||
| }, | ||
| "fieldConfig": { | ||
| "defaults": { | ||
| "custom": { | ||
| "hideFrom": { | ||
| "legend": false, | ||
| "tooltip": false, | ||
| "viz": false | ||
| }, | ||
| "scaleDistribution": { | ||
| "type": "linear" | ||
| } | ||
| } | ||
| }, | ||
| "overrides": [] | ||
| }, | ||
| "gridPos": { | ||
| "h": 6, | ||
| "w": 24, | ||
| "x": 0, | ||
| "y": 4 | ||
| }, | ||
| "id": 3, | ||
| "options": { | ||
| "calculate": false, | ||
| "cellGap": 1, | ||
| "color": { | ||
| "exponent": 0.5, | ||
| "fill": "dark-orange", | ||
| "mode": "scheme", | ||
| "reverse": true, | ||
| "scale": "exponential", | ||
| "scheme": "Oranges", | ||
| "steps": 64 | ||
| }, | ||
| "exemplars": { | ||
| "color": "rgba(255,0,255,0.7)" | ||
| }, | ||
| "filterValues": { | ||
| "le": 1e-9 | ||
| }, | ||
| "legend": { | ||
| "show": true | ||
| }, | ||
| "rowsFrame": { | ||
| "layout": "auto" | ||
| }, | ||
| "tooltip": { | ||
| "show": true, | ||
| "yHistogram": false | ||
| }, | ||
| "yAxis": { | ||
| "axisPlacement": "left", | ||
| "reverse": false | ||
| } | ||
| }, | ||
| "pluginVersion": "9.2.3", | ||
| "targets": [ | ||
| { | ||
| "datasource": { | ||
| "type": "loki", | ||
| "uid": "P00201832B18B88C3" | ||
| }, | ||
| "editorMode": "builder", | ||
| "expr": "sum(count_over_time({label=~\"T1219.*|recon|.*susp.*\", node=~\"$node\"} |= `$query` [$__interval]))", | ||
| "queryType": "range", | ||
| "refId": "A" | ||
| } | ||
| ], | ||
| "title": "Suspicious activity", | ||
| "type": "heatmap" | ||
| }, | ||
| { | ||
| "datasource": { | ||
| "type": "loki", | ||
| "uid": "P00201832B18B88C3" | ||
| }, | ||
| "description": "Filter for security auditlogs that that are potentially suspicious.", | ||
| "gridPos": { | ||
| "h": 17, | ||
| "w": 24, | ||
| "x": 0, | ||
| "y": 10 | ||
| }, | ||
| "id": 1, | ||
| "options": { | ||
| "dedupStrategy": "none", | ||
| "enableLogDetails": true, | ||
| "prettifyLogMessage": false, | ||
| "showCommonLabels": false, | ||
| "showLabels": false, | ||
| "showTime": true, | ||
| "sortOrder": "Descending", | ||
| "wrapLogMessage": true | ||
| }, | ||
| "targets": [ | ||
| { | ||
| "datasource": { | ||
| "type": "loki", | ||
| "uid": "P00201832B18B88C3" | ||
| }, | ||
| "editorMode": "builder", | ||
| "expr": "{job=\"auditlogs\", label=~\"T1219.*|recon|.*susp.*\", node=~\"$node\"} |= `$query`", | ||
| "key": "Q-9181c263-cf75-42fe-bf50-036eeff7207a-0", | ||
| "queryType": "range", | ||
| "refId": "A" | ||
| } | ||
| ], | ||
| "title": "Suspicious activity", | ||
| "type": "logs" | ||
| }, | ||
| { | ||
| "datasource": { | ||
| "type": "loki", | ||
| "uid": "P00201832B18B88C3" | ||
| }, | ||
| "description": "All captured logs from auditd", | ||
| "gridPos": { | ||
| "h": 17, | ||
| "w": 24, | ||
| "x": 0, | ||
| "y": 27 | ||
| }, | ||
| "id": 4, | ||
| "options": { | ||
| "dedupStrategy": "none", | ||
| "enableLogDetails": true, | ||
| "prettifyLogMessage": false, | ||
| "showCommonLabels": false, | ||
| "showLabels": false, | ||
| "showTime": true, | ||
| "sortOrder": "Descending", | ||
| "wrapLogMessage": true | ||
| }, | ||
| "targets": [ | ||
| { | ||
| "datasource": { | ||
| "type": "loki", | ||
| "uid": "P00201832B18B88C3" | ||
| }, | ||
| "editorMode": "builder", | ||
| "expr": "{job=\"auditlogs\", node=~\"$node\"} |= `$query`", | ||
| "key": "Q-9181c263-cf75-42fe-bf50-036eeff7207a-0", | ||
| "queryType": "range", | ||
| "refId": "A" | ||
| } | ||
| ], | ||
| "title": "All audit logs", | ||
| "type": "logs" | ||
| } | ||
| ], | ||
| "refresh": false, | ||
| "schemaVersion": 37, | ||
| "style": "dark", | ||
| "tags": [], | ||
| "templating": { | ||
| "list": [ | ||
| { | ||
| "current": { | ||
| "selected": false, | ||
| "text": "", | ||
| "value": "" | ||
| }, | ||
| "hide": 0, | ||
| "label": "Find", | ||
| "name": "query", | ||
| "options": [ | ||
| { | ||
| "selected": true, | ||
| "text": "", | ||
| "value": "" | ||
| } | ||
| ], | ||
| "query": "", | ||
| "skipUrlSync": false, | ||
| "type": "textbox" | ||
| }, | ||
| { | ||
| "current": { | ||
| "selected": true, | ||
| "text": ["All"], | ||
| "value": ["$__all"] | ||
| }, | ||
| "datasource": { | ||
| "type": "loki", | ||
| "uid": "P00201832B18B88C3" | ||
| }, | ||
| "definition": "", | ||
| "hide": 0, | ||
| "includeAll": true, | ||
| "label": "Hostname", | ||
| "multi": true, | ||
| "name": "node", | ||
| "options": [], | ||
| "query": { | ||
| "label": "node", | ||
| "refId": "LokiVariableQueryEditor-VariableQuery", | ||
| "stream": "", | ||
| "type": 1 | ||
| }, | ||
| "refresh": 1, | ||
| "regex": "", | ||
| "skipUrlSync": false, | ||
| "sort": 0, | ||
| "type": "query" | ||
| } | ||
| ] | ||
| }, | ||
| "time": { | ||
| "from": "now-15m", | ||
| "to": "now" | ||
| }, | ||
| "timepicker": {}, | ||
| "timezone": "", | ||
| "title": "Audit logs", | ||
| "uid": "1KG6epL4z", | ||
| "version": 1, | ||
| "weekStart": "" | ||
| } | 
      
      Oops, something went wrong.
        
    
  
  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.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.