Git Product home page Git Product logo

opal's Introduction

The OSCAL Model Reference can be found at, https://pages.nist.gov/OSCAL/reference/latest/complete/

OSCAL Policy Administration Library (opal)

Provides a simple web application for managing System Security Plans and related documents. The data model is based on the OSCAL standard and objects can be imported and exported in OSCAL compliant JSON.

The OSCAL Model Reference can be found at, https://pages.nist.gov/OSCAL/reference/latest/complete/

  1. Python >=3.8
  2. apache
  3. postgres client if using a postgres database

Deployment Instructions

Running a local development version using sqlite

  1. Clone the repository to your local directory
    git clone https://github.com/eop-omb/opal.git
  2. Change to the new directory
    cd opal
  3. The default environment variables are set to work well in a containerized environment. To run locally you will want to set some environment variables. You cna use the provided defaults.env file to get started.
    cp opal/defaults.env opal/.env
  4. It is recommended to run the application from a virtual environment. To do so navigate to the application directory in a terminal and enter the following commands:
    python3 -m venv venv
    source venv/bin/activate
  5. Install the required python modules by running:
    pip install -r requirements.txt
  6. Run the initial migration to create the database objects:
    python manage.py makemigrations
    python manage.py migrate
  7. Create a superuser:
    python manage.py createsuperuser
  8. Start the Server
    python manage.py runserver

Start the app in a docker container using sqlite

  1. Clone the repository to your local directory git clone https://github.com/eop-omb/opal.git
  2. Build the image
    docker build -t opal .
  3. Run the container
    docker run --rm -it --name opal -p 8000:8000 -e LOG_LEVEL=DEBUG opal

Run OPAL with a Postgres database including persistent storage using docker-compose

  1. Clone the repository to your local directory git clone https://gitlab.max.gov/max-security/opal.git
  2. Run the docker-compose. YAML file in the docs/docker-compose/ folder
    cd docs/docker-compose docker-compose up

Setting environment variables

OPAL is designed to run well in a containerized environment. It is recommended to set any desired environment variables using your chosen container orchestration solution (kubernetes, docker-compose, etc.). You can also set environment variables in a .env file which should be placed in the opal subdirectory. All variables are optional and will be populated with reasonable defaults if not provided.

NOTE: defaults will be applied if the environment variable is NOT provided, but if you provide an empty string or something similar the application will not overwrite that with the default value.

You can find a list of all environment variables and their defaults in the opal/settings.py file.

opal's People

Contributors

cs4p avatar dan-omb avatar dependabot[bot] avatar joe-omb avatar mogul avatar openbrian avatar samirari 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

opal's Issues

Open to a PR to streamline usage with Docker?

@dan-omb Hi. Any interest in a PR to streamline usage with Docker?

  • rearrange layers to reduce image build size (1.22GB -> 0.56GB?) and faciliate layer caching for faster rebuilds
  • remove extraneous packages added during the build
  • cleanup package (apt, pip) install cache
  • run as an unprivileged user
  • tweak ENTRYPOINT and CMD to make Django play nice with Docker

Visualizing the model

Not an issue, but I thought I'd share something...

django-extensions is already part of the project. I ran a few commands and generated an SVG of the model classes. You'll need graphviz on your machine to run dot.

python manage.py graph_models -g ssp > opal.dot
dot -T svg opal.dot > opal.svg

It's a big image. Here's a snippet.

image

Permission error

After following the installation instruction using docker container and running the command to start the container I get the following error:

PermissionError: [Errno 13] Permission denied: '/usr/src/app/debug.log'

Complete log:

