https://github.com/konijima/rust-socket-network
A unified Rust monorepo providing both a secure WebSocket server and client, using RSA PKCS#1 challenge-response authentication. Easily develop, test, and update both components together for authenticated messaging between clients and server.
https://github.com/konijima/rust-socket-network
network rust socket
Last synced: 11 months ago
JSON representation
A unified Rust monorepo providing both a secure WebSocket server and client, using RSA PKCS#1 challenge-response authentication. Easily develop, test, and update both components together for authenticated messaging between clients and server.
- Host: GitHub
- URL: https://github.com/konijima/rust-socket-network
- Owner: Konijima
- Created: 2025-05-28T02:16:17.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-28T02:23:25.000Z (about 1 year ago)
- Last Synced: 2025-05-28T03:28:50.442Z (about 1 year ago)
- Topics: network, rust, socket
- Language: Rust
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Socket Network Monorepo
This repository is a **monorepo** containing both the Rust WebSocket server and client for secure communication with RSA authentication.
## Repository Structure
```
/
├── client/ # Rust WebSocket client with RSA authentication
├── server/ # Rust WebSocket server with RSA client auth
└── README.md
````
- `client/`: Connects to a WebSocket server, authenticates via RSA private key, and broadcasts messages.
- `server/`: Accepts authenticated clients, verifies RSA signatures, and relays messages.
## Quick Start
### 1. Requirements
- [Rust (stable toolchain)](https://www.rust-lang.org/tools/install)
- [OpenSSL](https://www.openssl.org/)
### 2. Generate Keys
Both projects rely on PKCS#1-format RSA keypairs for authentication.
Generate a private key for each client:
```sh
mkdir -p keys
openssl genrsa -traditional -out keys/device123.pem 2048
````
Extract the matching public key (for the server):
```sh
openssl rsa -in keys/device123.pem -pubout -RSAPublicKey_out -out keys/device123.pub.pem
```
### 3. Project-Specific Setup
#### Server
1. Copy all allowed client public keys (`*.pub.pem`) into `server/keys/`.
2. From the monorepo root:
```sh
cd server
cargo build --release
cargo run
```
The server listens on `ws://0.0.0.0:8081`.
#### Client
1. Place the private key (`device123.pem`) into `client/keys/`.
2. From the monorepo root:
```sh
cd client
cargo build --release
cargo run
```
The client will connect to the server at `ws://localhost:8081` by default.
## Project Documentation
For full details, see the individual READMEs in each project:
* [`client/README.md`](./client/readme.md)
* [`server/README.md`](./server/readme.md)
## Development Workflow
* You can make changes to both projects in a single commit.
* Each project can be built and tested independently from its own subdirectory.
* Key generation instructions are duplicated for clarity—ensure both server and client use matching PKCS#1 key formats.
* **No submodules:** All code is directly present in the monorepo.
## Security Notes
* Communication is unencrypted unless you run the server behind a TLS reverse proxy.
* Anyone with access to the client’s private key can impersonate that client.
* Only public keys present on the server can authenticate.
## License
MIT