C++ implementation of a gRPC gateway designed for scalable and secure microservice architectures on Kubernetes
The gateway includes the following security features:
- Request rate limiting for each IP address
- Customizable limits for different API endpoints
- Automatic blocking of IP addresses that exceed limits
- Automatic IP blocking after 15 failed login attempts
- Block duration: 1 hour
- Counter reset on successful login
- Protection against brute force attacks
- Automatic IP blocking after 5 successful registrations per hour
- Block duration: 1 hour
- Protection against mass account creation
- Distributed storage of blocked IP addresses data
- Real-time tracking of request counts
- Predefined list of known malicious IP addresses
- REST API for blacklist management (adding/removing IPs)
- Automatic blocking of requests from blacklisted IP addresses
# Run with Docker Compose
docker-compose up -dGET /api/v1/admin/blacklist
POST /api/v1/admin/blacklist/add
{
"ip": "192.168.1.1",
"ban_time_seconds": 3600
}
POST /api/v1/admin/blacklist/remove
{
"ip": "192.168.1.1"
}
Note: To access the blacklist management API, you must include the
X-API-Keyheader with the correct API key.
.
├── CMakeLists.txt # CMake build configuration
├── Dockerfile # Docker image build instructions
├── README.md # Project documentation
├── blacklist.txt # Predefined list of blocked IP addresses
├── docker-compose.yml # Docker Compose configuration
├── include/ # Header files (*.h, *.hpp)
│ ├── gateway/ # Gateway module headers
│ ├── security/ # Security module headers
│ └── services/ # Service integration headers
├── proto/ # gRPC service definitions (Protocol Buffers)
│ ├── balance.proto # User balance service
│ ├── payments.proto # Payments service
│ └── users.proto # Users service
└── src/ # C++ source code (*.cpp)
├── gateway/ # Gateway functionality implementation
├── main.cpp # Application entry point
├── security/ # Security functionality implementation
└── services/ # External services integration implementation