Skip to content

Commit

Permalink
Rebrand cmon to paradrop-agent and update Vagrant env
Browse files Browse the repository at this point in the history
  • Loading branch information
marshyski committed Apr 17, 2024
1 parent c936566 commit 706bbdd
Show file tree
Hide file tree
Showing 61 changed files with 270 additions and 1,080 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ vendor
*.deb
.vagrant*
*.box
paradrop-agent

# macOS Specific
.DS_Store
16 changes: 16 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,22 @@ rm -rf scap-security-guide-0.1.72*
# Install Python Deps
pip3 install -r /paradrop/api/requirements.txt
# Setup paradrop-agent
mkdir -p /etc/paradrop
cat <<'EOF'>/etc/paradrop/paradrop-agent.yaml
api_url: https://localhost:8443/v1/add-host
api_username: [email protected]
api_token: b97a81c5-3c2b-4a96-8881-38af26dc8407
api_insecure_ssl: true
tags: ["app=paradrop-agent-vagrant","health=https://localhost:8443/v1/health"]
oscap_xccdf_xml: "/usr/share/scap-security-guide/ssg-ubuntu2204-ds.xml"
EOF
cp -f /paradrop/paradrop-agent /usr/bin/
# timeout 15 paradrop-agent -d
# Restart
systemctl reboot
SHELL
Expand Down
4 changes: 2 additions & 2 deletions agent/.github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Build cmon binary
- name: Build paradrop-agent binary
run: make docker

- name: Build distroless image
run: |
docker build --build-arg GOOS=linux -t cmon:${{ github.sha }} -f Dockerfile-distroless .
docker build --build-arg GOOS=linux -t paradrop-agent:${{ github.sha }} -f Dockerfile-distroless .
- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@master
Expand Down
6 changes: 3 additions & 3 deletions agent/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ _testmain.go
*.exe
*.test
*.prof
cmon
cmon.yml
cmon-*
paradrop-agent
paradrop-agent.yml
paradrop-agent-*
vendor
*.rpm
*.deb
Expand Down
2 changes: 1 addition & 1 deletion agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ RUN trivy fs -f table --exit-code 0 --no-progress /app/
# App Container
FROM gcr.io/distroless/base
COPY --from=security /app/ /app/
CMD ["/app/cmon", "-d"]
CMD ["/app/paradrop-agent", "-d"]
2 changes: 1 addition & 1 deletion agent/Dockerfile-pkgs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ RUN apt-get update && apt-get install \
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN gem install --no-document fpm
COPY ./packaging /packaging
COPY ./cmon /
COPY ./paradrop-agent /
WORKDIR /packaging
RUN /packaging/package.sh ${VER}
4 changes: 2 additions & 2 deletions agent/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MAIN_PACKAGE := cmon
MAIN_PACKAGE := paradrop-agent
BUILT_ON := $(shell date)
GOOS := $(shell uname -s | tr '[:upper:]' '[:lower:]')
COMMIT:=$(shell git log -n 1 --pretty=format:"%H" 2>/dev/null | head -c 10)
Expand All @@ -8,7 +8,7 @@ GO_ARM := GOOS=linux GOARCH=arm64
GO_OSX := GOOS=darwin GOARCH=amd64
GO_WIN := GOOS=windows GOARCH=amd64
VER := 1.1
LDFLAGS := '-s -w -X "github.com/perlogix/cmon/config.builtOn=$(BUILT_ON)" -X "github.com/perlogix/cmon/config.commitHash=$(COMMIT)" -X "github.com/perlogix/cmon/config.version=$(VER)"'
LDFLAGS := '-s -w -X "github.com/MetroStar/paradrop/agent/config.builtOn=$(BUILT_ON)" -X "github.com/MetroStar/paradrop/agent/config.commitHash=$(COMMIT)" -X "github.com/MetroStar/paradrop/agent/config.version=$(VER)"'

default: build

Expand Down
164 changes: 34 additions & 130 deletions agent/README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
# cmon

