feat(güvenlik): giriş ve kayıtta Cloudflare Turnstile, IP başına 3 hatalı denemede 15 dk kilit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+23
-3
@@ -44,6 +44,22 @@ async fn main() -> ExitCode {
|
||||
// Kurlar arka planda (açılışta hemen, sonra aralıkla); hata uygulamayı durdurmaz
|
||||
services::rates::spawn_refresher(db.clone(), config.rates_refresh_minutes);
|
||||
|
||||
if config.turnstile_secret_key.is_some() {
|
||||
tracing::info!("Bot doğrulaması (Cloudflare Turnstile) açık");
|
||||
} else if config.is_https() {
|
||||
tracing::warn!(
|
||||
"Bot doğrulaması KAPALI: TURNSTILE_SITE_KEY / TURNSTILE_SECRET_KEY tanımlayın (docs/DEPLOY.md)"
|
||||
);
|
||||
}
|
||||
tracing::info!(
|
||||
"İstemci IP'si: {}",
|
||||
if config.trust_proxy {
|
||||
"X-Forwarded-For (vekil arkasında, TRUST_PROXY=true)"
|
||||
} else {
|
||||
"bağlantı adresi (TRUST_PROXY=false)"
|
||||
}
|
||||
);
|
||||
|
||||
let port = config.port;
|
||||
let state = AppState::new(db, config);
|
||||
let app = routes::app(state);
|
||||
@@ -60,9 +76,13 @@ async fn main() -> ExitCode {
|
||||
};
|
||||
|
||||
tracing::info!("Kakeibo API çalışıyor: http://localhost:{port}");
|
||||
if let Err(e) = axum::serve(listener, app)
|
||||
.with_graceful_shutdown(shutdown_signal())
|
||||
.await
|
||||
// ConnectInfo: vekil yoksa istemci IP'si bağlantı adresinden (deneme kilidi)
|
||||
if let Err(e) = axum::serve(
|
||||
listener,
|
||||
app.into_make_service_with_connect_info::<SocketAddr>(),
|
||||
)
|
||||
.with_graceful_shutdown(shutdown_signal())
|
||||
.await
|
||||
{
|
||||
tracing::error!("Sunucu hatası: {e}");
|
||||
return ExitCode::FAILURE;
|
||||
|
||||
Reference in New Issue
Block a user