beginning of DNS and Apache support
authorivan <ivan>
Thu, 3 Feb 2000 05:17:39 +0000 (05:17 +0000)
committerivan <ivan>
Thu, 3 Feb 2000 05:17:39 +0000 (05:17 +0000)
12 files changed:
FS/FS/cust_pkg.pm
FS/FS/domain_record.pm [new file with mode: 0644]
FS/FS/svc_domain.pm
FS/FS/svc_www.pm [new file with mode: 0644]
bin/fs-setup
bin/svc_acct.import
bin/svc_acct_sm.import
bin/svc_domain.import [new file with mode: 0644]
htdocs/docs/config.html
htdocs/docs/install.html
htdocs/docs/schema.html
htdocs/docs/upgrade5.html

index 1dcdab8..08be4e4 100644 (file)
@@ -16,6 +16,7 @@ use FS::pkg_svc;
 use FS::svc_acct;
 use FS::svc_acct_sm;
 use FS::svc_domain;
+use FS::svc_www;
 
 @ISA = qw( FS::Record );
 
@@ -490,7 +491,7 @@ sub order {
 
 =head1 VERSION
 
-$Id: cust_pkg.pm,v 1.3 1999-11-08 21:38:38 ivan Exp $
+$Id: cust_pkg.pm,v 1.4 2000-02-03 05:16:52 ivan Exp $
 
 =head1 BUGS
 
diff --git a/FS/FS/domain_record.pm b/FS/FS/domain_record.pm
new file mode 100644 (file)
index 0000000..9b7081b
--- /dev/null
@@ -0,0 +1,182 @@
+package FS::domain_record;
+
+use strict;
+use vars qw( @ISA );
+#use FS::Record qw( qsearch qsearchs );
+use FS::Record qw( qsearchs );
+use FS::svc_domain;
+
+@ISA = qw(FS::Record);
+
+=head1 NAME
+
+FS::domain_record - Object methods for domain_record records
+
+=head1 SYNOPSIS
+
+  use FS::domain_record;
+
+  $record = new FS::domain_record \%hash;
+  $record = new FS::domain_record { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+
+=head1 DESCRIPTION
+
+An FS::domain_record object represents an entry in a DNS zone.
+FS::domain_record inherits from FS::Record.  The following fields are currently
+supported:
+
+=over 4
+
+=item recnum - primary key
+
+=item svcnum - Domain (see L<FS::svc_domain>) of this entry
+
+=item reczone - partial (or full) zone for this entry
+
+=item recaf - address family for this entry, currently only `IN' is recognized.
+
+=item rectype - record type for this entry (A, MX, etc.)
+
+=item recdata - data for this entry
+
+=back
+
+=head1 METHODS
+
+=over 4
+
+=item new HASHREF
+
+Creates a new entry.  To add the example to the database, see L<"insert">.
+
+Note that this stores the hash reference, not a distinct copy of the hash it
+points to.  You can ask the object for a copy with the I<hash> method.
+
+=cut
+
+sub table { 'domain_record'; }
+
+=item insert
+
+Adds this record to the database.  If there is an error, returns the error,
+otherwise returns false.
+
+=cut
+
+=item delete
+
+Delete this record from the database.
+
+=cut
+
+=item replace OLD_RECORD
+
+Replaces the OLD_RECORD with this one in the database.  If there is an error,
+returns the error, otherwise returns false.
+
+=cut
+
+=item check
+
+Checks all fields to make sure this is a valid example.  If there is
+an error, returns the error, otherwise returns false.  Called by the insert
+and replace methods.
+
+=cut
+
+# the check method should currently be supplied - FS::Record contains some
+# data checking routines
+
+sub check {
+  my $self = shift;
+
+  my $error = 
+    $self->ut_numbern('recnum')
+    || $self->ut_number('svcnum')
+  ;
+  return $error if $error;
+
+  return "Unknown svcnum (in svc_domain)"
+    unless qsearchs('svc_domain', { 'svcnum' => $self->svcnum } );
+
+  $self->reczone =~ /^(@|[a-z0-9\.\-]+)$/
+    or return "Illegal reczone: ". $self->reczone;
+  $self->reczone($1);
+
+  $self->recaf =~ /^(IN)$/ or return "Illegal recaf: ". $self->recaf;
+  $self->recaf($1);
+
+  $self->rectype =~ /^(SOA|NS|MX|A|PTR|CNAME)$/
+    or return "Illegal rectype (only SOA NS MX A PTR CNAME recognized): ".
+              $self->rectype;
+  $self->rectype($1);
+
+  if ( $self->rectype eq 'SOA' ) {
+    my $recdata = $self->recdata;
+    $recdata =~ s/\s+/ /g;
+    $recdata =~ /^([a-z0-9\.\-]+ [\w\-\+]+\.[a-z0-9\.\-]+ \( (\d+ ){5}\))$/
+      or return "Illegal data for SOA reocrd: $recdata";
+    $self->recdata($1);
+  } elsif ( $self->rectype eq 'NS' ) {
+    $self->recdata =~ /^([a-z0-9\.\-]+)$/
+      or return "Illegal data for NS record: ". $self->recdata;
+    $self->recdata($1);
+  } elsif ( $self->rectype eq 'MX' ) {
+    $self->recdata =~ /^(\d+)\s+([a-z0-9\.\-]+)$/
+      or return "Illegal data for MX record: ". $self->recdata;
+    $self->recdata("$1 $2");
+  } elsif ( $self->rectype eq 'A' ) {
+    $self->recdata =~ /^((\d{1,3}\.){3}\d{1,3})$/
+      or return "Illegal data for A record: ". $self->recdata;
+    $self->recdata($1);
+  } elsif ( $self->rectype eq 'PTR' ) {
+    $self->recdata =~ /^([a-z0-9\.\-]+)$/
+      or return "Illegal data for PTR record: ". $self->recdata;
+    $self->recdata($1);
+  } elsif ( $self->rectype eq 'CNAME' ) {
+    $self->recdata =~ /^([a-z0-9\.\-]+)$/
+      or return "Illegal data for CNAME record: ". $self->recdata;
+    $self->recdata($1);
+  } else {
+    die "ack!";
+  }
+
+  ''; #no error
+}
+
+=back
+
+=head1 VERSION
+
+$Id: domain_record.pm,v 1.1 2000-02-03 05:16:52 ivan Exp $
+
+=head1 BUGS
+
+The data validation doesn't check everything it could.  In particular,
+there is no protection against bad data that passes the regex, duplicate
+SOA records, forgetting the trailing `.', impossible IP addersses, etc.  Of
+course, it's still better than editing the zone files directly.  :)
+
+=head1 SEE ALSO
+
+L<FS::Record>, schema.html from the base documentation.
+
+=head1 HISTORY
+
+$Log: domain_record.pm,v $
+Revision 1.1  2000-02-03 05:16:52  ivan
+beginning of DNS and Apache support
+
+
+=cut
+
+1;
+
index f960de0..4d4db5a 100644 (file)
@@ -3,6 +3,8 @@ package FS::svc_domain;
 use strict;
 use vars qw( @ISA $whois_hack $conf $mydomain $smtpmachine
   $tech_contact $from $to @nameservers @nameserver_ips @template
+  @mxmachines @nsmachines $soadefaultttl $soaemail $soaexpire $soamachine
+  $soarefresh $soaretry
 );
 use Carp;
 use Mail::Internet;
@@ -16,6 +18,7 @@ use FS::cust_svc;
 use FS::svc_acct;
 use FS::cust_pkg;
 use FS::cust_main;
+use FS::domain_record;
 
 @ISA = qw( FS::svc_Common );
 
@@ -43,6 +46,15 @@ $FS::UID::callback{'FS::domain'} = sub {
   } @ns;
   @template = map { $_. "\n" } $conf->config("$internic/template");
 
+  @mxmachines    = $conf->config('mxmachines');
+  @nsmachines    = $conf->config('nsmachines');
+  $soadefaultttl = $conf->config('soadefaultttl');
+  $soaemail      = $conf->config('soaemail');
+  $soaexpire     = $conf->config('soaexpire');
+  $soamachine    = $conf->config('soamachine');
+  $soarefresh    = $conf->config('soarefresh');
+  $soaretry      = $conf->config('soaretry');
+
 };
 
 =head1 NAME
@@ -114,6 +126,19 @@ email address on this email.  Otherwise, the svc_acct records for this package
 (see L<FS::cust_pkg>) are searched.  If there is exactly one svc_acct record
 in the same package, it is automatically used.  Otherwise an error is returned.
 
+If any I<soamachine> configuration file exists, an SOA record is added to
+the domain_record table (see <FS::domain_record>).
+
+If any machines are defined in the I<nsmachines> configuration file, NS
+records are added to the domain_record table (see L<FS::domain_record>).
+
+If any machines are defined in the I<mxmachines> configuration file, MX
+records are added to the domain_record table (see L<FS::domain_record>).
+
+Any problems adding FS::domain_record records will emit warnings, but will
+not return errors from this method.  If your configuration files are correct
+you shouln't have any problems.
+
 =cut
 
 sub insert {
@@ -144,6 +169,47 @@ sub insert {
 
   $self->submit_internic unless $whois_hack;
 
+  if ( $soamachine ) {
+    my $soa = new FS::domain_record {
+      'svcnum'  => $self->svcnum,
+      'reczone' => '@',
+      'recaf'   => 'IN',
+      'rectype' => 'SOA',
+      'recdata' => "$soamachine $soaemail ( ". time2str("%Y%m%e", time). "00 ".
+                   "$soarefresh $soarety $soaexpire $soadefaultttl )"
+    };
+    $error = $soa->insert;
+    warn "WARNING: couldn't insert SOA record for new domain: $error" if $error;
+
+    foreach $nsmachine ( @nsmachines ) {
+      my $ns = new FS::domain_record {
+        'svcnum'  => $self->svcnum,
+        'reczone' => '@',
+        'recaf'   => 'IN',
+        'rectype' => 'NS',
+        'recdata' => $nsmachine,
+      };
+      my $error = $ns->insert;
+      warn "WARNING: couldn't insert NS record for new domain: $error"
+        if $error;
+    }
+
+    foreach $mxmachine ( @mxmachines ) {
+      my $mx = new FS::domain_record {
+        'svcnum'  => $self->svcnum,
+        'reczone' => '@',
+        'recaf'   => 'IN',
+        'rectype' => 'mx',
+        'recdata' => $mxmachine,
+      };
+      my $error = $mx->insert;
+      warn "WARNING: couldn't insert MX record for new domain: $error"
+        if $error;
+    }
+
+  }
+
+
   ''; #no error
 }
 
@@ -393,7 +459,7 @@ sub submit_internic {
 
 =head1 VERSION
 
-$Id: svc_domain.pm,v 1.4 2000-01-29 21:10:13 ivan Exp $
+$Id: svc_domain.pm,v 1.5 2000-02-03 05:16:52 ivan Exp $
 
 =head1 BUGS
 
diff --git a/FS/FS/svc_www.pm b/FS/FS/svc_www.pm
new file mode 100644 (file)
index 0000000..fc1419c
--- /dev/null
@@ -0,0 +1,242 @@
+package FS::svc_www;
+
+use strict;
+use vars qw(@ISA $conf $apacheroot $apachemachine $nossh_hack );
+#use FS::Record qw( qsearch qsearchs );
+use FS::Record qw( qsearchs );
+use FS::svc_Common;
+use FS::cust_svc;
+use FS::domain_record;
+use FS::svc_acct;
+use FS::SSH qw(ssh);
+
+@ISA = qw(svc_Common);
+
+#ask FS::UID to run this stuff for us later
+$FS::UID::callback{'FS::svc_www'} = sub { 
+  $conf = new FS::Conf;
+  $apacheroot = $conf->config('apacheroot');
+  $apachemachine = $conf->config('apachemachine');
+};
+
+=head1 NAME
+
+FS::svc_www - Object methods for svc_www records
+
+=head1 SYNOPSIS
+
+  use FS::svc_www;
+
+  $record = new FS::svc_www \%hash;
+  $record = new FS::svc_www { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+
+  $error = $record->suspend;
+
+  $error = $record->unsuspend;
+
+  $error = $record->cancel;
+
+=head1 DESCRIPTION
+
+An FS::svc_www object represents an web virtual host.  FS::svc_www inherits
+from FS::svc_Common.  The following fields are currently supported:
+
+=over 4
+
+=item svcnum - primary key
+
+=item recnum - DNS `A' record corresponding to this web virtual host. (see L<FS::domain_record))
+
+=item usersvc - account (see L<FS::svc_acct>) corresponding to this web virtual host.
+
+=back
+
+=head1 METHODS
+
+=over 4
+
+=item new HASHREF
+
+Creates a new web virtual host.  To add the record to the database, see
+L<"insert">.
+
+Note that this stores the hash reference, not a distinct copy of the hash it
+points to.  You can ask the object for a copy with the I<hash> method.
+
+=cut
+
+sub table { 'svc_www'; }
+
+=item insert
+
+Adds this record to the database.  If there is an error, returns the error,
+otherwise returns false.
+
+The additional fields pkgnum and svcpart (see L<FS::cust_svc>) should be 
+defined.  An FS::cust_svc record will be created and inserted.
+
+If the configuration values (see L<FS::Conf>) I<apachemachine>, and
+I<apacheroot> exist, the command:
+
+  mkdir $apacheroot/$zone;
+  chown $username $apacheroot/$zone;
+  ln -s $apacheroot/$zone $homedir/$zone
+
+I<$zone> is the DNS A record pointed to by I<recnum>
+I<$username> is the username pointed to by I<usersvc>
+I<$homedir> is that user's home directory
+
+is executed on I<apachemachine> via ssh.  This behaviour can be surpressed by
+setting $FS::svc_www::nossh_hack true.
+
+=cut
+
+sub insert {
+  my $self = shift;
+  my $error;
+
+  $error = $self->SUPER::insert;
+  return $error if $error;
+
+  my $domain_record = qsearchs('domain_record', { 'recnum' => $self->recnum } );    # or die ?
+  my $zone = $domain_record->reczone;
+    # or die ?
+  unless ( $zone =~ /\.$/ ) {
+    my $dom_svcnum = $domain_record->svcnum;
+    my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $dom_svcnum } );
+      # or die ?
+    $zone .= $svc_domain->domain;
+  }
+
+  my $svc_acct = qsearchs('svc_acct', { 'svcnum' => $self->usersvc } );
+    # or die ?
+  my $username = $svc_acct->username;
+    # or die ?
+  my $homedir = $svc_acct->dir;
+    # or die ?
+
+  if ( $apachemachine
+       && $apacheroot
+       && $zone
+       && $username
+       && $homedir
+       && ! $nossh_hack
+  ) {
+    ssh("root\@$apachemachine",
+        "mkdir $apacheroot/$zone; ".
+        "chown $username $apacheroot/$zone; ".
+        "ln -s $apacheroot/$zone $homedir/$zone"
+    );
+  }
+
+  '';
+}
+
+=item delete
+
+Delete this record from the database.
+
+=cut
+
+sub delete {
+  my $self = shift;
+  my $error;
+
+  $error = $self->SUPER::delete;
+  return $error if $error;
+
+  '';
+}
+
+=item replace OLD_RECORD
+
+Replaces the OLD_RECORD with this one in the database.  If there is an error,
+returns the error, otherwise returns false.
+
+=cut
+
+sub replace {
+  my ( $new, $old ) = ( shift, shift );
+  my $error;
+
+  $error = $new->SUPER::replace($old);
+  return $error if $error;
+
+  '';
+}
+
+=item suspend
+
+Called by the suspend method of FS::cust_pkg (see L<FS::cust_pkg>).
+
+=item unsuspend
+
+Called by the unsuspend method of FS::cust_pkg (see L<FS::cust_pkg>).
+
+=item cancel
+
+Called by the cancel method of FS::cust_pkg (see L<FS::cust_pkg>).
+
+=item check
+
+Checks all fields to make sure this is a valid example.  If there is
+an error, returns the error, otherwise returns false.  Called by the insert
+and repalce methods.
+
+=cut
+
+sub check {
+  my $self = shift;
+
+  my $x = $self->setfixed;
+  return $x unless ref($x);
+  my $part_svc = $x;
+
+  my $error =
+    $self->ut_numbern('svcnum')
+    || $self->ut_number('recnum')
+    || $self->ut_number('usersvc')
+  ;
+  return $error if $error;
+
+  return "Unknown recnum: ". $self->recnum
+    unless qsearchs('domain_record', { 'recnum' => $self->recnum } );
+
+  return "Unknown usersvc (svc_acct.svcnum): ". $self->usersvc
+    unless qsearchs('svc_acct', { 'svcnum' => $self->usersvc } );
+
+  ''; #no error
+}
+
+=back
+
+=head1 VERSION
+
+$Id: svc_www.pm,v 1.1 2000-02-03 05:16:52 ivan Exp $
+
+=head1 BUGS
+
+=head1 SEE ALSO
+
+L<FS::svc_Common>, L<FS::Record>, L<FS::domain_record>, L<FS::cust_svc>,
+L<FS::part_svc>, L<FS::cust_pkg>, schema.html from the base documentation.
+
+=head1 HISTORY
+
+$Log: svc_www.pm,v $
+Revision 1.1  2000-02-03 05:16:52  ivan
+beginning of DNS and Apache support
+
+
+=cut
+
+1;
+
index dcaccdf..b75058d 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -Tw
 #
-# $Id: fs-setup,v 1.22 2000-01-31 05:22:23 ivan Exp $
+# $Id: fs-setup,v 1.23 2000-02-03 05:16:52 ivan Exp $
 #
 # ivan@sisd.com 97-nov-8,9
 #
 # fix radius attributes ivan@sisd.com 98-sep-27
 #
 # $Log: fs-setup,v $
-# Revision 1.22  2000-01-31 05:22:23  ivan
+# Revision 1.23  2000-02-03 05:16:52  ivan
+# beginning of DNS and Apache support
+#
+# Revision 1.22  2000/01/31 05:22:23  ivan
 # prepaid "internet cards"
 #
 # Revision 1.21  2000/01/30 06:03:26  ivan
@@ -184,7 +187,7 @@ my($part_svc)=$dbdef->table('part_svc');
 #because of svc_acct_pop
 #foreach (grep /^svc_/, $dbdef->tables) { 
 #foreach (qw(svc_acct svc_acct_sm svc_charge svc_domain svc_wo)) {
-foreach (qw(svc_acct svc_acct_sm svc_domain)) {
+foreach (qw(svc_acct svc_acct_sm svc_domain svc_www)) {
   my($table)=$dbdef->table($_);
   my($col);
   foreach $col ( $table->columns ) {
@@ -653,6 +656,31 @@ sub tables_hash_hack {
       'index' => [ [] ],
     },
 
+    'domain_record' => {
+      'columns' => [
+        'recnum',    'int',     '',  '',
+        'svcnum',    'int',     '',  '',
+        'reczone',   'varchar', '',  $char_d,
+        'recaf',     'char',    '',  2,
+        'rectype',   'char',    '',  5,
+        'recdata',   'varchar', '',  $char_d,
+      ],
+      'primary_key' => 'recnum',
+      'unique'      => [ [] ],
+      'index'       => [ ['svcnum'] ],
+    },
+
+    'svc_www' => {
+      'columns' => [
+        'svcnum',   'int',    '',  '',
+        'recnum',   'int',    '',  '',
+        'usersvc',  'int',    '',  '',
+      ],
+      'primary_key' => 'svcnum',
+      'unique'      => [ [] ],
+      'index'       => [ [] ],
+    },
+
     #'svc_wo' => {
     #  'columns' => [
     #    'svcnum',    'int',    '',   '',
index 6541a9f..893a829 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -Tw
 #
-# $Id: svc_acct.import,v 1.7 1999-07-08 02:32:26 ivan Exp $
+# $Id: svc_acct.import,v 1.8 2000-02-03 05:16:52 ivan Exp $
 #
 # ivan@sisd.com 98-mar-9
 #
 # don't import /var/spool/freeside/conf/shells!  ivan@sisd.com 98-aug-13
 #
 # $Log: svc_acct.import,v $
-# Revision 1.7  1999-07-08 02:32:26  ivan
+# Revision 1.8  2000-02-03 05:16:52  ivan
+# beginning of DNS and Apache support
+#
+# Revision 1.7  1999/07/08 02:32:26  ivan
 # import fix, noticed by Ben Leibig and Joel Griffiths
 #
 # Revision 1.6  1999/07/08 01:49:00  ivan
@@ -263,6 +266,6 @@ foreach $username ( keys %upassword ) {
 #
 
 sub usage {
-  die "Usage:\n\n  svc_acct.export user\n";
+  die "Usage:\n\n  svc_acct.import user\n";
 }
 
index bda9762..50b0f67 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -Tw
 #
-# $Id: svc_acct_sm.import,v 1.4 1999-03-25 08:42:20 ivan Exp $
+# $Id: svc_acct_sm.import,v 1.5 2000-02-03 05:16:52 ivan Exp $
 #
 # ivan@sisd.com 98-mar-9
 #
 # ivan@sisd.com 98-jul-13
 #
 # $Log: svc_acct_sm.import,v $
-# Revision 1.4  1999-03-25 08:42:20  ivan
+# Revision 1.5  2000-02-03 05:16:52  ivan
+# beginning of DNS and Apache support
+#
+# Revision 1.4  1999/03/25 08:42:20  ivan
 # import stuff uses Term::Query and spits out (some kinds of) nonsensical input
 #
 # Revision 1.3  1999/03/24 00:51:55  ivan
@@ -278,6 +281,6 @@ END
 #
 
 sub usage {
-  die "Usage:\n\n  svc_acct_sm.export user\n";
+  die "Usage:\n\n  svc_acct_sm.import user\n";
 }
 
diff --git a/bin/svc_domain.import b/bin/svc_domain.import
new file mode 100644 (file)
index 0000000..329465c
--- /dev/null
@@ -0,0 +1,92 @@
+#!/usr/bin/perl -w
+#
+# $Id: svc_domain.import,v 1.1 2000-02-03 05:17:39 ivan Exp $
+
+use strict;
+use vars qw( %d_part_svc );
+use Term::Query qw(query);
+use FS::SSH qw(iscp);
+use FS::UID qw(adminsuidsetup datasrc);
+#use FS::Record qw(qsearch qsearchs);
+#use FS::svc_acct_sm;
+use FS::svc_domain;
+use FS::domain_record;
+#use FS::svc_acct;
+#use FS::part_svc;
+
+my $user = shift or die &usage;
+adminsuidsetup $user;
+
+my($spooldir)="/usr/local/etc/freeside/export.". datasrc;
+
+%d_part_svc =
+  map { $_->svcpart, $_ } qsearch('part_svc',{'svcdb'=>'svc_domain'});
+
+print "\n\n",
+      ( join "\n", map "$_: ".$d_part_svc{$_}->svc, sort keys %d_part_svc ),
+      "\n\n";
+$^W=0; #Term::Query isn't -w-safe
+my $domain_svcpart =
+  query "Enter part number for domains: ", 'irk', [ keys %d_part_svc ];
+$^W=1;
+
+  print "\n\n", <<END;
+Enter the location and name of your primary named.conf file, for example
+"ns.isp.com:/var/named/named.conf"
+END
+  my($named_conf)=&getvalue(":");
+  iscp("root\@$named_conf","$spooldir/named.conf.import");
+
+my $named_machine = (split(/:/, $named_conf))[0];
+
+print "\n\n";
+
+##
+
+$FS::svc_domain::whois_hack=1;
+
+open(NAMED_CONF,"<$spooldir/named.conf.import")
+  or die "Can't open $spooldir/named.conf.import: $!";
+
+while (<NAMED_CONF>) {
+  next unless /^\s*options/;
+}
+my $directory;
+while (<NAMED_CONF>) {
+  last if /^\s*directory\s+\"([\/\w+]+)\";/;
+} 
+$directory = $1 or die "can't locate directory in named.conf!";
+whlie (<NAMED_CONF>) {
+  next unless /^\s*zone\s+\"([\w\.\-]+)\"\s+\{/;
+  my $zone = $1;
+  while (<NAMED_CONF>) {
+    my $type;
+    if ( /^\s*type\s+(master|slave)\s*\;/ ) {
+      $type = $1;
+    }
+    if ( /^\s*file\s+\"([\w\.\-]+)\"\s*\;/ && $type eq 'master' ) {
+
+      #
+      # (add svc_domain)
+      my $file = $1;
+      iscp("root\@$named_machine:$directory/$file","$spooldir/$file.import");
+      open(ZONE,"<$spooldir/$file.import")
+        or die "Can't open $spooldir/$file.import: $!";
+      while (<ZONE>) {
+        # (add domain_record)
+      }
+
+      #
+
+    }
+    
+    last if /^\s*\}\s*\;/;
+  }
+}
+
+##
+
+sub usage {
+  die "Usage:\n\n  svc_domain.import user\n";
+}
+
index cad10ce..6f7a2b5 100644 (file)
@@ -22,6 +22,11 @@ All further configuration files and directories are located in
 `/usr/local/etc/freeside/conf.DBI:Pg:dbname=freeside'
 <ul>
   <li>address - Your company name and address, four lines.
+  <li>apacheroot - The directory containing Apache virtual hosts
+  <li>apachemachine - A machine with the apacheroot directory and user home directories.  The existance of this file enables setup of virtual host directories, and, in conjunction with the `home' configuration file, symlinks into user home directories.
+  <li>apachemachines - Your Apache machines, one per line.  This enables export of `/etc/apache/vhosts.conf', which can be included in your Apache configuration via the <a href="http://www.apache.org/docs/mod/core.html#include">Include</a> directive.
+  <li>bindprimary - Your BIND primary nameserver.  This enables export of /var/named/named.conf and zone files into /var/named
+  <li>bindsecondaries - Your BIND secondary nameservers, one per line.  This enables export of /var/named/named.conf
   <li>bsdshellmachines - Your BSD flavored shell (and mail) machines, one per line.  This enables export of `/etc/passwd' and `/etc/master.passwd'.
   <li>cybercash2 - <a href="http://www.cybercash.com/cybercash/services/cashreg214.html">CyberCash v2</a> support, four lines: paymentserverhost, paymentserverport, paymentserversecret, and transaction type (`mauthonly' or `mauthcapture').  CCLib.pm is required.
   <li>cybercash3.2 - <a href="http://www.cybercash.com/cybercash/services/technology.html">CyberCash v3.2</a> support.  Two lines: the full path and name of your merchant_conf file, and the transaction type (`mauthonly' or `mauthcapture').  CCMckLib3_2.pm, CCMckDirectLib3_2.pm and CCMckErrno3_2 are required.
@@ -34,6 +39,8 @@ All further configuration files and directories are located in
   <li>home - For new users, prefixed to usrename to create a directory name.  Should have a leading but not a trailing slash.
   <li>invoice_from - Return address on email invoices.
   <li>lpr - Print command for paper invoices, for example `lpr -h'.
+  <li>mxmachines - MX entries for new domains, weight and machine, one per line, with trailing `.'
+  <li>nsmachines - NS nameservers for new domains, one per line, with trailing `.'
   <li>nismachines - Your NIS master (not slave master) machines, one per line.  This enables export of `/etc/global/passwd' and `/etc/global/shadow'.
   <li>passwordmin - Minimum password length (default 6);
   <li>qmailmachines - Your qmail machines, one per line.  This enables export of `/var/qmail/control/virtualdomains', `/var/qmail/control/recipientmap', and `/var/qmail/control/rcpthosts'.  The existance of this file (even if empty) also turns on user `.qmail-extension' file maintenance in conjunction with `shellmachine'.
@@ -55,6 +62,12 @@ All further configuration files and directories are located in
   <li>shells - Legal shells (think /etc/shells).  You probably want to `cut -d: -f7 /etc/passwd | sort | uniq' initially so that importing doesn't fail with `Illegal shell' errors, then remove any special entries afterwords.  A blank line specifies that an empty shell is permitted.
   <li>showpasswords - The existance of this file will allow unencrypted user passwords to be displayed.
   <li>smtpmachine - SMTP relay for Freeside's outgoing mail.
+  <li>soadefaultttl - SOA default TTL for new domains.
+  <li>soaemail - SOA email for new domains, in BIND form (`.' instead of `@'), with trailing `.'
+  <li>soaexpire - SOA expire for new domains
+  <li>soamachine - SOA machine for new domains, with trailing `.'
+  <li>soarefresh - SOA refresh for new domains
+  <li>soaretry - SOA retry for new domains
   <li>usernamemin - Minimum username length (default 2);
   <li>usernamemax - Maximum username length (default is the size of the SQL column, probably specified when fs-setup was run)
 </ul>
index 574ab91..bb621e9 100644 (file)
@@ -12,7 +12,7 @@ Before installing, you need:
   <li>Perl modules (<a href="http://www.perl.com/CPAN/doc/manual/html/lib/CPAN.html">CPAN</a> will query, download and build perl modules automatically)
     <ul>
       <li><a href="http://www.perl.com/CPAN/modules/by-module/Array/">Array-PrintCols</a>
-      <li><a href="http://www.perl.com/CPAN/modules/by-module/Term/">Term-Query</a>
+      <li><a href="http://www.perl.com/CPAN/modules/by-module/Term/">Term-Query</a> (make test broken; install manually)
       <li><a href="http://www.perl.com/CPAN/modules/by-module/MIME/">MIME-Base64</a>
       <li><a href="http://www.perl.com/CPAN/modules/by-module/Data">Data-Dumper</a>
       <li><a href="http://www.perl.com/CPAN/modules/by-module/MD5">Digest-MD5</a>
index 3eea6f6..1ab0e7f 100644 (file)
         <li>svcnum - <a href="#cust_svc">primary key</a>
         <li>domain
       </ul>
+    <li><a name="domain_record">domain_record</a> - Domain zone detail
+      <ul>
+        <li>recnum - primary key
+        <li>svcnum - <a href="#svc_domain">Domain</a> (by svcnum)
+        <li>reczone - zone for this line
+        <li>recaf - address family, usually <b>IN</b>
+        <li>rectype - type for this record (<b>A</b>, <b>MX</b>, etc.)
+        <li>recdata - data for this record
+      </ul>
+    <li><a name="svc_www">svc_www</a>
+       <li>svcnum - <a href="#cust-svc">primary key</a>
+       <li>recnum - <a href="#domain_record">host</a>
+       <li>usersvc - <a href="#svc_acct">account</a>
+     </ul>
     <li><a name="type_pkgs">type_pkgs</a>
       <ul>
         <li>typenum - <a href="#agent_type">agent type</a>
index fc4bf2c..2be3c6e 100644 (file)
@@ -19,6 +19,28 @@ CREATE TABLE prepay_credit (
   PRIMARY KEY (prepaynum),
   INDEX (identifier)
 );
+CREATE TABLE domain_record (
+  recnum int NOT NULL,
+  svcnum int NOT NULL,
+  reczone varchar(80) NOT NULL,
+  recaf char(2) NOT NULL,
+  rectype char(5) NOT NULL,
+  recdata varchar(80) NOT NULL,
+  PRIMARY KEY (recnum)
+);
+CREATE TABLE svc_www (
+  svcnum int NOT NULL,
+  recnum int NOT NULL,
+  usersvc int NOT NULL,
+  PRIMARY KEY (svcnum)
+);
+ALTER TABLE part_svc ADD svc_www__svcnum varchar(80) NULL;
+ALTER TABLE part_svc ADD svc_www__svcnum_flag char(1) NULL;
+ALTER TABLE part_svc ADD svc_www__recnum varchar(80) NULL;
+ALTER TABLE part_svc ADD svc_www__recnum_flag char(1) NULL;
+ALTER TABLE part_svc ADD svc_www__usersvc varchar(80) NULL;
+ALTER TABLE part_svc ADD svc_www__uesrsvc_flag char(1) NULL;
+
 </pre>
   <li>Copy or symlink htdocs to the new copy.
   <li>Remove the symlink or directory <i>(your_site_perl_directory)</i>/FS.