2024-03-22 12:17:04 + set -e
2024-03-22 12:17:04 + python manage.py migrate --noinput
2024-03-22 12:17:04 Running in Development mode!
2024-03-22 12:17:04 DJANGO_SETTINGS_MODULE: opal.settings
2024-03-22 12:17:04 GPG_KEY: <** removed by me ** >
2024-03-22 12:17:04 HOME: /home/opal
2024-03-22 12:17:04 HOSTNAME: d22b222e39c4
2024-03-22 12:17:04 LANG: C.UTF-8
2024-03-22 12:17:04 PATH: /usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
2024-03-22 12:17:04 PWD: /usr/src/app
2024-03-22 12:17:04 PYTHONDONTWRITEBYTECODE: 1
2024-03-22 12:17:04 PYTHONUNBUFFERED: 1
2024-03-22 12:17:04 PYTHON_GET_PIP_SHA256: <** removed by me **
2024-03-22 12:17:04 PYTHON_GET_PIP_URL: https://github.com/pypa/get-pip/raw/dbf0c85f76fb6e1ab42aa672ffca6f0a675d9ee4/public/get-pip.py
2024-03-22 12:17:04 PYTHON_PIP_VERSION: 24.0
2024-03-22 12:17:04 PYTHON_SETUPTOOLS_VERSION: 65.5.1
2024-03-22 12:17:04 PYTHON_VERSION: 3.11.8
2024-03-22 12:17:04 SHLVL: 1
2024-03-22 12:17:04 _: /usr/local/bin/python
2024-03-22 12:17:04 Traceback (most recent call last):
2024-03-22 12:17:04 File "/usr/local/lib/python3.11/logging/config.py", line 573, in configure
2024-03-22 12:17:04 handler = self.configure_handler(handlers[name])
2024-03-22 12:17:04 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-03-22 12:17:04 File "/usr/local/lib/python3.11/logging/config.py", line 757, in configure_handler
2024-03-22 12:17:04 result = factory(**kwargs)
2024-03-22 12:17:04 ^^^^^^^^^^^^^^^^^
2024-03-22 12:17:04 File "/usr/local/lib/python3.11/logging/init.py", line 1181, in init
2024-03-22 12:17:04 StreamHandler.init(self, self._open())
2024-03-22 12:17:04 ^^^^^^^^^^^^
2024-03-22 12:17:04 File "/usr/local/lib/python3.11/logging/init.py", line 1213, in _open
2024-03-22 12:17:04 return open_func(self.baseFilename, self.mode,
2024-03-22 12:17:04 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-03-22 12:17:04 PermissionError: [Errno 13] Permission denied: '/usr/src/app/debug.log'
2024-03-22 12:17:04
2024-03-22 12:17:04 The above exception was the direct cause of the following exception:
2024-03-22 12:17:04
2024-03-22 12:17:04 Traceback (most recent call last):
2024-03-22 12:17:04 File "/usr/src/app/manage.py", line 22, in
2024-03-22 12:17:04 main()
2024-03-22 12:17:04 File "/usr/src/app/manage.py", line 18, in main
2024-03-22 12:17:04 execute_from_command_line(sys.argv)
2024-03-22 12:17:04 File "/usr/local/lib/python3.11/site-packages/django/core/management/init.py", line 442, in execute_from_command_line
2024-03-22 12:17:04 utility.execute()
2024-03-22 12:17:04 File "/usr/local/lib/python3.11/site-packages/django/core/management/init.py", line 416, in execute
2024-03-22 12:17:04 django.setup()
2024-03-22 12:17:04 File "/usr/local/lib/python3.11/site-packages/django/init.py", line 19, in setup
2024-03-22 12:17:04 configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2024-03-22 12:17:04 File "/usr/local/lib/python3.11/site-packages/django/utils/log.py", line 76, in configure_logging
2024-03-22 12:17:04 logging_config_func(logging_settings)
2024-03-22 12:17:04 File "/usr/local/lib/python3.11/logging/config.py", line 823, in dictConfig
2024-03-22 12:17:04 dictConfigClass(config).configure()
2024-03-22 12:17:04 File "/usr/local/lib/python3.11/logging/config.py", line 580, in configure
2024-03-22 12:17:04 raise ValueError('Unable to configure handler '
2024-03-22 12:17:04 ValueError: Unable to configure handler 'file'

Add categorization

Each system is rated according to FIPS 199. It would be nice to pick the system categorization and have a set of controls automatically become selected accordingly.

Inheriting control statements

Scenario: system a inherits from system b. I create a new statement for a control in system a, it is linked to the baseline control instead of a new control. This causes the naming convention to fail but also the new control is propagated to all other systems that inherit from b

Word Documents are treated as PDF files when trying to display or download

Describe the bug
The system treats all documents as PDF when retrieving them from the database. A .pdf extension is applied to the temporary file which causes the browser to return an error.

To Reproduce
Steps to reproduce the behavior:

  1. Upload a word document
  2. Click on the link for the new document
  3. Note the inline display has an error
  4. click on the Download link to see another error

Expected behavior
Since OPAL is intended as a repository and not a tool for working on live attachments. It might make the most sense to limit uploads to PDF or to convert files to PDF on upload.

Imported catalog not showing up when generating an SSP

I've installed OPAL locally based on the instructions in the repo. I'm able to go to "NIST Catalog" on the site and import the following catalog:

https://github.com/EOP-OMB/opal/blob/main/media/uploads/catalogs/NIST_SP-800-53_rev5-FPD_LOW-baseline-resolved-profile_catalog.json

After import, the control baseline does appear correctly in the admin section:

image

image

image

However, when I try to create a new SSP, none of the controls are showing up:

image

image

Is there something I need to do after importing the catalog to be able to select the controls?

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.