Docker Security Playground is an application that allows you to:
- Create network and network security scenarios, in order to understand network protocols,
rules, and security issues by installing DSP in your PC.
- Learn penetration testing techniques by simulating vulnerability labs scenarios
- Manage a set of docker-compose project . Main goal of DSP is to learn in penetration testing and network security, but its flexibility allows you the creation, graphic editing and managment run / stop of all your docker-compose labs.
Cite this work
If you use Docker Security Playground for your research activity, cite the following paper published by the IEEE (Institute of Electrical and Electronics Engineers) https://ieeexplore.ieee.org/document/8169747
How To Use
Installation And Start
- Install DSP Requirements:
- Nodejs (v 7 or later)
- compiler tools (g++, c, c++)
- Install node dependencies and run:
git clone https://github.com/giper45/DockerSecurityPlayground.git cd DockerSecurityPlayground npm install
To start the application. This will launch a server listening on 18181 (or another if you set have set PORT environment variable) port of your localhost.
With your favourite browser go to http://localhost:18181. You'll be redirected on installation page, set parameters and click install.
I suggest you to run dsp on a Ubuntu virtual machine and expose on 0.0.0.0 interface.
If you want to expose on another interface, change DSP_IFACE environment variable:
Now you can use dsp on Remote interface.
Update the application:
When you update the application it is important to update the npm packages (The application uses mydockerjs, a npm docker API that I am developing during DSP development: https://www.npmjs.com/package/mydockerjs)
npm run update
If something goes wrong, you can reset DSP to factory by using the following command:
npm run uninstall
This will delete everything, and you can start DSP from the installation step.
DSP_Projects contains official DSP labs. Contribute to DSP by creating new DSP Labs
How can I share my labs with the world ?
During the installation you can create a local environment that has not link with git, or you can associate a personal repository the the application. This is very useful if you want to share your work with other people.
DSP Repository must have several requirements, so I have created a base DSP Repo Template that you can use to create your personal repository.
So, the easiest way to share labs is the following:
- Fork the DSP_Repo project: https://github.com/giper45/DSP_Repo.git
- During the installation set github directory param to your forked repository.
- Now create your labs and share it!
It is important that all images that you use should be available to other users, so:
- You can publish on docker hub so other users can pull your images in order to use your labs.
- You can provide dockerfiles inside the .docker-images directory, so users can use build.sh to build your images and use your repo.
If you need a "private way" to share labs you should share the repository in other ways, at current time there is no support to share private repositories.
In DSP you can manage multiple user repositories (Repositories tab)
- Graphic Editor of docker-compose
- Docker Image and Dockerfile Management
- GIT Integration
- DSP Repository with a set of network security scenarios
Any question ?
If you have a problem you can use Issue section.
Docker Wrapper Image
DSP implements a label convention called DockerWrapperImage that allows you to create images that expose action to execute when a lab is running. Look at the doc
To run a test:
tests use helper.start() method to initialize the test environment:
- A test config is created
- homedir directory is mocked, in this way it is possible to use internal dsp directory for tests.
During dependencies installation
If you have error regarding node-pty module, try to:
- Install build-essentials : (In Ubuntu: apt install -y build-essentials)
- Use nodejs LTS (note-pty has some isseus, as shown here
If you have the following error:
ERR! typeerror Error: Missing required argument #1
You need to update nodejs:
sudo apt-get install -y python-software-properties curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash sudo apt-get install nodejs
During DSP installation
If you have the following error during the installation:
[2020-12-14T10:18:21.854Z] INFO: DockerSecurityPlayground/1536 on vagrant: [DOCKER ACTIONS - DOWNLOAD IMAGE] events.js:174 throw er; // Unhandled 'error' event ^ Error: connect EACCES /var/run/docker.sock at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1107:14) Emitted 'error' event at: at Socket.socketErrorListener (_http_client.js:401:9) at Socket.emit (events.js:198:13) at emitErrorNT (internal/streams/destroy.js:91:8) at emitErrorAndCloseNT (internal/streams/destroy.js:59:3) at process._tickCallback (internal/process/next_tick.js:63:19)
Verify 2 things:
- docker is installed
- current user is in
To test it:
DO NOT USE SUDO if you are running DSP with normal user.
If you have the following error:
vagrant@vagrant:~/git/DockerSecurityPlayground$ docker ps Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json: dial unix /var/run/docker.sock: connect: permission denied
You need to add your user to group docker:
$ sudo groupadd docker $ sudo usermod -aG docker $USER
Log-out and log-in
Now you need to clean DSP:
npm run uninstall
And now everything should work.
MacOS ECONNRESET error:
events.js:183 throw er; // Unhandled 'error' event ^ Error: read ECONNRESET at _errnoException (util.js:992:11) at TCP.onread (net.js:618:25)
On Mac it seems that there is some problem with some node package, so in order to solve this run:
MacBook-Pro:DockerSecurityPlayground gaetanoperrone$ npm install firstname.lastname@example.org --save-dev --save-exact
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request, we'll check
Use the Issues in order to ask everything you want!.
Relevant DSP Repositories
- https://github.com/giper45/DSP_Projects.git : Official DSP Repository
- https://github.com/giper45/DSP_Repo.git : DSP Template to create another repository: fork it to start creating your personal remote environment
- https://github.com/NS-unina/DSP_Repo.git : Repository created for Network Security Course of Simon Pietro Romano in University of the Study in Naples, Federico II
Simon Pietro Romano
Giuseppe Di Terlizzi
Thanks to Giuseppe Criscuolo and Alessandro Placido Luise for the logo design
Got to CHANGELOG.md to see al the version changes.
This project is under the MIT license