add icradius_secrets config file to export to a non-Freeside MySQL database for
authorivan <ivan>
Wed, 21 Feb 2001 23:48:19 +0000 (23:48 +0000)
committerivan <ivan>
Wed, 21 Feb 2001 23:48:19 +0000 (23:48 +0000)
ICRADIUS

bin/svc_acct.export
htdocs/docs/config.html

index 636921a..3280904 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 #
-# $Id: svc_acct.export,v 1.16 2000-07-06 13:23:29 ivan Exp $
+# $Id: svc_acct.export,v 1.17 2001-02-21 23:48:19 ivan Exp $
 #
 # Create and export password files: passwd, passwd.adjunct, shadow,
 # acp_passwd, acp_userinfo, acp_dialup, users
 # ivan@sisd.com 98-sep-18
 # 
 # $Log: svc_acct.export,v $
-# Revision 1.16  2000-07-06 13:23:29  ivan
+# Revision 1.17  2001-02-21 23:48:19  ivan
+# add icradius_secrets config file to export to a non-Freeside MySQL database for
+# ICRADIUS
+#
+# Revision 1.16  2000/07/06 13:23:29  ivan
 # tyop
 #
 # Revision 1.15  2000/07/06 08:57:28  ivan
@@ -64,6 +68,7 @@ use strict;
 use vars qw($conf);
 use Fcntl qw(:flock);
 use IO::Handle;
+use DBI;
 use FS::Conf;
 use FS::SSH qw(scp ssh);
 use FS::UID qw(adminsuidsetup datasrc dbh);
@@ -98,8 +103,13 @@ my $icradius_mysqldest =
 my $icradius_mysqlsource =
   $conf->config('icradius_mysqlsource') || "/usr/local/var/freeside"
     if $icradiusmachines;
-my $icradius_dbh = dbh; #could eventually get it from a config file if you're
-                        #not running MySQL for your Freeside database
+my $icradius_dbh;
+if ( $icradiusmachines && $conf->exists('icradius_secrets') ) {
+  $icradius_dbh = DBI->connect($conf->config('icradius_secrets'))
+    or die $DBI::errstr;;
+} else {
+  $icradius_dbh = dbh;
+}
 
 my $textradiusprepend = $conf->config('textradiusprepend');
 
index bc6da6b..ea5172d 100644 (file)
@@ -42,6 +42,7 @@ All further configuration files and directories are located in
   <li><a name="icradiusmachines">icradiusmachines</a> - Your <a href="ftp://ftp.cheapnet.net/pub/icradius">ICRADIUS</a> machines, one per line.  The existance of this file (even if empty) turns on radcheck table creation (in the freeside database - the radcheck table needs to be created manually).  Machines listed in this file will have the radcheck table exported to them.  Each line of this file should contain four items, separted by whitespace: machine name, MySQL database name, MySQL username, and MySQL password.  For example: "<CODE>radius.isp.tld&nbsp;radius_db&nbsp;radius_user&nbsp;passw0rd</CODE>".  Note that to use ICRADIUS export you need to be using MySQL.
   <li><a name="icradius_mysqldest">icradius_mysqldest</a> - Destination directory for the MySQL databases, on the ICRADIUS machines.  Defaults to "/usr/local/var/".
   <li><a name="icradius_mysqlsource">icradius_mysqlsource</a> - Source directory for for the MySQL radcheck table files, on the Freeside machine.  Defaults to "/usr/local/var/freeside".
+  <li><a name="icradius_secrets">icradius_secrets</a> - Optionally specifies a MySQL database for ICRADIUS export, if you're not running MySQL for your Freeside database.  The database should be on the Freeside machine and store data in the <a href="#icradius_mysqlsource">icradius_mysqlsource</a> directory.  Three lines: DBI data source, username and password.  This file should not be world readable.
   <li><a name="invoice_from">invoice_from</a> - Return address on email invoices.
   <li><a name="invoice_template">invoice_template</a> - Required template file for invoices.  See the <a href="billing.html">section on billing</a> for details.
   <li><a name="lpr">lpr</a> - Print command for paper invoices, for example `lpr -h'.