Git Product home page Git Product logo

audito-maldito's Introduction

audito-maldito

audito-maldito is a daemon that monitors OpenSSH server logins and produces structured audit events describing what authenticated users did while logged in (e.g., what programs they executed).

audito-maldito monitors OpenSSH logins and then attempts to correlate authenticated user sessions with Linux kernel audit sessions. Once an audit session has been identified, new audito-maldito events are generated each time the Linux audit session receives a new event. This allows the application to tie an OpenSSH user's identity to their Linux audit session. For example, if a user authenticates using an SSH certificate, certificate details like the fingerprint and key ID will appear in each resulting audito-maldito audit event. These resulting events are written to a customizable file path.

Sysadmins define audit policy using auditd's audit.rules. audito-maldito simply honors whatever Linux audit events appear in the Linux auditd event stream.

For more information about configuring audito-maldito, please refer to the Configuration section.

System requirements

Audit event types

The following subsections detail the different types of audit events generated by audito-maldito. For more information about the structure of these events, please refer to the auditevent library.

UserLogin

Occurs when a user logs in via sshd.

Example:

{
  "component": "sshd",
  "data": {
    "Alg": "ECDSA-CERT SHA256",
    "CA": "CA ED25519 SHA256:JKH45TJj6tNHO/E/VtWZGunEY7C8VLFjVFv6bDq/5VY=",
    "SSHKeySum": "JKH45TJj6tNHO/E/VtWZGunEY7C8VLFjVFv6bDq/5VY",
    "Serial": "350"
  },
  "loggedAt": "2023-03-17T13:37:01.952459Z",
  "metadata": {
    "auditId": "ffffffff-ffff-ffff-ffff-ffffffffffff"
  },
  "outcome": "succeeded",
  "source": {
    "extra": {
      "port": "59145"
    },
    "type": "IP",
    "value": "6.6.6.2"
  },
  "subjects": {
    "loggedAs": "core",
    "pid": "3076344",
    "userID": "[email protected]"
  },
  "target": {
    "host": "blam",
    "machine-id": "deadbeef"
  },
  "type": "UserLogin"
}

UserAction

Occurs when an authenticated sshd user does something (example: the user executes rizin).

Example:

{
  "component": "auditd",
  "loggedAt": "2023-03-17T13:37:38.126Z",
  "metadata": {
    "auditId": "67",
    "extra": {
      "action": "executed",
      "how": "bash",
      "object": {
        "primary": "/usr/local/bin/rizin",
        "type": "file"
      }
    }
  },
  "outcome": "failed",
  "source": {
    "extra": {
      "port": "56734"
    },
    "type": "IP",
    "value": "6.6.6.2"
  },
  "subjects": {
    "loggedAs": "core",
    "pid": "2868326",
    "userID": "[email protected]"
  },
  "target": {
    "host": "the-best-computer",
    "machine-id": "deadbeef"
  },
  "type": "UserAction"
}

Installation and deployment

audito-maldito can be run as a standalone application (such as a systemd unit) or as a Kubernetes Daemonset. At Equinix Metal, we deploy the application in Kubernetes using a Helm chart. The chart relies on rsyslog, which is responsible for passing OpenSSH daemon logs and Linux audit logs to audito-maldito using named pipes. audito-maldito reads from these named pipes and then writes its audit events to a named pipe or file.

The following subsections discuss several installation and deployment methods.

Standalone (from source or as a container)

If you would like to run audito-maldito as a standalone application (i.e., outside of Kubernetes), you can build it from source or use a pre-built container image.

While not required, we recommend using rsyslog to pass OpenSSH logs and Linux audit logs into audito-maldito. An example rsyslog container image and rsyslog configuration can be found under:

To build audito-maldito from source, execute the following command at the root of the repository:

go build

Pre-built container images for both audito-maldito and rsyslog can be found in GitHub's container registry:

Kubernetes

A Helm chart can be found in the equinixmetal-helm GitHub organization:

