Code Monkey home page Code Monkey logo

docker-web-gui's Introduction

Hello! I'm Hasan ๐Ÿ‘‹ ๐Ÿ‘จโ€๐Ÿ’ป

A software engineer from Dhaka, Bangladesh, currently living in Stockholm, Sweden. An open-source enthusiast who wants to create a positive impact with his work.

Projects maintained by me:

Docker Dashboard
About A simple web based GUI for managing Docker containers and images.
Repository rakibtg/docker-web-gui
Ported to Electron rakibtg/Docker-Elementary
Homepage dockerdashboard.github.io
Tech Stack React, Redux, Redux Thunk, Electron, Express, Socket
React Native Instagram Clone
About A simple instagram clone using React Native
Repository rakibtg/RN-Instagram
Tech Stack React Native, Expo SDK, Redux
SleekDB
About Pure PHP based NoSQL database system to make your static data dynamic!
Repository rakibtg/SleekDB
Homepage sleekdb.github.io
Tech Stack PHP
Zincphp
About RESTful backend made intuitive by ZincPHP - A micro framework for PHP
Repository getzincphp/zincphp
Homepage getzincphp.github.io
Tech Stack PHP
About I make programming videos on YouTube.
Channel youtube.com/rakibtg
Popular Videos

How to reach me:

Email: [email protected]
Twitter DM: @rakibtg

Design is not just what it looks like and feels like. Design is how it works. โ€• Steve Jobs

docker-web-gui's People

Contributors

akash-ju avatar akimul avatar dependabot[bot] avatar rakibtg 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  avatar  avatar  avatar  avatar

docker-web-gui's Issues

Security: lack of input validation in APIs leads to command injection

For example, making GET requests such as the following results in arbitrary commands being executed on the server, outside of the intended docker process only. This is otherwise known as a remote command injection bug (especially since app.js listens on the network interface by default, accessible by anyone on the network, even though the intended access is localhost).

https://github.com/rakibtg/docker-web-gui/blob/master/backend/controllers/ContainerController.js#L40

/api/container/command?container=&command=;uname%20-a
/api/image/command?image=&command=;id

For example executing the id command may return:

uid=1000(test) gid=1000(test) groups=1000(test),133(docker)

Some of the other APIs seem vulnerable to injection as well.

Recommended easiest fix would be the following

  1. allow only alphanumeric characters in the parameters (strings that actually look like container and image names)
  2. have a list of allowed commands such as start/stop, etc. Ensure this simple validation routine validates the user input before concatenating parameters and calling Terminal(cmd) or in terminal.js itself. Return a "bad parameter" error message if the validation doesn't pass.

Additional references for hardening the code

Server should listen on localhost by default

When you start the app, it says goto http://localhost:3230 to use it, which may lead users to believe it's listening on the localhost interface, but by default it's actually listening on the network interface. Without authentication, it's probably better that it listens on the local interface by default instead with the user having the ability to configure it to listen on the network.

Not a bug per-sa, but just a security hardening and UI suggestion.

docker build error

got this error running docker build

