Files
ophion/docs/INSTALL.md
bigtux a94809c812 🔐 Security hardening: auth, rate limiting, brute force protection
- Add comprehensive security package with:
  - API Key generation and validation (SHA256 hash)
  - Password policy enforcement (min 12 chars, complexity)
  - Rate limiting with presets (auth, api, ingest, export)
  - Brute force protection (5 attempts, 15min lockout)
  - Security headers middleware
  - IP whitelisting
  - Audit logging structure
  - Secure token generation

- Enhanced auth middleware:
  - JWT + API Key dual authentication
  - Token revocation via Redis
  - Scope-based authorization
  - Role-based access control

- Updated installer with:
  - Interactive setup for client customization
  - Auto-generated secure credentials
  - Docker all-in-one image
  - Agent installer script

- Added documentation:
  - SECURITY.md - Complete security guide
  - INSTALL.md - Installation guide
  - .env.example - Configuration reference
2026-02-05 23:02:06 -03:00

232 lines
4.0 KiB
Markdown

# 🐍 OPHION - Guia de Instalação
## Instalação Rápida (1 comando)
```bash
curl -fsSL https://get.ophion.io | bash
```
O instalador vai:
1. ✅ Verificar requisitos (Docker, Docker Compose)
2. 📋 Coletar informações da sua empresa
3. 🔐 Gerar credenciais seguras
4. 📦 Configurar todos os serviços
5. 🚀 Iniciar a plataforma
---
## Instalação Manual (Passo a Passo)
### 1. Requisitos
```bash
# Ubuntu/Debian
sudo apt update
sudo apt install -y curl git
# Instalar Docker
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER
# Logout e login para aplicar grupo docker
```
### 2. Baixar Ophion
```bash
git clone https://github.com/bigtux/ophion.git
cd ophion
```
### 3. Configurar
Copie e edite o arquivo de configuração:
```bash
cp .env.example .env
nano .env
```
Configurações importantes:
```env
# Sua empresa
ORG_NAME="Minha Empresa"
ADMIN_EMAIL=admin@empresa.com
ADMIN_PASSWORD=senha-segura-aqui
# Domínio (ou localhost para testes)
DOMAIN=ophion.empresa.com
# Portas
SERVER_PORT=8080
DASHBOARD_PORT=3000
# Segurança (gere valores únicos!)
JWT_SECRET=seu-jwt-secret-aqui
```
### 4. Iniciar
```bash
docker compose up -d
```
### 5. Acessar
- **Dashboard:** http://localhost:3000
- **API:** http://localhost:8080
---
## Instalação do Agent (Servidores Monitorados)
Em cada servidor que você quer monitorar:
```bash
curl -fsSL http://SEU-SERVIDOR-OPHION:8080/install-agent.sh | sudo bash
```
Ou manualmente:
```bash
# Baixar
curl -o /usr/local/bin/ophion-agent \
http://SEU-SERVIDOR-OPHION:8080/downloads/agent/linux/amd64/ophion-agent
chmod +x /usr/local/bin/ophion-agent
# Configurar
mkdir -p /etc/ophion
cat > /etc/ophion/agent.yaml << EOF
server:
url: http://SEU-SERVIDOR-OPHION:8080
api_key: SUA-API-KEY
collection:
interval: 30s
metrics:
enabled: true
logs:
enabled: true
paths:
- /var/log/syslog
EOF
# Criar serviço
cat > /etc/systemd/system/ophion-agent.service << EOF
[Unit]
Description=OPHION Agent
After=network.target
[Service]
ExecStart=/usr/local/bin/ophion-agent -config /etc/ophion/agent.yaml
Restart=always
[Install]
WantedBy=multi-user.target
EOF
# Iniciar
systemctl daemon-reload
systemctl enable --now ophion-agent
```
---
## Comandos Úteis
```bash
# Status
ophion status
# Logs
ophion logs # Logs do server
ophion logs ophion-web # Logs do dashboard
# Gerenciamento
ophion start
ophion stop
ophion restart
ophion update
# Backup
ophion backup
# Gerar nova API Key
ophion api-key
```
---
## Estrutura de Diretórios
```
/opt/ophion/
├── docker-compose.yml # Configuração dos containers
├── .env # Variáveis de ambiente (SECRETO!)
├── data/
│ ├── postgres/ # Dados do PostgreSQL
│ ├── clickhouse/ # Métricas e logs
│ └── redis/ # Cache
├── configs/ # Configurações customizadas
├── logs/ # Logs da aplicação
├── scripts/
│ └── install-agent.sh # Instalador do agent
└── backups/ # Backups automáticos
```
---
## Portas
| Serviço | Porta | Descrição |
|---------|-------|-----------|
| Dashboard | 3000 | Interface web |
| API | 8080 | REST API |
| PostgreSQL | 5432 | Banco de dados (interno) |
| ClickHouse | 9000 | Métricas/Logs (interno) |
| Redis | 6379 | Cache (interno) |
---
## Troubleshooting
### Containers não iniciam
```bash
# Ver logs
docker compose logs
# Verificar recursos
docker system df
df -h
```
### Agent não conecta
```bash
# Testar conectividade
curl http://SEU-SERVIDOR:8080/health
# Ver logs do agent
journalctl -u ophion-agent -f
```
### Resetar senha admin
```bash
docker compose exec postgres psql -U ophion -c \
"UPDATE users SET password_hash = crypt('nova-senha', gen_salt('bf')) WHERE email = 'admin@email.com';"
```
---
## Suporte
- 📖 Docs: https://docs.ophion.io
- 💬 Discord: https://discord.gg/ophion
- 🐛 Issues: https://github.com/bigtux/ophion/issues
- 📧 Email: support@ophion.io