Configuration

The following subsections discuss audito-maldito's configuration.

Required data sources

audito-maldito reads input data from named pipes (FIFOs). It expects these data sources to be specified using the following arguments:

  • -auditd-pipe-path - The file path to a named pipe that produces Linux auditd events (i.e., events from "/var/log/audit/audit.log")
  • -sshd-pipe-path - The file path to a named pipe that produces OpenSSH sshd logs

Required files

The following files are required by audito-maldito to run:

  • /etc/os-release - Many Linux distributions provide this file. It specifies details such as the distribution name and version
  • /etc/machine-id - This file is managed by systemd. It contains an identifier for the computer

Output data

Audit events produced by audito-maldito are written to the file path specified by the -app-events-output argument. This file path can be a regular file or a named pipe.

Development

If you are a developer or looking to contribute, the following automation may come in handy.

Building a container image

To build the binary in a container, run:

make image

Note that you'll need to have Docker installed.

audito-maldito's People

Contributors

andy-v-h avatar angrieralien avatar hnadiminti-equinix avatar jaormx avatar pereztr5 avatar renovate[bot] avatar sfox-equinix avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

audito-maldito's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update codacy/codacy-analysis-cli-action digest to 740bfaa
  • chore(deps): update docker/build-push-action action to v5.3.0
  • chore(deps): update golang docker tag to v1.22
  • fix(deps): update module github.com/cenkalti/backoff/v4 to v4.3.0
  • fix(deps): update module github.com/stretchr/testify to v1.9.0
  • fix(deps): update module go.uber.org/zap to v1.27.0
  • chore(deps): update codecov/codecov-action action to v4
  • chore(deps): update registry.fedoraproject.org/fedora-minimal docker tag to v41
  • chore(deps): update softprops/action-gh-release action to v2
  • chore(deps): update ubuntu docker tag to v24
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

dockerfile
Dockerfile
  • golang 1.21
contrib/rsyslog/Dockerfile.alpine
  • alpine 3.18.4
contrib/rsyslog/Dockerfile.ubuntu
  • ubuntu 22.04
github-actions
.github/workflows/codacy.yml
  • actions/checkout v4
  • codacy/codacy-analysis-cli-action 240c610b1b65402cda39c6355968ef50aa2c07ba
  • github/codeql-action v3
.github/workflows/codeql.yml
  • actions/checkout v4
  • github/codeql-action v3
  • github/codeql-action v3
  • github/codeql-action v3
.github/workflows/integration-tests.yml
  • actions/checkout v4
  • actions/setup-go v4
  • ubuntu 22.04
.github/workflows/release.yml
  • actions/checkout v4
  • softprops/action-gh-release v1
  • actions/checkout v4
  • docker/login-action 1f401f745bf57e30b3a2800ad308a87d2ebdf14b
  • sigstore/cosign-installer v3.1.1
  • docker/metadata-action v5.3.0
  • docker/metadata-action v5.3.0
  • docker/build-push-action v5.1.0
  • docker/build-push-action v5.1.0
.github/workflows/test.yml
  • actions/checkout v4
  • codecov/codecov-action v3
  • actions/checkout v4
  • docker/build-push-action v5
  • github/codeql-action v3
  • actions/checkout v4
  • github/codeql-action v3
  • registry.fedoraproject.org/fedora-minimal 38
gomod
go.mod
  • go 1.19
  • github.com/cenkalti/backoff/v4 v4.2.1
  • github.com/elastic/go-libaudit/v2 v2.3.3
  • github.com/fsnotify/fsnotify v1.7.0
  • github.com/go-logr/zapr v1.2.4
  • github.com/metal-toolbox/auditevent v0.8.0
  • github.com/prometheus/client_golang v1.17.0
  • github.com/stretchr/testify v1.8.4
  • go.uber.org/zap v1.26.0
  • golang.org/x/sync v0.4.0
regex
Makefile
  • golangci/golangci-lint v1.55.1

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.