Giter Site home page Giter Site logo

rosehgal / dockerent Goto Github PK

View Code? Open in Web Editor NEW
127.0 4.0 17.0 2.17 MB

The only open-source tool to analyze vulnerabilities and configuration issues with running docker container(s) and docker networks.

License: MIT License

Python 83.52% HTML 15.13% Makefile 0.46% Dockerfile 0.89%
docker docker-sast sast runtime-security-testing hacktoberfest hacktoberfest2020

dockerent's Introduction


GitHub Workflow Status GitHub release (latest by date) PyPI - Downloads Libraries.io dependency status for GitHub repo GitHub code size in bytes GitHub
GitHub issues GitHub stars Twitter Follow GitHub followers

DockerENT

DockerENT is activE ruNtime application security scanning Tool (RAST tool). It is a pluggable framework written in Python. It comes with a CLI application and a clean Web Interface written using StreamLit.

DockerENT has been designed to detect weak security misconfigurations in production deployments which can lead to severe consequences. This application connects with running containers in the system and fetches the list of weak and vulnerable runtime configurations and generates a report. If invoked through web interface, it can display the scan and audit report in the UI itself.

How to Run

TL;DR

In hurry to test this? Download the latest stable REL from PyPi and run the Web App, everything else is intuitive.

pip install DockerENT

Then run the application like:

DockerENT -w

Thats it.

Run the latest master

DockerENT has been designed to keep simplicity and usability in mind. Currently you just have to clone the repository and download dependencies or build the Dockerfile. Once the dependencies are installed in local system we are good to run the tool and analyse the runtime configurations for running containers.

# Download and setup
git clone https://github.com/r0hi7/DockerENT.git
cd DockerENT
make venv
source venv/bin/activate

# Run
python -m DockerENT --help 
usage: Find the vulnerabilities hidden in your running container(s).
       [-h] [-d [DOCKER_CONTAINER]] [-p [DOCKER_PLUGINS]]
       [-d-nw [DOCKER_NETWORK]] [-p-nw [DOCKER_NW_PLUGINS]] [-w]
       [-n [PROCESS_COUNT]] [-a] [-o [OUTPUT]]

optional arguments:
  -h, --help            show this help message and exit
  -w, --web-app         Run DockerENT in WebApp mode. If this parameter is
                        enabled, other command line flags will be ignored.
  -n [PROCESS_COUNT], --process [PROCESS_COUNT]
                        Run scans in parallel (Process pool count).
  -a, --audit           Flag to check weather to audit results or not.

  -d [DOCKER_CONTAINER], --docker [DOCKER_CONTAINER]
                        Run scan against the running container.
  -p [DOCKER_PLUGINS], --plugins [DOCKER_PLUGINS]
                        Run scan with only specified plugins.
  -p-nw [DOCKER_NW_PLUGINS], --nw-plugins [DOCKER_NW_PLUGINS]
                        Run scan with only specified plugins.

  -d-nw [DOCKER_NETWORK], --docker-network [DOCKER_NETWORK]
                        Run scan against running docker-network.

  -o [OUTPUT], --output [OUTPUT]
                        Output plugin to write data to.

# or via the container
docker build . -t dockerent
docker run -d -v /var/run/docker.sock:/var/run/docker.sock -p 8501:8501 --name dockerent dockerent
# Then just open your browser to http://localhost:8051

See this quick video to get started with.

Features

  • Plugin driven framework.
  • Use low level docker api to interact with running containers.
  • Clean and Easy to Use UI.
  • Comes with 9 docker scan plugins out of which, 6 plugins can audit results.
  • Framework ready to work docker-networks.
  • Output plugins can write to file and html sinks.
  • The only open source interactive docker scanning tool.
  • Can run plugins in parallel.
  • Under active development ๐Ÿ˜„.

How to Create your own Plugin.

  • Have some idea to perform runtime scan.
  • Copy the same file to create your demo plugin.
cp DockerENT/docker_plugins/docker_sample_plugin.py DockerENT/docker_plugins/docker_demo_plugin.py
  • Just make sure, you maintain following structure.
_plugin_name = 'demo_plugin'

def scan(container, output_queue, audit=False, audit_queue=None):
    _log.info('Staring {} Plugin ...'.format(_plugin_name_))

    res = {}

    result = {
        'test_class': {
            'TEST_NAME': ['good']
        }
    }

    res[container.short_id] = {
        _plugin_name_: result
    }
    
    # Do something magical.

    _log.info('Completed execution of {} Plugin.'.format(_plugin_name_))

    '''Make Sure you put dict of following structure in Q.
    {
        'contiainer_id': {
            'plugin_name': {
                'test_name_demo1': {
                    resultss:[]
                },
                'test_name_demo2': {
                    results: []
                }
            }
        }
    }
    '''
    output_queue.put(res)

    if audit:
        _audit(container, res, audit_queue)

def _audit(container, results, audit_queue):
    '''Make Sure to add dict of following structure to Audit Q
    res = {
        "container_id": [
            "_plugin_name_, WARN/INFO/ERROR, details"
        ]
    }
    '''
    # Magical logic to perform Audit.
    audit_queue.put(res)
  • Thats it. Still confused, Explain me the idea in Issues and will review and help you out, or we may end up working on it together.
  • This plugin will automatically come to drop down in UI. ๐Ÿ˜„ Easy right.
  • Sit back and eval results.

