Hi All,
Recently I had a thought about trackback.php to attempt to discard spam
so I've made this minor alteration. Could be it reviewed and perhaps
included? Thanks
The purpose of this is to simply reject trackback requests when the
source of the connection is ipv4 and stored in a RBL (I don't know how
well maintained ipv6 RBL databases are).
This requires $wgUseTrackbacksRBL==true to be added to LocalSettings.php
Index: trackback.php
===================================================================
@@ -43,17 +43,33 @@
$tburl = strval( $_POST['url'] );
$tbname = strval( @$_POST['blog_name'] );
$tbarticle = strval( $_REQUEST['article'] );
+$tbip = strval( $_SERVER['REMOTE_ADDR'] );
$title = Title::newFromText($tbarticle);
if( !$title || !$title->exists() )
XMLerror( "Specified article does not exist." );
+
+if( $wgUseTrackbacksRBL==true && substr_count( $tbip, ":" ) == 0
&&
substr_count( $ip, "." ) > 0 ) {
+
+ $rbl_list = array( "zen.spamhaus.org", "dnsbl.njabl.org",
"dnsbl.sorbs.net", "bl.spamcop.net" );
+
+ foreach( $rbl_list as $rbl_site ) {
+ $ip_arr = array_reverse( explode( '.', $tbip ) );
+ $lookup = implode( '.', $ip_arr ) . '.' . $rbl_site;
+ if( $lookup != gethostbyname( $lookup ) ) {
+ XMLerror( $tbip . " is listed in " . $rbl_site
);
+ }
+ }
+}
+
Thanks for your time.
--
Best regards,
Ed
http://www.s5h.net/