Security Hardening Guide
Production-grade security for B2ALABS SMART GATEWAY with Zero Trust networking, RBAC, and Pod Security Standards.
Platform Security Metrics
Real-time statistics from B2ALABS production infrastructure
🛡️Security Principles
Zero Trust
Never trust, always verify. Default deny all traffic, explicit allow rules only.
Least Privilege
Minimal permissions necessary. Service accounts with limited RBAC roles.
Defense in Depth
Multiple security layers: network policies, RBAC, Pod Security, encryption.
What You'll Implement
Network Policies
Zero Trust networking
RBAC
Least privilege access
Pod Security
Restricted profile
Secrets Encryption
At-rest encryption
Service Accounts
Per-service isolation
Network Segmentation
Pod-to-pod control
Step-by-Step Implementation
🚀 Quick Deploy All Security
Apply all security configurations at once:
kubectl apply -k infrastructure/kubernetes/base/Step 1: Network Policies
Implement Zero Trust networking with default deny policies:
kubectl apply -f infrastructure/kubernetes/base/network-policy.yaml
kubectl get networkpolicies -n b2alabsPolicies Created:
- Default deny all ingress
- Default deny all egress
- Gateway → PostgreSQL (5432)
- Gateway → Redis (6379)
- Web → Gateway (8080)
- Ingress → Gateway/Web
- Prometheus scraping
Step 2: RBAC Configuration
Configure least privilege access control:
kubectl apply -f infrastructure/kubernetes/base/rbac.yaml
kubectl get sa,roles,rolebindings -n b2alabsService Accounts:
- • gateway-sa (configmaps read, specific secrets only)
- • web-platform-sa (configmaps read, specific secrets only)
- • observability-sa (cluster-wide metrics read)
Step 3: Pod Security Standards
Apply Restricted security profile:
kubectl apply -f infrastructure/kubernetes/base/pod-security.yaml
kubectl get namespace b2alabs --show-labelsSecurity Features:
- runAsNonRoot: true
- allowPrivilegeEscalation: false
- capabilities: drop ALL
- seccompProfile: RuntimeDefault
- readOnlyRootFilesystem (where possible)
Step 4: Secrets Encryption
Enable encryption at rest for all secrets:
# Generate encryption key
head -c 32 /dev/urandom | base64
# Configure on API server
# See docs/SECURITY_HARDENING.md for details
# Encrypt existing secrets
kubectl get secrets --all-namespaces -o json | kubectl replace -f -Security Verification
# ✓ Network policies active
kubectl get networkpolicies -n b2alabs | wc -l
# ✓ RBAC configured
kubectl get sa,roles -n b2alabs
# ✓ Pods running as non-root
kubectl get pods -n b2alabs -o jsonpath='{.items[*].spec.securityContext.runAsNonRoot}'Security Testing
# Test network isolation
kubectl run test --rm -it --image=nicolaka/netshoot -n b2alabs -- sh
# Test RBAC
kubectl auth can-i delete secrets --as=system:serviceaccount:b2alabs:gateway-sa
# Run security audit
kubectl apply -f https://raw.githubusercontent.com/aquasecurity/kube-bench/main/job.yaml7-Layer Security Architecture
B2ALABS implements defense-in-depth with multiple layers of security controls. Each layer provides independent protection, ensuring comprehensive security even if one layer is compromised.
Defense in Depth
Multiple independent security layers protecting your AI infrastructure
Layer 1
ActiveNetwork Security
Kubernetes network policies, Zero Trust networking, TLS 1.3 encryption
Layer 2
ActiveAuthentication & Authorization
JWT-based authentication, RBAC, Cerbos policy engine, MFA support
Layer 3
ActiveInput Validation
PII detection, prompt injection firewall, input sanitization, rate limiting
Layer 4
ActiveLLM Security
Provider security (OpenAI, Anthropic), context isolation, output validation
Layer 5
ActiveData Protection
AES-256 encryption at rest, automatic PII redaction, data retention policies
Layer 6
ActiveMonitoring & Detection
Real-time threat detection, anomaly detection, audit logging, SIEM integration
Layer 7
ActiveIncident Response
24/7 monitoring, automated alerting, incident playbooks, security team
OWASP LLM Top 10 Compliance
B2ALABS implements comprehensive protections against all OWASP LLM Top 10 vulnerabilities:
Frequently Asked Questions
What is Zero Trust networking?
Zero Trust is a security model assuming no implicit trust. Default deny all traffic, explicitly allow only necessary communication. B2ALABS implements this with network policies.
Why is RBAC important?
RBAC implements least privilege - each service gets only minimal needed permissions. Limits blast radius of security breaches.
What are Pod Security Standards?
Kubernetes policies enforcing secure pod configs. Restricted profile requires non-root users, no privilege escalation, dropped capabilities, seccomp filtering.
How long does security hardening take?
45-60 minutes total. Network policies (10 min), RBAC (15 min), Pod Security (10 min), secrets encryption (15 min), verification (10-15 min).
Related Documentation
⚠️Security Disclosure
Found a security vulnerability? Report it to:
security@b2alabs.com
We follow responsible disclosure: 24h acknowledgment, 7d status, 30d fix (critical: 7d)
Need Security Help?
Contact our security team for assistance with hardening your deployment.
Was this page helpful?
