Skip to content

Praveenm1910/Multi-Thread-Chat-Server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Secure Multi-Threaded Python Chat Server

A fully encrypted, multi-threaded chat server and client built in Python using:

  • 🧵 Threading
  • 🔐 SSL/TLS (Mutual Authentication)
  • 🗃️ MySQL backend for authentication
  • 🔑 bcrypt for password hashing
  • 🌱 .env configuration support
  • 🔁 Support for real-time private/group messaging

Requirements

  • Python 3.10+
  • MySQL or MariaDB
  • pip install -r requirements.txt (manual install below)

Python Modules Used

pip install mysql-connector-python bcrypt python-dotenv

Generating SSL Certificates

Generate CA with proper extensions:

Create ca_config.cnf with extensions

openssl req -x509 -new -nodes -keyout ca.key -out ca.crt
-days 3650 -config ca_config.cnf

Generate Server Certificate

openssl req -newkey rsa:2048 -nodes -keyout server.key -out server.csr openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key
-CAcreateserial -out server.crt -days 825 -sha256

Generate Client Certificate

openssl req -newkey rsa:2048 -nodes -keyout client.key -out client.csr openssl x509 -req -in client.csr -CA ca.crt -CAkey ca.key
-CAcreateserial -out client.crt -days 825 -sha256

.env File Example

Create a .env file in the root directory with

DB Config

DB_HOST=localhost DB_PORT=3306 DB_USER=username DB_PASS=password DB_NAME=chat_server_db

SSL Config

SSL_CERT_PATH=certs/server.crt SSL_KEY_PATH=certs/server.key SSL_CA_PATH=certs/ca.crt

MySQL Setup

Login to MySQL and run

CREATE DATABASE chat_server_db;

USE chat_server_db;

CREATE TABLE users ( id INT AUTO_INCREMENT PRIMARY KEY, username VARCHAR(50) UNIQUE NOT NULL, password_hash VARCHAR(255) NOT NULL );

Features

Multi-threaded client handling bcrypt password hashing Encrypted SSL/TLS connections Mutual TLS authentication (client/server both validated) Real-time group messaging Registration/Login system using MySQL

Author

Praveen M B.Tech CSBS | Cybersecurity & Dev Enthusiast | Panimalar Engineering College

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages