Implement Google FBL

This commit is contained in:
danwin1210 committed 2026-10-13 14:31:03 +02:00
1 parent 1ff7d4131d
commit 938bfab606
8 files changed
+113 -9

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
<?php
require_once( '../common_config.php' );
header( 'Content-Type: text/plain; charset=utf-8' );
header( 'Cache-Control: no-store' );
header( 'Expires: 600' );
$token = $_GET[ 'token' ] ?? '';
if ( ! in_array( $_SERVER[ 'REQUEST_METHOD' ], [ 'GET', 'HEAD' ], true ) || ! hash_equals( RSPAMD_SETTINGS_MAP_TOKEN, $token ) ) {
http_response_code( 403 );
exit;
}
$db = get_db_instance();
$stmt = $db->query( 'SELECT username, feedback_id FROM mailbox WHERE active = 1;' );
while ( $mailbox = $stmt->fetch( PDO::FETCH_ASSOC ) ) {
if ( ! preg_match( '/^[a-f0-9]{5,15}$/', $mailbox[ 'feedback_id' ] ) ) {
http_response_code( 500 );
error_log( 'Invalid Google Feedback Loop ID for mailbox ' . $mailbox[ 'username' ] );
exit;
}
echo mb_strtolower( $mailbox[ 'username' ] ) . "\t" . $mailbox[ 'feedback_id' ] . "\n";
}