https://github.com/hackersa3edy/dockerized_terminal
A Flask application providing a web-based terminal interface to Docker containers with JWT authentication. It uses Flask-SocketIO for real-time communication and Docker for container management.
https://github.com/hackersa3edy/dockerized_terminal
container-management docker flask flask-jwt-extended flask-socketio jwt-authentication python real-time-communication web-based-terminal
Last synced: 3 months ago
JSON representation
A Flask application providing a web-based terminal interface to Docker containers with JWT authentication. It uses Flask-SocketIO for real-time communication and Docker for container management.
- Host: GitHub
- URL: https://github.com/hackersa3edy/dockerized_terminal
- Owner: hackerSa3edy
- Created: 2024-06-03T10:01:01.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2024-06-11T04:36:09.000Z (11 months ago)
- Last Synced: 2025-01-02T18:49:47.678Z (5 months ago)
- Topics: container-management, docker, flask, flask-jwt-extended, flask-socketio, jwt-authentication, python, real-time-communication, web-based-terminal
- Language: Python
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Flask Docker Terminal with JWT Authentication
This is a Flask application that provides a web-based terminal interface to Docker containers. It uses Flask-SocketIO for real-time communication between the client and server, Flask-JWT-Extended for handling JSON Web Tokens (JWTs) and Docker for creating and managing containers.
## Features
- User authentication with JWTs
- Real-time terminal interface to Docker containers
- Terminal sessions are isolated per user and role
- Terminal sessions are automatically cleaned up when the user disconnects## Installation
1. Clone the repository:
```bash
git clone https://github.com/hackerSa3edy/dockerized_terminal.git
cd dockerized_terminal
```2. Install the dependencies:
```bash
pip install -r requirements.txt
```3. Run the application:
```bash
# In development environment
python app.py# In production environment
gunicorn --worker-class eventlet -w 1 app:app --bind 0.0.0.0:5000
```The application will be available at `http://localhost:5000`.
## Usage
The application provides several routes and socket events:
- `@app.route('/')`: The main route. Requires JWT authentication.
- `@socketio.on('connect')`: Handles a new client connection. Requires JWT authentication.
- `@socketio.on('disconnect')`: Handles a client disconnection. Requires JWT authentication and stops the Docker container associated with the user.
- `@socketio.on('start_terminal')`: Starts a new terminal session. Requires JWT authentication and starts a new Docker container.
- `@socketio.on('input')`: Handles input from the client to the terminal. Requires JWT authentication and sends the input to the Docker container.## Dependencies
- Flask
- Flask-SocketIO
- Flask-JWT-Extended
- Docker