diff --git a/smradius/modules/config/mod_config_sql.pm b/smradius/modules/config/mod_config_sql.pm
new file mode 100644
index 0000000000000000000000000000000000000000..a1706d502303d27cdec95f4654120410b083b0bb
--- /dev/null
+++ b/smradius/modules/config/mod_config_sql.pm
@@ -0,0 +1,127 @@
+# SQL config database support
+#
+# Copyright (C) 2008-2009, AllWorldIT
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+package mod_config_sql;
+
+use strict;
+use warnings;
+
+# Modules we need
+use smradius::constants;
+use smradius::logging;
+use smradius::dblayer;
+use smradius::util;
+use smradius::attributes;
+
+# Exporter stuff
+require Exporter;
+our (@ISA,@EXPORT,@EXPORT_OK);
+@ISA = qw(Exporter);
+@EXPORT = qw(
+);
+@EXPORT_OK = qw(
+);
+
+
+
+# Plugin info
+our $pluginInfo = {
+	Name => "SQL Config Database",
+	Init => \&init,
+	
+	# User database
+	Config_get => \&getConfig,
+};
+
+# Module config
+my $config;
+
+## @internal
+# Initialize module
+sub init
+{
+	my $server = shift;
+	my $scfg = $server->{'inifile'};
+
+
+	# Enable support for database
+	if (!$server->{'smradius'}->{'database'}->{'enabled'}) {
+		$server->log(LOG_NOTICE,"[MOD_USERDB_SQL] Enabling database support.");
+		$server->{'smradius'}->{'database'}->{'enabled'} = 1;
+	}
+
+	# Default configs...
+	$config->{'get_config_query'} = '
+		SELECT 
+			Name, Operator, Value
+		FROM 
+			@TP@realm_attributes 
+		WHERE 
+			RealmID = %{realms.ID}
+	';
+	
+
+	# Setup SQL queries
+	if (defined($scfg->{'mod_config_sql'})) {
+		# Pull in queries
+		if (defined($scfg->{'mod_config_sql'}->{'get_config_query'}) &&
+				$scfg->{'mod_config_sql'}->{'get_config_query'} ne "") {
+			$config->{'get_config_query'} = $scfg->{'mod_config_sql'}->{'get_config_query'};
+			
+		}
+	}
+}
+
+
+## @getConfig
+# Try to get a config
+#
+# @param server Server object
+# @param user User
+# @param packet Radius packet
+#
+# @return Result
+sub getConfig
+{
+	my ($server,$user,$packet) = @_;
+
+
+	# Attributes to return
+	my %configAttributes = ();
+
+	# Replace template entries
+	my @dbDoParams = $config->{'get_config_query'};
+	# Query database
+	my $sth = DBSelect(@dbDoParams);
+	if (!$sth) {
+		$server->log(LOG_ERR,"Failed to get config attributes: ".smradius::dblayer::Error());
+		return -1;
+	}
+	
+	# Loop with user attributes
+	while (my $row = $sth->fetchrow_hashref()) {
+		addAttribute($server,\%configAttributes,hashifyLCtoMC($row,qw(Name Operator Value)));
+	}
+
+	DBFreeRes($sth);
+
+	return \%configAttributes;
+}
+
+
+1;
diff --git a/smradius/modules/config/mod_config_test.pm b/smradius/modules/config/mod_config_test.pm
new file mode 100644
index 0000000000000000000000000000000000000000..718bd7ca5ac82afd9050179d2bb12215fdbada48
--- /dev/null
+++ b/smradius/modules/config/mod_config_test.pm
@@ -0,0 +1,88 @@
+# Test user database
+#
+# Copyright (C) 2008-2009, AllWorldIT
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+package mod_config_test;
+
+use strict;
+use warnings;
+
+# Modules we need
+use smradius::constants;
+
+
+# Exporter stuff
+require Exporter;
+our (@ISA,@EXPORT,@EXPORT_OK);
+@ISA = qw(Exporter);
+@EXPORT = qw(
+);
+@EXPORT_OK = qw(
+);
+
+
+
+# Plugin info
+our $pluginInfo = {
+	Name => "Test Config Database",
+	Init => \&init,
+	
+	# User database
+	Config_get => \&configGet,
+};
+
+
+
+## @internal
+# Initialize module
+sub init
+{
+	my $server = shift;
+}
+
+
+
+## @configGet
+# Try to get a config result
+#
+# @param server Server object
+# @param user User
+# @param packet Radius packet
+#
+# @return Result
+sub configGet
+{
+	my ($server,$user,$packet) = @_;
+
+
+	my $userConfig = { 
+		'ConfigAttributes' => 	[
+						{
+							'Name' => 'SMRadius-Config-Secret',
+							'Operator' => '==',
+							'Value' => '12345'
+						}
+
+					]
+			};
+
+
+	return $userConfig;
+}
+
+
+1;
diff --git a/smradiusd b/smradiusd
index fbcaad739e01649f541e955e3fd99912327b84d6..f002e323957bb0dc909ae00020e630fa4a893c30 100755
--- a/smradiusd
+++ b/smradiusd
@@ -28,6 +28,7 @@ use lib qw(
 	smradius/modules/userdb
 	smradius/modules/accounting
 	smradius/modules/features
+	smradius/modules/config
 );
 
 package radiusd;
