diff --git a/CHANGELOG.md b/CHANGELOG.md index 0519ecb..5408a87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,45 @@ - \ No newline at end of file +# Changelog + +All notable changes to CB2FA (Community-Based Two-Factor Authentication) will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [1.1.0] – 2025-06-28 + +- Repo converted to mono-structure +- Matrix implementation moved to `/matrix` +- Core architecture documentation started + +## [1.0.0] – 2025-01-28 + +### Added +- **Initial public release**: CB2FA - Community-Based Two-Factor Authentication +- **Middleware system**: nginx proxy intercepting Matrix login requests +- **Bot integration**: Matrix bot for community approval via y/n commands +- **Internationalization**: Support for 7 languages (EN/RU/DE/CN/FR/ES/TR) +- **Queue handling**: Smart queue system for multiple simultaneous login attempts +- **Clean UI**: Аккуратные таблицы showing login details in Matrix chat +- **Documentation**: Complete README in English and Russian with screenshots +- **Security**: Proper gitignore protecting sensitive data (.env, logs, db) +- **Portability**: Fully configurable via environment variables, no hardcoded domains +- **Anti-DDoS**: Natural rate limiting via community-based approval process + +### Technical +- **TypeScript/Deno**: Modern backend with minimal dependencies +- **SQLite database**: Lightweight storage for queue management +- **Matrix client**: Direct integration with Matrix homeserver +- **nginx configuration**: Production-ready reverse proxy setup +- **SSL support**: Let's Encrypt integration for HTTPS + +### Documentation +- README.md (English) with installation and usage instructions +- README_RU.md (Russian) with complete localization +- Real screenshots demonstrating CB2FA in action +- Configuration examples and deployment guide +- MIT License for open source community + +--- + +**Made with ❤️ by EasyProTech LLC (www.easypro.tech)** +**Developer: Brabus** diff --git a/LICENSE b/LICENSE index 0519ecb..1538bfb 100644 --- a/LICENSE +++ b/LICENSE @@ -1 +1,21 @@ - \ No newline at end of file +MIT License + +Copyright (c) 2025 EasyProTech LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 0519ecb..3461cd7 100644 --- a/README.md +++ b/README.md @@ -1 +1,88 @@ - \ No newline at end of file + # CB2FA – Community-Based Two-Factor Authentication + +**CB2FA** is a revolutionary trust-based authentication model where access is approved by humans, not devices. + +> **No OTP. No phones. No secrets. Just people.** + +## 🔍 The Problem + +Traditional 2FA relies on: +- 📱 **Devices you can lose** +- 🔑 **Secrets you can forget** +- 🤖 **Apps that can break** + +## 💡 The CB2FA Solution + +**Community-Based 2FA** relies on: +- 👥 **People you trust** +- 💬 **Simple y/n decisions** +- 🌐 **Platforms you already use** + +When someone tries to log in, your trusted community members get a notification and can approve or deny the request in real-time. + +## 🔧 Implementations + +- ✅ **[Matrix Integration](./matrix)** – Deno-based bot + middleware for Matrix homeservers +- ⏳ **Telegram Integration** (planned) – Bot for Telegram groups +- ⏳ **Discord Integration** (planned) – Bot for Discord servers +- ⏳ **Webhook Mode** (planned) – Generic HTTP callbacks for any app +- ⏳ **Slack Integration** (planned) – Slack app for teams + +## 🌍 Internationalization + +CB2FA supports **7 languages** out of the box: +- 🇬🇧 **English** +- 🇷🇺 **Russian** (Русский) +- 🇩🇪 **German** (Deutsch) +- 🇨🇳 **Chinese Simplified** (中文简体) +- 🇫🇷 **French** (Français) +- 🇪🇸 **Spanish** (Español) +- 🇹🇷 **Turkish** (Türkçe) + +Each implementation loads translations via environment variables. + +## 🏗️ Architecture + +CB2FA follows a **modular architecture**: + +``` +Login Request → Implementation → Queue → Community → Decision → Access +``` + +### Core Components: +- **Queue System** – One active request at a time, others wait +- **Trust Model** – Community members approve/deny access +- **I18n System** – Multi-language support +- **Middleware** – Protocol-specific interceptors + +## 📖 Documentation + +- 📋 [Architecture Overview](./docs/architecture.md) +- 🔄 [How CB2FA Works](./docs/how-it-works.md) +- 🚀 [Getting Started](./matrix/README.md) (Matrix implementation) + +## 🤝 Contributing + +CB2FA is open source and welcomes contributions: +- 🐛 **Bug reports** – Open an issue +- 💡 **Feature requests** – Discuss in issues +- 🔧 **Code contributions** – Submit pull requests +- 🌍 **Translations** – Add new languages +- 📖 **Documentation** – Improve guides + +## 📞 Support + +I do not provide support. I do not consult — not for free, not for money, not in any form. + +Please don't ask for help, fixes, or explanations — this project is released as-is. + +If someone wants to help with development — contributions are welcome. But there are no obligations from my side whatsoever. + +## 📜 License + +**MIT License** – Released by **[EasyProTech LLC](https://www.easypro.tech)** +**Lead Developer:** Brabus + +--- + +**Deploy anywhere, configure everything, hardcode nothing!** 🚀 \ No newline at end of file diff --git a/core/README.md b/core/README.md index 0519ecb..2ff913f 100644 --- a/core/README.md +++ b/core/README.md @@ -1 +1,82 @@ - \ No newline at end of file +# CB2FA Core Components + +This directory contains **shared components** used across all CB2FA implementations. + +## 🌍 Internationalization (i18n) + +**Location**: `./i18n/` + +Shared translations for all CB2FA implementations supporting 7 languages: +- 🇬🇧 English (default) +- 🇷🇺 Russian +- 🇩🇪 German +- 🇨🇳 Chinese (Simplified) +- 🇫🇷 French +- 🇪🇸 Spanish +- 🇹🇷 Turkish + +### Usage +```typescript +import { t, availableLanguages } from '@cb2fa/core/i18n'; + +// Get translated message +const message = t('loginRequest'); // "🔐 Login Request" + +// List available languages +console.log(availableLanguages); +``` + +## 🔄 Queue System + +**Location**: `./queue/` + +Shared queue management for handling multiple simultaneous requests: +- One active request at a time +- Automatic queuing and processing +- Timeout handling +- Anti-spam protection + +### Usage +```typescript +import { RequestQueue } from '@cb2fa/core/queue'; + +const queue = new RequestQueue({ + timeout: 15 * 60 * 1000, // 15 minutes +}); + +await queue.add(request); +``` + +## 🏗️ Types + +**Location**: `./types/` + +Shared TypeScript types and interfaces: +```typescript +interface LoginRequest { + username: string; + ip: string; + userAgent: string; + timestamp: Date; +} + +interface ApprovalResponse { + approved: boolean; + timestamp: Date; + approver?: string; +} +``` + +## 🔧 Utils + +**Location**: `./utils/` + +Shared utility functions: +- Input validation +- Security helpers +- Common formatting +- Configuration loading + +--- + +**Note**: Core components are designed to be platform-agnostic and reusable across all CB2FA implementations. diff --git a/docs/architecture.md b/docs/architecture.md index 0519ecb..ee98570 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -1 +1,99 @@ - \ No newline at end of file +# CB2FA Architecture + +## Overview + +CB2FA (Community-Based Two-Factor Authentication) is a **trust-based authentication platform** that replaces traditional device-based 2FA with human community approval. + +## Core Principles + +### 1. Human Trust Over Device Trust +- Traditional 2FA: "Something you have" (phone, token) +- CB2FA: "Someone you trust" (community members) + +### 2. Real-time Approval +- Login attempts create instant notifications +- Community members respond with simple y/n +- Access granted immediately upon approval + +### 3. Platform Agnostic +- Works with any authentication system +- Middleware intercepts login requests +- Decisions routed through various platforms (Matrix, Telegram, etc.) + +## System Architecture + +``` +┌─────────────┐ ┌──────────────┐ ┌─────────────┐ ┌──────────────┐ +│ User Login │───▶│ Middleware │───▶│ Queue │───▶│ Community │ +│ Attempt │ │ (Intercept) │ │ (1 at time) │ │ Platform │ +└─────────────┘ └──────────────┘ └─────────────┘ └──────────────┘ + │ +┌─────────────┐ ┌──────────────┐ ┌─────────────┐ │ +│ Access │◀───│ Auth Server │◀───│ Decision │◀──────────┘ +│ Granted │ │ (Original) │ │ (y/n) │ +└─────────────┘ └──────────────┘ └─────────────┘ +``` + +## Components + +### 1. Middleware Layer +**Purpose**: Intercept authentication requests before they reach the original auth server. + +**Responsibilities**: +- Validate credentials with original server +- Create approval requests if credentials are valid +- Queue multiple simultaneous requests +- Forward final decision to auth server + +**Implementations**: +- **nginx proxy** (Matrix) +- **HTTP middleware** (Web apps) +- **Bot commands** (Telegram/Discord) + +### 2. Queue System +**Purpose**: Manage multiple login attempts without overwhelming community. + +**Features**: +- ✅ **One active request** at a time +- ✅ **Automatic queuing** of additional requests +- ✅ **Anti-spam protection** via natural rate limiting +- ✅ **Timeout handling** for expired requests + +### 3. Community Platform Integration +**Purpose**: Send approval requests to trusted community members. + +**Supported Platforms**: +- **Matrix** – Rooms with trusted users +- **Telegram** – Private groups (planned) +- **Discord** – Private channels (planned) +- **Slack** – Private channels (planned) + +### 4. Trust Model +**Philosophy**: If you trust someone with the keys to your community platform, you can trust them to approve your logins. + +**Implementation**: +- Community platform membership = CB2FA approval rights +- No additional user management needed +- Natural abuse protection through platform controls + +## Security Model + +### Threat Protection + +**✅ Credential Stuffing**: Invalid credentials rejected before CB2FA +**✅ DDoS Protection**: Queue system prevents overwhelming community +**✅ Social Engineering**: Community members see all login details +**✅ Device Theft**: No device needed, community approval required +**✅ Insider Threats**: Multiple community members can see requests + +### Trust Assumptions + +**🎯 Community Platform Security**: CB2FA inherits security of underlying platform (Matrix encryption, Telegram security, etc.) + +**🎯 Community Member Trust**: Users must trust their community members with login decisions + +**🎯 Network Security**: Standard HTTPS/TLS protection for auth requests + +--- + +**CB2FA: Trust people, not devices.** 🤝