Plugins Features:

Plugin Name Plugin File Feature Audit
CMD_HISTORY File Identify shell history Root history and User shell history
FILESYSTEM File Identify RW File Systems If RW file systems are present.
NETWORK File Identify Network state Identifies All mapped ports.
PLAINTEST_PASSWORD File Identify password in different files
SECURITY_PROFILES File Identify Weak Security Profiles List Weak security profiles.
USER_INFO File Identify user info List permissions in passwd and other sensitive files
SYSTEM_INFO File Identify docker system info No Audit
FILES_INFO File Identify world writeable directories and files List all such files.
PROC_INFO File Identify the list of process in docker system

CLI interface

Pros

  • Rich Logging interface, can help in easy debugging through extensive debug logs.
  • Can run in parallel, just pass -n <count>, to specify the processors in parallel.
  • Can dump output in JSON and HTML file.

Cons

  • Audit output is not dumped to file.
  • Selecting multiple specific dockers is pain.

UI Interface

Pros

  • Clean, and easy to use UI.
  • Everything at one single page.
  • Ease of selecting multilpe docker images, multilpe plugins and multilpe docker-networks.
  • Audit report present.

Cons

  • Logging interface not Rich.
  • JSON reports are bulky.
  • Rely on third party lib StreamLit, all issues with framework are inherent.

Help Make this tool better

  • Create a PR, Issues are more than welcome.
  • Try it, test it and enhance it.

dockerent's People

Contributors

dcrusty avatar dependabot[bot] avatar nishitm avatar rosehgal 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dockerent's Issues

Connect to Docker server via API

Currently the docker server is considered to be from local host. But this is not always the case, the docker server may be remote.

Webapp is listening on all intefaces

Describe the bug
The webapp of DockerENT listens on all network interfaces.

To Reproduce
Steps to reproduce the behavior:

  1. Run python -m DockerENT
  2. Observe web app is listening on all interfaces

Expected behavior
Should only listen on localhost. If on all IP's then should be behind some authentication.

Web Interface Error

Describe the bug
When I try to run from the web interface it says 'NoneType' object is not subscriptable.

To Reproduce
Steps to reproduce the behavior:

  1. Access the Web interface
  2. Select all Containers, All Networks and All Tests
  3. See error

Expected behavior
Tests to run I guess and some sort of feedback provided

Screenshots
1

Desktop (please complete the following information):

  • OS: Ubuntu Server 20.04
  • Browser: Brave and Firefox

Can't build DockerENT on Debian Buster

Describe the bug
When building DockerENT, make venv fails, complaining about missing arrow stuff. However, I have installed python3-arrow from Debian repository already. I have not managed to find other packages that would help (other than maybe installing apache-arrow from unofficial sources (which I rather not do since I am doing this on an actual server where I don't want to install too much stuff I don't use.

To Reproduce
Following the readme, git cloning and make venv

Expected behavior
I would have expect the building of venv.

Screenshots
-- Searching for Python libs in /home/klaus/containers/DockerENT/venv/lib64;/home/klaus/containers/DockerENT/venv/lib;/usr/lib/python3.7/config-3.7m-x86_64-linux-gnu
-- Looking for python3.7m
-- Found Python lib /usr/lib/python3.7/config-3.7m-x86_64-linux-gnu/libpython3.7m.so
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29")
-- Could NOT find Arrow (missing: Arrow_DIR)
-- Checking for module 'arrow'
-- No package 'arrow' found
CMake Error at /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find Arrow (missing: ARROW_INCLUDE_DIR ARROW_LIB_DIR
ARROW_FULL_SO_VERSION ARROW_SO_VERSION)
Call Stack (most recent call first):
/usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
cmake_modules/FindArrow.cmake:419 (find_package_handle_standard_args)
cmake_modules/FindArrowPython.cmake:46 (find_package)
CMakeLists.txt:214 (find_package)

Desktop (please complete the following information):
Debian Buster

Smartphone (please complete the following information):
N/A

Additional context
I would honestly prefer to pull an image off dockerhub instead. This is way too complicated for me.

Thanks!

DockerENT version comes twice

Describe the bug
DockerENT --version displays twice.

To Reproduce
DockerENT --version

Expected behavior
This should only come once.

`DockerENT -w` doesnot works with pip install setup

Describe the bug

โžœ  ~ DockerENT -w
2020-09-05 12:46:44 INFO     2020-09-05 12:46:44 [68372] [MainProcess] [MainThread] INFO DockerENT.__main__:125 - Starting web application ...                                         __main__.py:125
Usage: streamlit run [OPTIONS] TARGET [ARGS]...

Error: Invalid value: File does not exist: web_app.py
Traceback (most recent call last):
  File "/usr/local/bin/DockerENT", line 5, in <module>
    from DockerENT.__main__ import start
  File "/usr/local/lib/python3.7/site-packages/DockerENT/__main__.py", line 143, in <module>
    start()
  File "/usr/local/lib/python3.7/site-packages/DockerENT/__main__.py", line 131, in start
    _log.info(web_process.stdout.read())
AttributeError: 'NoneType' object has no attribute 'read'

To Reproduce

pip install DockerENT

DockerENT -w

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.