[![Go Report Card](https://goreportcard.com/badge/github.com/perlogix/cmon)](https://goreportcard.com/report/github.com/perlogix/cmon)
![Go](https://github.com/perlogix/cmon/workflows/Go/badge.svg)
# paradrop-agent

#### Table of Contents

1. [Overview](#overview)
- [Example JSON Output](#example-json-output)
2. [Install](#install)
3. [Install Dependencies](#install-dependencies)
- [Server](#server)
- [Client](#client-development)
4. [Getting Started Vagrant](#getting-started-vagrant)
5. [Command-Line Arguments](#command-line-arguments)
6. [Configuration](#configuration)
7. [Vagrant](#vagrant)
8. [Platforms Tested On](#platforms-tested-on)
3. [Getting Started Vagrant](#getting-started-vagrant)
4. [Command-Line Arguments](#command-line-arguments)
5. [Configuration](#configuration)

## Overview

NIST Information Security Continuous Monitoring (ISCM) and configuration baseline data collector.

Great for keeping track of elastic environments, auditing or migrating servers by storing data in ElasticSearch or outputting to STDOUT.
Lightweight configurable agent that collects system-wide data used for paradrop processing.

Resources gathered if applicable:

Expand Down Expand Up @@ -336,108 +326,69 @@ Resources gathered if applicable:
}
```

Average payload size: `200k`

ElasticSearch terminology:

http://elasticsearch:9200/index/type

Discover terminology:

http://elasticsearch:9200/servers/environment

Agent Run Time:

The agent runs every twenty minutes, and post real-time data to ElasticSearch.

If you were to delete all hosts in the environment nightly. If the agent is running and the server is up, it will populate the inventory currently with only running hosts and their data. This works very well in elastic compute environments.

Example with cURL:

If you want to manually / cron schedule cmon to post to ElasticSearch

```sh
# HTTP unauth
sudo ./cmon | curl -XPOST -H "Content-Type: application/json" -d @- "http://localhost:9200/servers/_doc/$(hostid)"


# Insecure SSL and basic auth
sudo ./cmon | curl -XPOST -k -u admin:admin -H "Content-Type: application/json" -d @- "https://localhost:9200/servers/_doc/$(hostid)"
```

## Install

Install the statically linked Linux binary:

```sh
curl -OL "https://github.com/perlogix/cmon/releases/download/1.1/cmon" && chmod -f 0755 ./cmon
curl -OL "https://github.com/MetroStar/paradrop/releases/download/0.10/paradrop-agent" && chmod -f 0755 ./paradrop-agent
```

Install DEB file:

```sh
curl -LO $(curl -s https://api.github.com/repos/perlogix/cmon/releases/latest | grep browser_download_url | grep deb | cut -d '"' -f 4)
curl -LO $(curl -s https://api.github.com/repos/MetroStar/paradrop/releases/latest | grep browser_download_url | grep deb | cut -d '"' -f 4)

dpkg -i ./cmon*.deb
dpkg -i ./paradrop-agent*.deb
```

Install RPM file:

```sh
curl -LO $(curl -s https://api.github.com/repos/perlogix/cmon/releases/latest | grep browser_download_url | grep rpm | cut -d '"' -f 4)

rpm -i ./cmon*.rpm
```

**ElasticSearch Mappings Needed**

```sh
# Create index
curl -XPUT "http://localhost:9200/servers"
curl -LO $(curl -s https://api.github.com/repos/MetroStar/paradrop/releases/latest | grep browser_download_url | grep rpm | cut -d '"' -f 4)

# Put mappings to existing index
curl -XPUT "http://localhost:9200/servers/_mapping" -H 'Content-Type: application/json' [email protected]
rpm -i ./paradrop-agent*.rpm
```

## Install Dependencies

### Server

- ElasticSearch 7.x
- Kibana 7.x

### Client (development)
### Development

- Go 1.15>=
- Make
- Docker (Optional)

Compile from git:

```sh
git clone https://github.com/MetroStar/paradrop.git
cd paradrop
mkdir -p "$GOPATH"/src/github.com/MetroStar
ln -s "$PWD" "$GOPATH"/src/github.com/MatroStar/
cd "$GOPATH"/src/github.com/MatroStar/
make
```

To build the binary with Go run the following command:

```sh
make build
make
```

To build the binary with Docker run the following command:

```sh
make local
make docker
```

To build the RPM and Deb packages with Docker run the following command:

```sh
make VER=1.1 pkgs
make VER=0.10 pkgs
```

## Getting Started Vagrant

```sh
git clone https://github.com/perlogix/cmon.git

cd cmon

curl -LO "https://github.com/perlogix/cmon/releases/download/1.1/cmon"
git clone https://github.com/MetroStar/paradrop.git

vagrant up
```
Expand All @@ -447,66 +398,19 @@ vagrant up
No flags / arguments will do a one-time run and produce a JSON file in the current path of the binary

-d, --daemon Run in daemon mode
-c, --config Set configuration path, defaults are ['./', '/opt/perlogix/cmon', '/etc/perlogix/cmon']
-c, --config Set configuration path, defaults are ['./', '/opt/paradrop', '/etc/paradrop']

## Configuration

Configurations can be written in YAML, JSON or TOML.

_/etc/perlogix/cmon/cmon.yaml_
_DEFAULT values if no config is present_
_/etc/paradrop/paradrop-agent.yaml_

```yaml
# ElasticSearch DB
host: localhost
port: 9200

# ElasticSearch Index Name
# This can be anything, it could be aws, softlayer, prod, staging
environment: dev

# Interval of agent runs in seconds
# Default is every twenty minutes
interval: 1200

# Username if http-basic plugin is enabled
username:

# Password if http-basic plugin is enabled
password:

# https true enables HTTPS instead of HTTP)
https: false

# Verify SSL for HTTPS endpoints
insecure_ssl: false

# Public facing asset
public: false

# Asset type
asset_type:

# OpenSCAP XCCDF XML file path
oscap_xccdf_xml: /usr/share/scap-security-guide/ssg-ubuntu1804-ds.xml

# OpenSCAP Profile
oscap_profile: xccdf_org.ssgproject.content_profile_cis
```
## Vagrant
```sh
git clone https://github.com/perlogix/cmon.git
cd cmon
vagrant up
vagrant ssh
api_url: https://localhost:8443/v1/add-host
api_username: [email protected]
api_token: b97a81c5-3c2b-4a96-8881-38af26dc8407
api_insecure_ssl: true
tags: ["app=paradrop-agent-vagrant","health=https://localhost:8443/v1/health"]
oscap_xccdf_xml: "/usr/share/scap-security-guide/ssg-ubuntu2204-ds.xml"
```

## Platforms Tested On

- CentOS/RHEL 7 - latest
- Fedora 20 - latest
- Ubuntu 16 - latest
- Mac OS X 16.7.0 - latest
- Windows 10 - latest
Loading

0 comments on commit 706bbdd

Please sign in to comment.