@@ -175,6 +176,22 @@ sub configure {
 		}
 	}
 	
+	#
+	# System plugins
+	#
+	my @system_params = (
+			'plugins',
+	);
+	my $system;
+	foreach my $param (@system_params) {
+		$system->{$param} = $config{'system'}{$param} if (defined($config{'system'}{$param}));
+	}
+
+	if (!defined($system->{'plugins'})) {
+		$self->log(LOG_ERR,"[SMRADIUS] System configuration error: System plugins not found");
+		exit 1;
+	}
+
 	#
 	# Authentication plugins
 	#
@@ -187,10 +204,6 @@ sub configure {
 		$auth->{$param} = $config{'authentication'}{$param} if (defined($config{'authentication'}{$param}));
 	}
 
-	if (!defined($auth->{'mechanisms'})) {
-		$self->log(LOG_ERR,"[SMRADIUS] Authentication configuration error: Mechanism plugins not found");
-		exit 1;
-	}
 	if (!defined($auth->{'users'})) {
 		$self->log(LOG_ERR,"[SMRADIUS] Authentication configuration error: Userdb plugins not found");
 		exit 1;
@@ -246,7 +259,8 @@ sub configure {
 		@{$auth->{'mechanisms'}},
 		@{$auth->{'users'}},
 		@{$acct->{'plugins'}},
-		@{$features->{'plugins'}} 
+		@{$features->{'plugins'}}, 
+		@{$system->{'plugins'}}
 	];
 
 	# Clean up plugins
@@ -532,6 +546,31 @@ sub process_request {
 
 	# Main user hash with everything in
 	my $user;
+
+
+
+	#
+	# GRAB CONFIG FIXME
+	#
+	foreach my $module (@{$self->{'plugins'}}) {
+		# Try find config attribute
+		if ($module->{'Config_get'}) {
+
+			# Get result from config module
+			$self->log(LOG_INFO,"[SMRADIUS] FIND: Trying plugin '".$module->{'Name'}."' for incoming connection");
+			my ($configData) = $module->{'Config_get'}($self,$user,$pkt);
+
+			if ($configData) {
+				# Add what we have received to the user hash
+				$user->{'ConfigData'} = $configData;
+				$self->log(LOG_NOTICE,"[SMRADIUS] ConfigData: ".Dumper($user->{'ConfigData'}));
+				last;
+			}
+		}
+	}
+
+
+
 	# UserDB module if we using/need it
 	my $userdb;
 
diff --git a/smradiusd.conf b/smradiusd.conf
index 79a71e336de1c40c76ee733774f9da748b691578..0b57e2e0cb598f0af9f32e423db38705a8f96f96 100644
--- a/smradiusd.conf
+++ b/smradiusd.conf
@@ -108,6 +108,13 @@ mod_userdb_sql
 EOT
 
 
+[system]
+plugins=<<EOT
+mod_config_test
+mod_config_sql
+EOT
+
+
 [features]
 plugins=<<EOT
 mod_feature_capping