Giter Club home page Giter Club logo

mitre / emasser Goto Github PK

View Code? Open in Web Editor NEW
29.0 20.0 10.0 14.91 MB

eMASSer is a command-line interface (CLI) that aims to automate routine business use-cases and provide utility surrounding the Enterprise Mission Assurance Support Service (eMASS) by leveraging its representational state transfer (REST) application programming interface (API).

Home Page: https://mitre.github.io/emasser/

License: Other

Dockerfile 0.89% Ruby 99.11%
disa security-automation emass auditing mitre-saf ruby emasser

emasser's Introduction

eMASSer

GitHub Release Date GitHub release (latest by date) Gem Docker Version

emasser Testing CodeQL Vulnerabilities and Errors GitHub Pages Code Linter

About

eMASSer is a Command Line Interface (CLI) that aims to automate routine business use-cases and provide utility surrounding the Enterprise Mission Assurance Support Service (eMASS) by leveraging its Representational State Transfer (REST) Application Programming Interface (API).

NOTE: The eMASSer CLI utilizes the emass_client RubyGem executable package to access the eMASS API endpoints.


Documentation

For detail content information about the eMASS API references the eMASS API Specification page.

For detail features provided by the eMASSer CLI references the eMASSer CLI Features page.

The eMASSer CLI Architecture depicts the structure, and provides an explanation of CLI behaviors.


Installation Options

eMASSer is a Ruby CLI distributed via GitHub (this repository), RubyGems, or Docker.

Installation Dependencies

  • git
  • Ruby version 2.7 or greater

Runtime Major Dependencies

  • Ruby version 2.7 or greater
  • rubyzip (latest version)
  • emass_client (latest version)
  • On Windows the cURL binary is required (libcurl.dll). To install cURL:
    • Download cURL for windows from curl x.x.x for Windows
      • Go into the archive and browse to the /bin directory
      • Locate libcurl_x64.dll (it may be named just libcurl.dll)
      • Extract the file into the Ruby installation /bin directory
      • Rename the file to libcurl.dll if it has the _x64 suffix
    • Install cURL for windows and add the installation directory to the PATH.
  • See the emasser.gemspec file for all other dependencies

Install via GitHub

  • Clone the repository
    git clone <path to emasser repository> emasser
    cd emasser
  • Build the eMASSer gem*
      gem build *.gemspec
      gem install *.gem

*Note: To run in development mode there isn't a need to build the gem, simply clone from the emasser repository and use:

bundle install

bundle exec exe/emasser [command]

Install via published RubyGems

  • Install the emasser gem from the RubyGems registry

    gem install emasser
  • Update the emasser gem to the latest version

    gem update emasser
  • To run (execute a command) create a .env* file in the directory where you want to invoke the emmaser and use:

    emasser [command]
    

*Note: See Setting Environment Variables Configuration for detailed information on required and optional variables.

Using Docker

Ensure that docker engine is running and start the eMASSer Docker Container.

Install

  • On Linux or Mac:
    docker run --rm -v $PWD/path-to-secrets:/data mitre/emasser:latest
    
  • On Windows:
    docker run --rm -v %cd%/path-to-secrets:/data mitre/emasser:latest
    
  • Update via Docker
      docker pull mitre/emasser:latest

Docker Notes:

  • Docker Options
    • --rm Automatically remove the container when it exits
    • -v Bind mount a volume
  • path-to-secrets
    • Is the path to the .env file and the appropriate eMASS certificates (key.pem and client.pem).

    • For example, if the .env is located in the same directory where the docker run is executed, running the command in a Windows platform would look like this:

      docker run --rm -v %cd%/.:/data mitre/emasser:latest
      
    • See Editing Environment Variables Configuration

Run eMASSer API client commands

  • To list all available GET, POST, PUT, or DELETE commands use:
    docker run --rm -v $PWD/path-to-secrets:/data mitre/emasser:latest get help
    
    docker run --rm -v $PWD/path-to-secrets:/data mitre/emasser:latest post help
    
    docker run --rm -v $PWD/path-to-secrets:/data mitre/emasser:latest put help
    
    docker run --rm -v $PWD/path-to-secrets:/data mitre/emasser:latest delete help
    
    Example commands are for Linux or Mac, replace the $PWD with %cd% for Windows

