Skip to content

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.

Notifications You must be signed in to change notification settings

hackerSa3edy/dockerized_terminal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:
git clone https://github.com/hackerSa3edy/dockerized_terminal.git
cd dockerized_terminal
  1. Install the dependencies:
pip install -r requirements.txt
  1. Run the application:
# 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

About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published