TLS-encrypted console chat server/client with mutual certificate authentication.
- Starts a threaded TCP chat server secured with TLS.
- Connects clients over TLS, authenticating both server and client certificates.
- Broadcasts messages to all connected peers with timestamps.
- Provides a helper script to generate self-signed cert/key pairs for local use.
- Mutual TLS: Server requires client certificates; client verifies the server certificate (hostname check disabled for dev).
- Broadcast chat: Server relays each message to all connected clients.
- Threaded handling: Each client runs on its own thread for concurrency.
- Certificate tooling:
generate_cert.pyproducesserver.crt/keyandclient.crt/key. - Logging: INFO-level logging for connections, certificates, and messages.
- Graceful prompts: Client preserves the input prompt when new messages arrive.
- Python 3 (socket, ssl, threading, logging)
- cryptography (certificate generation)
- pyOpenSSL (listed dependency)
Simple threaded TCP server wrapped in TLS. Each accepted socket is upgraded to TLS, tracked, and broadcast to peers.
[client] ==TLS==> [server:8443] ==TLS==> [client]
\__ thread per client __/
- Python 3.x
- pip
pip install -r requirements.txtRun once to create local dev certs/keys in the project root:
python generate_cert.pyThis produces server.crt, server.key, client.crt, client.key (gitignored).
python server.py- Listens on
localhost:8443by default; adjusthost/portinSecureChatServerif needed. - Expects
server.crt,server.key, andclient.crtin the working directory.
In separate terminals:
python client.py- Uses
localhost:8443by default; adjusthost/portinSecureChatClientif needed. - Expects
client.crt,client.key, andserver.crtin the working directory. - Enter a username when prompted; type messages to broadcast or
quitto disconnect.
- Start the server.
- Launch one or more clients after generating certificates.
- Provide usernames and chat; messages show as
username: messagewith server-side timestamps for logs. - Type
quitto leave; server logs disconnections.
- No automated tests or linters are included in the repository.
- No deployment configuration is provided; current setup targets local development with self-signed certificates.