Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

IP ban information to a text file??

Quote Reply
IP ban information to a text file??
Is there a way to get the list of banned IPs output to a text file? Maybe it's already stored as a separate file on the server?

We're working on a method to fold these banned IPs into some sort of firewall that will ban the IPs from the entire server. This could perhaps be released as some kind of plugin to the GT community. If anyone's interested let me know. Or, perhaps something like this already exists??

Jason
Quote Reply
Re: [wickedmoon] IP ban information to a text file?? In reply to
Just use mysqlman's export feature.
Quote Reply
Re: [Paul] IP ban information to a text file?? In reply to
But can this whole process be automated? We need a system where there's an updated, fresh list of banned ip's from the forum software, so we can use this for a site wide ban.

Jason
Quote Reply
Re: [wickedmoon] IP ban information to a text file?? In reply to
Hmm how about this:


my @banned = $DB->table('ForumBans')->select('ban_ip')->fetchall_list;
Quote Reply
Re: [wickedmoon] IP ban information to a text file?? In reply to
There are two types of bans in Gossamer Forum - site bans, in which an IP address is banned from the entire site, and forum bans, in which an IP or user is banned from an individual forum.

The site bans are stored in the config file, and you can get them using a command like:

Code:
perl -I/path/to/admin -e 'use GForum qw/$CFG/;
GForum::init("/path/to/admin");
print join "\n", @{$CFG->{bans}}'

The forum bans are stored in the SQL database, and you can use a query to get them out:

Code:
perl -I/path/to/admin -e 'use GForum qw/$DB/;
GForum::init("/path/to/admin");
print join "\n", $DB->table("ForumBan")->select(\"UNIQUE ban_ip")->fetchall_list'

Or you can combine the two into a single command:

Code:
perl -I/path/to/admin -e 'use GForum qw/$DB $CFG/;
GForum::init("/path/to/admin");
print join "\n", @{$CFG->{bans}}, $DB->table("ForumBan")->select(\"UNIQUE ban_ip")->fetchall_list'

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com