Delete (remove) the Docker Container

  docker rmi -f mitre/emasser

Roadmap

The eMASSer implements all endpoints provided by the eMASS API, there is, all of the functions available from the eMASS GUI that are exposed by the API. If additional functions are useful (accessible via the CLI), please submit a request to eMass Tier III Support for possible inclusion into the API.

The Road Map seeks to add any useful features that facilitates organization that utilizes eMASS instances and have a need to automate their cybersecurity management process.

For additional capability create an issue, and email it to the SAF Team citing the issue link so we can help.

Some proposed capabilities (looking for a sponsor) are:

  • Update a system's record with met/not met NIST 800-53 Security and Privacy controls and/or common control indicators (CCI) based on scan results expressed in Heimdall Data Format (HDF).
  • Resolve a particular plan of action and milestone (POA&M) based on scan results or git-ops workflow.
  • PKCS11 support to run in an attended mode.

Design

Interactions with eMASS API

The eMASSer CLI leverages the emass_client, which provides a REST API client developed by MITRE based on the OpenAPI V3 standards for the official eMASS API specification. This design enables REST API clients to be generated in any supported programming language. The design enables the emass_client to be generated independently of the eMASSer CLI. Currently, a Ruby and a Typescript eMASS client API are provided. The TypeScript client is used with the Security Automation Framework CLI (SAF) CLI.

Business Logic

Because interactions with the API are handled by a dependency, the bulk of eMASSer business logic is for accepting user input/output, reading data from eMASS or from input, transforming data, and routing data to the appropriate eMASS API endpoint. This business logic is organized into Ruby Classes and Modules based on the command or subcommand requested by the user.

eMASSer CLI Architecture

The eMASSer CLI makes use of the emass_client ruby gem to communicate with an eMASS instance via the eMASS API as depicted in the diagram below:

emasser CLI Architecture

NOTICE

© 2020 The MITRE Corporation.

Approved for Public Release; Distribution Unlimited. Case Number 18-3678.

NOTICE

MITRE hereby grants express written permission to use, reproduce, distribute, modify, and otherwise leverage this software to the extent permitted by the licensed terms provided in the LICENSE.md file included with this project.

NOTICE

This software was produced for the U. S. Government under Contract Number HHSM-500-2012-00008I, and is subject to Federal Acquisition Regulation Clause 52.227-14, Rights in Data-General.

No other use other than that granted to the U. S. Government, or to those acting on behalf of the U. S. Government under that Clause is authorized without the express written permission of The MITRE Corporation.

For further information, please contact The MITRE Corporation, Contracts Management Office, 7515 Colshire Drive, McLean, VA 22102-7539, (703) 983-6000.

emasser's People

Contributors

aaronlippold avatar camdenmoors avatar dependabot[bot] avatar georgedias avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

emasser's Issues

Add Registration Endpoint

Add the Registration endpoint where new users can register a certificate & obtain an API-key (api-key).

curl

The certificate is provided in the form for cert/key.pem
curl -X POST -d -L "[URL]/api/api-key" --cert .\cert.cer --key .\private.key

Sample Response

{ 
    "meta": { 
            "code": 200 
     }, 
     "data": { 
            "apikey": "f0126b6b-f232-45c9-a8de-01d5f003deda" 
     }
 }

Markdown rendering issues

The markdown tables in features.md are not being properly formatted (rendered) when GitHub generates the associated html.
image

Add eMASS account request to README

eMASS access request instructions are provide on the following pages: eMASSER API Documentation and eMASSER Swagger UI
Need to display this information on the READM.MD on the USE section.

Approve API Client for Actionable Requests
Users are required to log-in to eMASS and grant permissions for a client to update data within eMASS on their behalf. This is only required for actionable requests (PUT, POST, DELETE). The Registration Endpoint and all GET requests can be accessed without completing this process with the correct permissions. Please note that leaving a field parameter blank (for PUT/POST requests) has the potential to clear information in the active eMASS records.
To establish an account with eMASS and/or acquire an api-key/user-uid, contact one of the listed POC:
eMASS Tier III support - Website
Send email to eMASS Tier III support
eMASS New User Registration (CAC required)

Next Release Updates

  • Update the output_converters.rd -> change_to_datatime function.