> [6/6] RUN cd /src/backend && npm install:                                    
#10 11.57 npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated                                                                  
#10 11.58 npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated                                                               
#10 13.45 npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
#10 13.82 npm WARN deprecated [email protected]: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
#10 13.83 npm WARN deprecated [email protected]: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
#10 16.59 npm ERR! code 1
#10 16.59 npm ERR! path /src/backend/node_modules/sqlite3
#10 16.59 npm ERR! command failed
#10 16.59 npm ERR! command sh -c node-pre-gyp install --fallback-to-build
#10 16.59 npm ERR! Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/src/backend/node_modules/sqlite3/lib/binding/node-v102-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/src/backend/node_modules/sqlite3/lib/binding/node-v102-linux-x64 --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v102' (1)
#10 16.59 npm ERR! node-pre-gyp info it worked if it ends with ok
#10 16.59 npm ERR! node-pre-gyp info using [email protected]
#10 16.59 npm ERR! node-pre-gyp info using [email protected] | linux | x64
#10 16.59 npm ERR! node-pre-gyp WARN Using needle for node-pre-gyp https download 
#10 16.59 npm ERR! node-pre-gyp info check checked for "/src/backend/node_modules/sqlite3/lib/binding/node-v102-linux-x64/node_sqlite3.node" (not found)
#10 16.59 npm ERR! node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-v102-linux-x64.tar.gz
#10 16.59 npm ERR! node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-v102-linux-x64.tar.gz
#10 16.59 npm ERR! node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-v102-linux-x64.tar.gz 
#10 16.59 npm ERR! node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v102 ABI, musl) (falling back to source compile with node-gyp) 
#10 16.59 npm ERR! node-pre-gyp http 403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-v102-linux-x64.tar.gz 
#10 16.59 npm ERR! gyp info it worked if it ends with ok
#10 16.59 npm ERR! gyp info using [email protected]
#10 16.59 npm ERR! gyp info using [email protected] | linux | x64
#10 16.59 npm ERR! gyp info ok 
#10 16.59 npm ERR! gyp info it worked if it ends with ok
#10 16.59 npm ERR! gyp info using [email protected]
#10 16.59 npm ERR! gyp info using [email protected] | linux | x64
#10 16.60 npm ERR! gyp ERR! find Python 
#10 16.60 npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
#10 16.60 npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
#10 16.60 npm ERR! gyp ERR! find Python checking if "python3" can be used
#10 16.60 npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
#10 16.60 npm ERR! gyp ERR! find Python checking if "python" can be used
#10 16.60 npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error
#10 16.60 npm ERR! gyp ERR! find Python 
#10 16.60 npm ERR! gyp ERR! find Python **********************************************************
#10 16.60 npm ERR! gyp ERR! find Python You need to install the latest version of Python.
#10 16.60 npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
#10 16.60 npm ERR! gyp ERR! find Python you can try one of the following options:
#10 16.60 npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
#10 16.60 npm ERR! gyp ERR! find Python   (accepted by both node-gyp and npm)
#10 16.60 npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
#10 16.60 npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
#10 16.60 npm ERR! gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
#10 16.60 npm ERR! gyp ERR! find Python For more information consult the documentation at:
#10 16.60 npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
#10 16.60 npm ERR! gyp ERR! find Python **********************************************************
#10 16.60 npm ERR! gyp ERR! find Python 
#10 16.60 npm ERR! gyp ERR! configure error 
#10 16.60 npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
#10 16.61 npm ERR! gyp ERR! stack     at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:330:47)
#10 16.61 npm ERR! gyp ERR! stack     at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:159:21)
#10 16.61 npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:202:16)
#10 16.61 npm ERR! gyp ERR! stack     at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:294:16)
#10 16.61 npm ERR! gyp ERR! stack     at exithandler (node:child_process:404:5)
#10 16.61 npm ERR! gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:416:5)
#10 16.61 npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
#10 16.61 npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
#10 16.61 npm ERR! gyp ERR! stack     at onErrorNT (node:internal/child_process:475:16)
#10 16.61 npm ERR! gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
#10 16.61 npm ERR! gyp ERR! System Linux 5.10.76-linuxkit
#10 16.61 npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/src/backend/node_modules/sqlite3/lib/binding/node-v102-linux-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/src/backend/node_modules/sqlite3/lib/binding/node-v102-linux-x64" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v102"
#10 16.61 npm ERR! gyp ERR! cwd /src/backend/node_modules/sqlite3
#10 16.61 npm ERR! gyp ERR! node -v v17.3.0
#10 16.61 npm ERR! gyp ERR! node-gyp -v v8.4.1
#10 16.61 npm ERR! gyp ERR! not ok 
#10 16.61 npm ERR! node-pre-gyp ERR! build error 
#10 16.61 npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/src/backend/node_modules/sqlite3/lib/binding/node-v102-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/src/backend/node_modules/sqlite3/lib/binding/node-v102-linux-x64 --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v102' (1)
#10 16.61 npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/src/backend/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
#10 16.61 npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
#10 16.61 npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1062:16)
#10 16.61 npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
#10 16.61 npm ERR! node-pre-gyp ERR! System Linux 5.10.76-linuxkit
#10 16.61 npm ERR! node-pre-gyp ERR! command "/usr/local/bin/node" "/src/backend/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
#10 16.61 npm ERR! node-pre-gyp ERR! cwd /src/backend/node_modules/sqlite3
#10 16.61 npm ERR! node-pre-gyp ERR! node -v v17.3.0
#10 16.61 npm ERR! node-pre-gyp ERR! node-pre-gyp -v v0.11.0
#10 16.61 npm ERR! node-pre-gyp ERR! not ok
#10 16.61 
#10 16.61 npm ERR! A complete log of this run can be found in:
#10 16.61 npm ERR!     /root/.npm/_logs/2021-12-30T04_56_11_937Z-debug-0.log
------
executor failed running [/bin/sh -c cd /src/backend && npm install]: exit code: 1

Not "Connected"

  • The web gui is up.
  • Dockers are running.
  • docker ps lists a few containers
  • docker image ls shows a bunch of images

The Web GUI is completely blank. Where do I start?

Docker build failed because of old npm version

Hey there!

Thanks for sharing this project. I've no ideo about using npm but docker-compose up -d gives me that:

$ docker-compose up -d
Creating network "docker-web-gui_default" with the default driver
Building docker-web-gui
Sending build context to Docker daemon  5.435MB
Step 1/8 : FROM node:alpine
alpine: Pulling from library/node
9b18e9b68314: Pull complete 
b2d14f5506e1: Pull complete 
7939360db5ad: Pull complete 
445895a5e7bc: Pull complete 
Digest: sha256:717a3d788a41347ceb43c1f65831538d75ea74a4d29dfefadb7b7246d450127c
Status: Downloaded newer image for node:alpine
 ---> c95681c67390
Step 2/8 : WORKDIR /src
 ---> Running in 969027808e25
Removing intermediate container 969027808e25
 ---> cd1fa3d5edfe
Step 3/8 : ADD ./backend /src/backend
 ---> e46105c0ddd6
Step 4/8 : ADD ./client /src/client
 ---> 4c6068e4bf3e
Step 5/8 : ADD ./app.js /src/app.js
 ---> 2a3a147ca464
Step 6/8 : RUN cd /src/backend && npm install --silent
 ---> Running in 1fa82e6f293d
npm notice 
npm notice New minor version of npm available! 8.18.0 -> 8.19.1
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.19.1>
npm notice Run `npm install -g [email protected]` to update!
npm notice 
The command '/bin/sh -c cd /src/backend && npm install --silent' returned a non-zero code: 1
ERROR: Service 'docker-web-gui' failed to build : Build failed

May you fix this please? ๐Ÿ˜„

Docker image?

Looks really nice, but seems weird that you haven't made a dockerfile as well to run this app in a container. Since it looks to be a simple node app it shouldn't be that hard. I'll watch the repo anyways, always love nice clean solutions. ๐Ÿ‘

Cannot start the app

Environment

MacOS Monterey 12.6
node v16.0.0
npm 7.10.0

Cannot start the app

$ node app.js

Screen Shot 2022-11-29 at 14 16 18

Error log

npm ERR! gyp ERR! node -v v16.0.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/Users/izalul/.nvm/versions/node/v16.0.0/bin/node /Users/izalul/.nvm/versions/node/v16.0.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/izalul/docker-dev-ui/backend/node_modules/sqlite3/lib/binding/node-v93-darwin-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/Users/izalul/docker-dev-ui/backend/node_modules/sqlite3/lib/binding/node-v93-darwin-x64 --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/izalul/docker-dev-ui/backend/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:365:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1067:16)
npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm ERR! node-pre-gyp ERR! System Darwin 21.6.0
npm ERR! node-pre-gyp ERR! command "/Users/izalul/.nvm/versions/node/v16.0.0/bin/node" "/Users/izalul/docker-dev-ui/backend/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd /Users/izalul/docker-dev-ui/backend/node_modules/sqlite3
npm ERR! node-pre-gyp ERR! node -v v16.0.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v0.11.0
npm ERR! node-pre-gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/izalul/.npm/_logs/2022-11-29T07_16_08_915Z-debug.log

   at ChildProcess.exithandler (node:child_process:326:12)
   at ChildProcess.emit (node:events:365:28)
   at maybeClose (node:internal/child_process:1067:16)
   at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'cd /Users/izalul/docker-dev-ui/backend && npm install'
}

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.