diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-08 12:28:48 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-08 12:28:48 +0100 |
| commit | 8681fcf565643f67a36cb1fe571fac7843d2b6af (patch) | |
| tree | 1f022edb267281da0a2fd0fde3b5336293f14cea /src/bin/server/main.rs | |
| parent | web: match the desktop layout and remove play-money copy (diff) | |
| download | zagan-bet-8681fcf565643f67a36cb1fe571fac7843d2b6af.tar.gz zagan-bet-8681fcf565643f67a36cb1fe571fac7843d2b6af.zip | |
web: disallow crawlers and quiet the game port
Adds robots.txt with Disallow: / plus noindex/X-Robots-Tag on the site and app. The v5 server treats an HTTP request as a malformed frame, closes silently before HELLO, and suppresses the common TLS scanner noise. Deploy now verifies robots.txt.
Diffstat (limited to '')
| -rw-r--r-- | src/bin/server/main.rs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/bin/server/main.rs b/src/bin/server/main.rs index f42574d..4f188a3 100644 --- a/src/bin/server/main.rs +++ b/src/bin/server/main.rs | |||
| @@ -73,8 +73,24 @@ fn main() { | |||
| 73 | Ok(tls_stream) => { | 73 | Ok(tls_stream) => { |
| 74 | handler::handle_client_tls(tls_stream); | 74 | handler::handle_client_tls(tls_stream); |
| 75 | } | 75 | } |
| 76 | Err(e) => { | 76 | Err(error) => { |
| 77 | eprintln!("TLS handshake failed: {}", e); | 77 | // Public ports get a constant stream of scanners and resets. |
| 78 | // Keep the useful failures, drop the background noise. | ||
| 79 | let message = error.to_string().to_ascii_lowercase(); | ||
| 80 | let noise = [ | ||
| 81 | "unexpected eof", | ||
| 82 | "connection reset", | ||
| 83 | "broken pipe", | ||
| 84 | "handshake failure", | ||
| 85 | "received fatal alert", | ||
| 86 | "bad record mac", | ||
| 87 | "timed out", | ||
| 88 | ] | ||
| 89 | .iter() | ||
| 90 | .any(|needle| message.contains(needle)); | ||
| 91 | if !noise { | ||
| 92 | eprintln!("TLS handshake failed: {error}"); | ||
| 93 | } | ||
| 78 | } | 94 | } |
| 79 | }); | 95 | }); |
| 80 | } | 96 | } |
