4.3 KiB
Executable File
4.3 KiB
Executable File
Suggest-Bet Sunucu Güvenlik ve Bağlantı Kılavuzu
Son Güncelleme: 2026-01-16 Olay: PostgreSQL Ransomware saldırısı sonrası güvenlik sıkılaştırması
🔐 Güvenlik Özeti
| Önlem | Durum | Açıklama |
|---|---|---|
| Port 15432 (Postgres) | ❌ Kapalı | Security Group'tan kaldırıldı |
| Port 22 (SSH) | ⚠️ Kapalı | SSM kullan |
| Port 80/443 | ✅ Açık | Nginx için |
| SSM Session Manager | ✅ Aktif | Terminal erişimi için |
| UFW Firewall | ✅ Aktif | 80, 443, localhost:15432 |
| Postgres şifre | ✅ Değiştirildi | Default'tan güçlü şifreye |
🖥️ Sunucu Erişimi (SSH Yerine SSM)
AWS Console ile:
- AWS Console → Systems Manager → Session Manager
- Start Session → Instance seç
- Terminal açılır →
sudo su - ubuntu
Terminal ile (Mac/Linux):
# Normal terminal erişimi
aws ssm start-session --target i-0d9dc15ab7c4f5a96
🗄️ Database Bağlantısı (DBeaver)
Adım 1: SSM Port Forwarding Başlat (Mac'te)
aws ssm start-session \
--target i-0d9dc15ab7c4f5a96 \
--document-name AWS-StartPortForwardingSession \
--parameters '{"portNumber":["15432"],"localPortNumber":["15432"]}'
Not: Mac'te lokal Postgres 15432 portunu kullandığı için
15432kullanıyoruz.
Adım 2: DBeaver Ayarları
| Ayar | Değer |
|---|---|
| Host | localhost |
| Port | 15432 |
| Database | boilerplate_db |
| Username | suggestbet |
| Password | SuGGesT2026SecuRe |
Önemli: SSH tab'ı boş/disabled olmalı!
⚡ Hızlı Bağlantı Alias'ları
Mac (zsh)
# ~/.zshrc dosyasına ekle:
alias dbconnect='aws ssm start-session --target i-0d9dc15ab7c4f5a96 --document-name AWS-StartPortForwardingSession --parameters '\''{"portNumber":["15432"],"localPortNumber":["15432"]}'\'''
# Kullanım:
dbconnect
Windows (PowerShell)
# PowerShell Profile'a ekle ($PROFILE dosyası):
function dbconnect {
aws ssm start-session --target i-0d9dc15ab7c4f5a96 --document-name AWS-StartPortForwardingSession --parameters '{"portNumber":["15432"],"localPortNumber":["15432"]}'
}
# Kullanım:
dbconnect
Windows (CMD) - Batch Script
@echo off
REM dbconnect.bat dosyası oluştur ve PATH'e ekle
aws ssm start-session --target i-0d9dc15ab7c4f5a96 --document-name AWS-StartPortForwardingSession --parameters "{\"portNumber\":[\"15432\"],\"localPortNumber\":[\"15432\"]}"
Windows Kurulum Gereksinimleri
- AWS CLI: https://aws.amazon.com/cli/
- Session Manager Plugin: https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html#install-plugin-windows
aws configureile credentials ayarla
🐳 Docker Ayarları
Container'lar
docker ps # Çalışan container'ları gör
| Container | Port | Açıklama |
|---|---|---|
| boilerplate-postgres | 127.0.0.1:15432 | Sadece localhost |
| boilerplate-redis | 127.0.0.1:6379 | Sadece localhost |
Database Credentials
- User:
suggestbet - Password:
SuGGesT2026SecuRe - Database:
boilerplate_db
Redis Credentials
- Password:
RedisSecure2026
🔥 Firewall (UFW) Kuralları
# Durumu kontrol et
sudo ufw status verbose
# Mevcut kurallar:
# 80/tcp - HTTP (Nginx)
# 443/tcp - HTTPS (Nginx)
# 15432 - Sadece localhost (SSM port forwarding için)
📋 Feeder İşlemleri
# Feeder durumu
pm2 status
# Log'ları izle
pm2 logs feeder-historical --lines 50
# Yeniden başlat
pm2 restart feeder-historical
⚠️ Önemli Notlar
-
GitHub Secrets güncelle:
DATABASE_URL:postgresql://suggestbet:SuGGesT2026SecuRe@localhost:15432/boilerplate_db?schema=publicREDIS_PASSWORD:RedisSecure2026
-
IP değişirse: AWS Security Group güncellemesi gerekmez (SSM kullanıyoruz)
-
Lokal Mac Postgres: Port 15432'yi kullanıyor, bu yüzden SSM forwarding için 15432 kullan