Replace:

      else
        if /(DATE|TIMESTAMP|LASTSEEN|TIME|ATD)/.match(key.to_s.upcase)
          value = value.nil? ? value : Time.at(value.to_i)
        end
        obj_entry[key] = value
        data_obj.merge!(obj_entry)
      end

With:

      else
        date_value = value
        if /(DATE|TIMESTAMP|LASTSEEN|TIME|ATD)/.match(key.to_s.upcase)
          begin
            date_value = Integer(value)
            if date_value > 100000000
              date_value = value.nil? ? value : Time.at(date_value)
            end
          rescue
            date_value
          end
        end
        obj_entry[key] = date_value
        data_obj.merge!(obj_entry)
      end
  • Update the features documentation variable
    From: EMASSER_POCH_TO_DATETIME
    To: EMASSER_EPOCH_TO_DATETIME

Next Release Updates

Fixes to the (docs/features.md) - when viewing from the gh-pages.

  • The dashboard optional flags table - the problem may be that the [top] link needs an empty space after the last table entry.
  • Fix the dashboard entries alignment - all headers need a space after the [top] link
  • Align the dashboards [top] link with the dashboard group name
  • Remove bundle exec from help (emasser post artifacts upload help)
  • add --name to the artifacts upload
  • test the export artifacts endpoint
  • Add POST /api/api-key to the features documentation
  • user-uid is not require, need to make the variable in the .env optional. As of eMASS API specification v3.10 the use of accounts is not required to use the eMASS API
  • Test the artifacts export - out states that the file is exported to the temp directory - not there

Add the NOTICE file see here for content


Update the post.rb class Register
line 57: result = EmassClient::RegistrationApi.new.register_user(Emasser::POST_API_KEY_RETURN_TYPE)


Add to the `constants.rb

  POST_API_KEY_RETURN_TYPE = {
    debug_return_type: 'Object'
  }.freeze

Add to the README

Development

After checking out the repo, run bundle install (after making sure you have a compatible version of bundle installed) to install dependencies. Then, run bundle exec rake test to run all tests or bundle exec rake rubocop to run the linter.

If there are any additional components created (i.e. folders that contain gems in them somewhere), make sure to specify the top level folder in components.rb.

To install this gem onto your local machine, run bundle exec rake install.

List required env variables

When connecting to an eMASS endpoint the CLI does not list all required environment variables that are required:

$ emasser

No configuration was provided for variable: EMASSER_API_KEY_API_KEY
Create a .env file with the necessary variables, place it in the root directory where the emasser command
is executed. See emasser environment variables requirements in emasser CLI Features for more information

Provide a informative list of required environment variables:

$ emasser

No configuration was provided for variable: EMASSER_API_KEY_API_KEY
Create a .env file containing required variables, place it in the root directory where the emasser command is executed
Required variables are:
  export EMASSER_API_KEY_API_KEY=<API key>
  export EMASSER_API_KEY_USER_UID=<unique identifier of the eMASS user EMASSER_API_KEY_API_KEY belongs to>
  export EMASSER_HOST=<FQDN of the eMASS server>
  export EMASSER_KEY_FILE_PATH=<path to your emass key in PEM format>
  export EMASSER_CERT_FILE_PATH=<path to your emass certficate in PEM format>
  export EMASSER_KEY_PASSWORD=<password for the key given in EMASSER_KEY_FILE_PATH>
See emasser environment variables requirements in emasser CLI Features for more information.

No default help is displayed

Add default help information when user issues the emasser command.
Example output would be:
$ emasser
Emasser commands:
emasser [get, put, post, delete, -v, or -V]

Epoch to datetime

Provide an option in the .env to convert the epoch value to a date/time format.

addJekyllTheme

Add the _config.yml to the update markdown file runner

Updates to emasser

Fixes to the features.md

Update the line:
* [/api/systems/{systemId}/cloud-resource-results](#post-cloudresource)
to
* [/api/systems/{systemId}/cloud-resource-results](#post-cloud_resource)

[email protected] email doesnt work

Tried to email for more information, but email was bounced back.

Looking for use cases with this product as we are putting in POAMs for hundreds of controls and will need to change their status soon.

Can we use the REST API to do this?

Is there any how-to or demo videos on youtube?

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.