metaschema-framework / oscal-cli

https://oscal-cli.metaschema.dev/
Other
3 stars 4 forks source link

OSCAL Java Command Line Tool

A Java tool, providing a command line interface, that performs common operations on Open Security Controls Assessment Language (OSCAL) and Metaschema content.

This open-source, tool offers a convenient way to manipulate OSCAL and Metaschema based content supporting the following operations:

This work is intended to make it easier for OSCAL and Metaschema content authors to work with related content.

This tool is based on the Metaschema Java Tools and OSCAL Java Library projects.

Contributing to this code base

Thank you for interest in contributing to the Metaschema Java framework. For complete instructions on how to contribute code, please read through our CONTRIBUTING.md documentation.

Public domain

This project is in the worldwide public domain and as stated in CONTRIBUTING.md.

Installing

Installing pre-built Java package

  1. Make a directory to install oscal-cli and cd into it. The example below uses the directory /opt/oscal-cli. Use your preferred directory.
mkdir -p /opt/oscal-cli
  1. Download the zipped oscal-cli Java package to the install directory. Download your preferred version, but we recommend the latest stable release on the Maven Central repository. You can use the Maven tool instead of in place of additional command line tools (i.e. curl; wget; etc.) or browser to craft URLs for a specific version.
mvn \
  org.apache.maven.plugins:maven-dependency-plugin:LATEST:copy \
  -DoutputDirectory=/opt/oscal-cli \
  -DremoteRepositories=https://repo1.maven.org/maven2 \
  -Dartifact=dev.metaschema.oscal:oscal-cli-enhanced:LATEST:zip:oscal-cli
  1. Move, extract oscal-cli, and delete the zipped package from the install directory.
cd /opt/oscal-cli
unzip *.zip
rm *.zip
  1. (Recommended) Add oscal-cli's directory to your path.
# temporarily add oscal-cli to your terminal's instance path
PATH=$PATH:/opt/oscal-cli/bin

# add oscal-cli to your environment (e.g., all terminals)
export PATH=$PATH:/opt/oscal-cli/bin
  1. You can optionally add oscal-cli's directory to your path in shell profile (i.e. $HOME/.bashrc; $HOME/.zshrc; etc.) to make oscal-cli permanently available.
# You do not need to use both, pick one.
# Use the command below for bash shells.
echo 'export PATH=$PATH:/opt/oscal-cli/bin' >> ~/.bashrc
# Use this command for zsh shells.
echo 'export PATH=$PATH:/opt/oscal-cli/bin' >> ~/.zshrc

Running

Run help to make sure everything works.

# if oscal-cli directory added to your path
oscal-cli --help

# if you did not add oscal-cli directory to your path
/opt/oscal-cli/bin/oscal-cli --help

Building

This project can be built with Apache Maven version 3.8.4 or greater.

The following instructions can be used to clone and build this project.

  1. Clone the GitHub repository.
git clone --recurse-submodules https://github.com/usnistgov/oscal-cli.git 
  1. Build the project with Maven
mvn install

Relationship to prior work

The contents of this repository is based on work from the Metaschema Java repository maintained by the National Institute of Standards and Technology (NIST), the contents of which have been dedicated in the worldwide public domain using the CC0 1.0 Universal public domain dedication. This repository builds on this prior work, maintaining the CCO license on any new works in this repository.