From 327df8aefdcf96c9c83805570abf4cc242cf46b9 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 13 Apr 2002 13:36:26 +0000 Subject: [PATCH] - documentation updates - move Critical Path export to new-style export - bin/sqlradius_reset gets a manpage and becomes FS/bin/freeside-sqlradius-reset --- FS/FS.pm | 29 ++++- FS/FS/Conf.pm | 6 +- FS/FS/part_export.pm | 11 +- FS/FS/part_export/cp.pm | 117 +++++++++++++++++ FS/FS/svc_acct.pm | 142 --------------------- FS/bin/freeside-overdue | 3 + .../bin/freeside-sqlradius-reset | 22 ++++ httemplate/edit/part_export.cgi | 7 +- 8 files changed, 188 insertions(+), 149 deletions(-) create mode 100644 FS/FS/part_export/cp.pm rename bin/sqlradius_reset => FS/bin/freeside-sqlradius-reset (75%) mode change 100644 => 100755 diff --git a/FS/FS.pm b/FS/FS.pm index 36fabcb8e..287e50c67 100644 --- a/FS/FS.pm +++ b/FS/FS.pm @@ -5,6 +5,9 @@ use vars qw($VERSION); $VERSION = '0.01'; +#find missing entries in this file with: +# for a in `ls *pm | cut -d. -f1`; do grep 'L' ../FS.pm >/dev/null || echo "missing $a" ; done + 1; __END__ @@ -26,6 +29,12 @@ L - User class (not yet OO) L - Non OO-subroutines for the web interface. +L - Message catalog + +L - Message catalog + +L - RADIUS dictionary + =head2 Database record classes L - Database record base class @@ -43,6 +52,8 @@ L - Service base class L - Account (shell, RADIUS, POP3) class +L - RADIUS groups + L - Domain class L - DNS zone entries @@ -121,6 +132,8 @@ L - Job queue L - Job arguments +L - Message catalogs + =head1 Remote API modules L @@ -131,11 +144,23 @@ L =head2 Command-line utilities -L +L L -L +L + +L + +L + +L + +L + +L + +L L diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 0c41980ea..b02913258 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -305,8 +305,8 @@ httemplate/docs/config.html { 'key' => 'cp_app', - 'section' => 'mail', - 'description' => 'Integration with Critial Path Account Provisioning Protocol, four lines: "host:port", username, password, and workgroup (for new users).', + 'section' => 'deprecated', + 'description' => 'DEPRECATED, add a cp export instead. This option used to integrate with Critial Path Account Provisioning Protocol, four lines: "host:port", username, password, and workgroup (for new users).', 'type' => 'textarea', }, @@ -404,7 +404,7 @@ httemplate/docs/config.html { 'key' => 'icradiusmachines', 'section' => 'deprecated', - 'description' => 'DEPRECATED, add sqlradius exports to Service definitions instead. This option used to enable radcheck and radreply table population - by default in the Freeside database, or in the database specified by the icradius_secrets config option (the radcheck and radreply tables needs to be created manually). You do not need to use MySQL for your Freeside database to export to an ICRADIUS/FreeRADIUS MySQL database with this option.
ADDITIONAL DEPRECATED FUNCTIONALITY (instead use MySQL replication or point icradius_secrets to the external database) - your ICRADIUS machines or FreeRADIUS (with MySQL authentication) machines, one per line. Machines listed in this file will have the radcheck table exported to them. Each line should contain four items, separted by whitespace: machine name, MySQL database name, MySQL username, and MySQL password. For example: "radius.isp.tld radius_db radius_user passw0rd"
', + 'description' => 'DEPRECATED, add a sqlradius export instead. This option used to enable radcheck and radreply table population - by default in the Freeside database, or in the database specified by the icradius_secrets config option (the radcheck and radreply tables needs to be created manually). You do not need to use MySQL for your Freeside database to export to an ICRADIUS/FreeRADIUS MySQL database with this option.
ADDITIONAL DEPRECATED FUNCTIONALITY (instead use MySQL replication or point icradius_secrets to the external database) - your ICRADIUS machines or FreeRADIUS (with MySQL authentication) machines, one per line. Machines listed in this file will have the radcheck table exported to them. Each line should contain four items, separted by whitespace: machine name, MySQL database name, MySQL username, and MySQL password. For example: "radius.isp.tld radius_db radius_user passw0rd"
', 'type' => [qw( checkbox textarea )], }, diff --git a/FS/FS/part_export.pm b/FS/FS/part_export.pm index 835f5318f..7ae00f00c 100644 --- a/FS/FS/part_export.pm +++ b/FS/FS/part_export.pm @@ -505,13 +505,22 @@ sub exporttype2svcdb { 'password' => { label=>'Database password' }, }, 'nodomain' => 'Y', - 'notes' => 'Not specifying datasrc will export to the freeside database? (no... notes on MySQL replication, DBI::Proxy, etc., from Conf.pm && export.html etc., reset with bin/sqlradius_reset', + 'notes' => 'Real-time export of radcheck, radreply and usergroup tables to any SQL database for FreeRADIUS or ICRADIUS. Use freeside-sqlradius-reset to delete and repopulate the tables from the Freeside database.', }, 'cyrus' => { 'desc' => 'Real-time export to Cyrus IMAP server', }, 'cp' => { 'desc' => 'Real-time export to Critical Path Account Provisioning Protocol', + 'options' => { + 'host' => { label=>'Hostname' }, + 'port' => { label=>'Port number' }, + 'username' => { label=>'Username' }, + 'password' => { label=>'Password' }, + 'domain' => { label=>'Domain' }, + 'workgroup' => { label=>'Default Workgroup' }, + }, + 'notes' => 'Real-time export to Critial Path Account Provisioning Protocol. Requires installation of Net::APP from CPAN.', }, 'infostreet' => { 'desc' => 'Real-time export to InfoStreet streetSmartAPI', diff --git a/FS/FS/part_export/cp.pm b/FS/FS/part_export/cp.pm new file mode 100644 index 000000000..58ac85e8a --- /dev/null +++ b/FS/FS/part_export/cp.pm @@ -0,0 +1,117 @@ +package FS::part_export::cp; + +use vars qw(@ISA); +use FS::part_export; + +@ISA = qw(FS::part_export); + +sub rebless { shift; } + +sub _export_insert { + my( $self, $svc_acct ) = (shift, shift); + $self->cp_queue( $svc_acct->svcnum, 'create_mailbox', + Mailbox => $svc_acct->username, + Password => $svc_acct->_password, + Workgroup => $self->option('workgroup'), + Domain => $svc_acct->domain, + ); +} + +sub _export_replace { + my( $self, $new, $old ) = (shift, shift, shift); + return "can't change domain with Critical Path" + if $old->domain ne $new->domain; + return '' unless $old->username ne $new->username + || $old->_password ne $new->_password; + $self->cp_queue( $new->svcnum, 'replace', $new->domain, + $old->username, $new->username, $old->_password, $new->_password ); +} + +sub _export_delete { + my( $self, $svc_acct ) = (shift, shift); + $self->cp_queue( $svc_acct->svcnum, 'delete_mailbox', + Mailbox => $svc_acct->username, + Domain => $svc_acct->domain, + ); +} + +sub cp_queue { + my( $self, $svcnum, $method ) = (shift, shift, shift); + my $queue = new FS::queue { + 'svcnum' => $svcnum, + 'job' => 'FS::part_export::cp::cp_command', + }; + $queue->insert( + $self->option('host'), + $self->option('port'), + $self->option('username'), + $self->option('password'), + $self->option('domain'), + $method, + @_, + ); +} + +sub cp_command { #subroutine, not method + my($host, $port, $username, $password, $login_domain, $method, @args) = @_; + + #quelle hack + if ( $method eq 'replace' ) { + + my( $domain, $old_username, $new_username, $old_password, $new_password) + = @args; + + if ( $old_username ne $new_username ) { + cp_command($host, $port, $username, $password, 'rename_mailbox', + Domain => $domain, + Old_Mailbox => $old_username, + New_Mailbox => $new_username, + ); + } + + if ( $new_password =~ /^\*SUSPENDED\* (.*)$/ ) { + $new_password = $1; + cp_command($host, $port, $username, $password, 'set_mailbox_status', + Domain => $domain, + Mailbox => $new_username, + Other => 'T', + Other_Bounce => 'T', + ); + } else { + cp_command($host, $port, $username, $password, 'set_mailbox_status', + Domain => $domain, + Mailbox => $new_username, + Other => 'F', + Other_Bounce => 'F', + ); + } + + if ( $old_password ne $new_password ) { + cp_command($host, $port, $username, $password, 'change_mailbox', + Domain => $domain, + Mailbox => $new_username, + Password => $new_password, + ); + } + + return; + } + #eof quelle hack + + eval "use Net::APP;"; + + my $app = new Net::APP ( + "$host:$port", + User => $username, + Password => $password, + Domain => $login_domain, + Timeout => 60, + #Debug => 1, + ) or die "$@\n"; + + $app->$method( @args ); + + die $app->message."\n" unless $app->ok; + +} + diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index 38e24c110..1e1cbb019 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -8,7 +8,6 @@ use vars qw( @ISA $nossh_hack $noexport_hack $conf $username_noperiod $username_uppercase $shellmachine $useradd $usermod $userdel $mydomain $cyrus_server $cyrus_admin_user $cyrus_admin_pass - $cp_server $cp_user $cp_pass $cp_workgroup $dirhash @saltset @pw_set $rsync $ssh $exportdir $vpopdir); @@ -80,16 +79,6 @@ $FS::UID::callback{'FS::svc_acct'} = sub { $cyrus_admin_user = ''; $cyrus_admin_pass = ''; } - if ( $conf->exists('cp_app') ) { - ($cp_server, $cp_user, $cp_pass, $cp_workgroup) = - $conf->config('cp_app'); - eval "use Net::APP;" - } else { - $cp_server = ''; - $cp_user = ''; - $cp_pass = ''; - $cp_workgroup = ''; - } $dirhash = $conf->config('dirhash') || 0; $exportdir = "/usr/local/etc/freeside/export." . datasrc; @@ -351,18 +340,6 @@ sub insert { } } - if ( $cp_server ) { - my $queue = new FS::queue { - 'svcnum' => $self->svcnum, - 'job' => 'FS::svc_acct::cp_insert' - }; - $error = $queue->insert($self->username, $self->_password); - if ( $error ) { - $dbh->rollback if $oldAutoCommit; - return "queueing job (transaction rolled back): $error"; - } - } - if ( $vpopdir ) { my $vpopmail_queue = @@ -423,27 +400,6 @@ sub cyrus_insert { 1; } -sub cp_insert { - my( $username, $password ) = @_; - - my $app = new Net::APP ( $cp_server, - User => $cp_user, - Password => $cp_pass, - Domain => $mydomain, - Timeout => 60, - #Debug => 1, - ) or die "$@\n"; - - $app->create_mailbox( - Mailbox => $username, - Password => $password, - Workgroup => $cp_workgroup, - Domain => $mydomain, - ); - - die $app->message."\n" unless $app->ok; -} - sub vpopmail_insert { my( $username, $password, $domain, $vpopdir ) = @_; @@ -633,15 +589,6 @@ sub delete { } } - if ( $cp_server ) { - my $queue = new FS::queue { 'job' => 'FS::svc_acct::cp_delete' }; - $error = $queue->insert($self->username); - if ( $error ) { - $dbh->rollback if $oldAutoCommit; - return "queueing job (transaction rolled back): $error"; - } - } - if ( $vpopdir ) { my $queue = new FS::queue { 'job' => 'FS::svc_acct::vpopmail_delete' }; $error = $queue->insert( $self->username, $self->domain ); @@ -679,24 +626,6 @@ sub cyrus_delete { 1; } -sub cp_delete { - my( $username ) = @_; - my $app = new Net::APP ( $cp_server, - User => $cp_user, - Password => $cp_pass, - Domain => $mydomain, - Timeout => 60, - #Debug => 1, - ) or die "$@\n"; - - $app->delete_mailbox( - Mailbox => $username, - Domain => $mydomain, - ); - - die $app->message."\n" unless $app->ok; -} - sub vpopmail_delete { my( $username, $domain ) = @_; @@ -871,18 +800,6 @@ sub replace { } } - if ( $cp_server && $old->_password ne $new->_password ) { - my $queue = new FS::queue { - 'svcnum' => $new->svcnum, - 'job' => 'FS::svc_acct::cp_change' - }; - $error = $queue->insert( $new->username, $new->_password ); - if ( $error ) { - $dbh->rollback if $oldAutoCommit; - return "queueing job (transaction rolled back): $error"; - } - } - if ( $vpopdir ) { my $cpassword = crypt( $new->_password,$saltset[int(rand(64))].$saltset[int(rand(64))] @@ -914,65 +831,6 @@ sub replace { ''; #no error } -sub cp_rename { - my ( $old_username, $new_username ) = @_; - - my $app = new Net::APP ( $cp_server, - User => $cp_user, - Password => $cp_pass, - Domain => $mydomain, - Timeout => 60, - #Debug => 1, - ) or die "$@\n"; - - $app->rename_mailbox( - Domain => $mydomain, - Old_Mailbox => $old_username, - New_Mailbox => $new_username, - ); - - die $app->message."\n" unless $app->ok; - -} - -sub cp_change { - my ( $username, $password ) = @_; - - my $app = new Net::APP ( $cp_server, - User => $cp_user, - Password => $cp_pass, - Domain => $mydomain, - Timeout => 60, - #Debug => 1, - ) or die "$@\n"; - - if ( $password =~ /^\*SUSPENDED\* (.*)$/ ) { - $password = $1; - $app->set_mailbox_status( - Domain => $mydomain, - Mailbox => $username, - Other => 'T', - Other_Bounce => 'T', - ); - } else { - $app->set_mailbox_status( - Domain => $mydomain, - Mailbox => $username, - Other => 'F', - Other_Bounce => 'F', - ); - } - die $app->message."\n" unless $app->ok; - - $app->change_mailbox( - Domain => $mydomain, - Mailbox => $username, - Password => $password, - ); - die $app->message."\n" unless $app->ok; - -} - sub vpopmail_replace_password { my( $username, $password, $domain ) = @_; diff --git a/FS/bin/freeside-overdue b/FS/bin/freeside-overdue index db99e62b4..116245f9c 100755 --- a/FS/bin/freeside-overdue +++ b/FS/bin/freeside-overdue @@ -129,6 +129,9 @@ freeside-overdue - Perform actions on overdue and/or expired accounts. =head1 DESCRIPTION +This script is deprecated in 1.4.0. You should use freeside-daily and invoice +events instead. + Performs actions on overdue and/or expired accounts. Selection options (at least one selection option is required): diff --git a/bin/sqlradius_reset b/FS/bin/freeside-sqlradius-reset old mode 100644 new mode 100755 similarity index 75% rename from bin/sqlradius_reset rename to FS/bin/freeside-sqlradius-reset index 454043f54..132be754a --- a/bin/sqlradius_reset +++ b/FS/bin/freeside-sqlradius-reset @@ -48,4 +48,26 @@ sub usage { die "Usage:\n\n sqlradius_reset user\n"; } +=head1 NAME + +freeside-sqlradius-reset - Command line interface to reset and recreate RADIUS SQL tables + +=head1 SYNOPSIS + + freeside-sqlradius-reset username + +=head1 DESCRIPTION + +Deletes the radcheck, radreply and usergroup tables and repopulates them from +the Freeside database, for all sqlradius exports. + +B is a username added by freeside-adduser. + +=head1 SEE ALSO + +, L + +=cut + + diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi index 77b80d06f..b72b277c9 100644 --- a/httemplate/edit/part_export.cgi +++ b/httemplate/edit/part_export.cgi @@ -39,12 +39,17 @@ my $widget = new HTML::Widgets::SelectLayers( my $layer = shift; my $html = qq!!. ntable("#cccccc",2); + + $html .= 'Description'. + $exports->{$layer}{notes}. '' + if $layer; + foreach my $option ( keys %{$exports->{$layer}{options}} ) { # foreach my $option ( qw(url login password groupID ) ) { my $optinfo = $exports->{$layer}{options}{$option}; my $label = $optinfo->{label}; my $value = $cgi->param($option) || $part_export->option($option); - $html .= qq!$label!. + $html .= qq!$label!. qq!!. ''; } -- 2.11.0