e50cb29b9d428228ea2cbe731bbe3d5c555420c8
[freeside.git] / FS / FS / Conf.pm
1 package FS::Conf;
2
3 use vars qw($default_dir @config_items $DEBUG );
4 use IO::File;
5 use File::Basename;
6 use FS::ConfItem;
7
8 $DEBUG = 0;
9
10 =head1 NAME
11
12 FS::Conf - Freeside configuration values
13
14 =head1 SYNOPSIS
15
16   use FS::Conf;
17
18   $conf = new FS::Conf "/config/directory";
19
20   $FS::Conf::default_dir = "/config/directory";
21   $conf = new FS::Conf;
22
23   $dir = $conf->dir;
24
25   $value = $conf->config('key');
26   @list  = $conf->config('key');
27   $bool  = $conf->exists('key');
28
29   $conf->touch('key');
30   $conf->set('key' => 'value');
31   $conf->delete('key');
32
33   @config_items = $conf->config_items;
34
35 =head1 DESCRIPTION
36
37 Read and write Freeside configuration values.  Keys currently map to filenames,
38 but this may change in the future.
39
40 =head1 METHODS
41
42 =over 4
43
44 =item new [ DIRECTORY ]
45
46 Create a new configuration object.  A directory arguement is required if
47 $FS::Conf::default_dir has not been set.
48
49 =cut
50
51 sub new {
52   my($proto,$dir) = @_;
53   my($class) = ref($proto) || $proto;
54   my($self) = { 'dir' => $dir || $default_dir } ;
55   bless ($self, $class);
56 }
57
58 =item dir
59
60 Returns the directory.
61
62 =cut
63
64 sub dir {
65   my($self) = @_;
66   my $dir = $self->{dir};
67   -e $dir or die "FATAL: $dir doesn't exist!";
68   -d $dir or die "FATAL: $dir isn't a directory!";
69   -r $dir or die "FATAL: Can't read $dir!";
70   -x $dir or die "FATAL: $dir not searchable (executable)!";
71   $dir =~ /^(.*)$/;
72   $1;
73 }
74
75 =item config KEY
76
77 Returns the configuration value or values (depending on context) for key.
78
79 =cut
80
81 sub config {
82   my($self,$file)=@_;
83   my($dir)=$self->dir;
84   my $fh = new IO::File "<$dir/$file" or return;
85   if ( wantarray ) {
86     map {
87       /^(.*)$/
88         or die "Illegal line (array context) in $dir/$file:\n$_\n";
89       $1;
90     } <$fh>;
91   } else {
92     <$fh> =~ /^(.*)$/
93       or die "Illegal line (scalar context) in $dir/$file:\n$_\n";
94     $1;
95   }
96 }
97
98 =item exists KEY
99
100 Returns true if the specified key exists, even if the corresponding value
101 is undefined.
102
103 =cut
104
105 sub exists {
106   my($self,$file)=@_;
107   my($dir) = $self->dir;
108   -e "$dir/$file";
109 }
110
111 =item touch KEY
112
113 Creates the specified configuration key if it does not exist.
114
115 =cut
116
117 sub touch {
118   my($self, $file) = @_;
119   my $dir = $self->dir;
120   unless ( $self->exists($file) ) {
121     warn "[FS::Conf] TOUCH $file\n" if $DEBUG;
122     system('touch', "$dir/$file");
123   }
124 }
125
126 =item set KEY VALUE
127
128 Sets the specified configuration key to the given value.
129
130 =cut
131
132 sub set {
133   my($self, $file, $value) = @_;
134   my $dir = $self->dir;
135   $value =~ /^(.*)$/s;
136   $value = $1;
137   unless ( join("\n", @{[ $self->config($file) ]}) eq $value ) {
138     warn "[FS::Conf] SET $file\n" if $DEBUG;
139 #    warn "$dir" if is_tainted($dir);
140 #    warn "$dir" if is_tainted($file);
141     chmod 0644, "$dir/$file";
142     my $fh = new IO::File ">$dir/$file" or return;
143     chmod 0644, "$dir/$file";
144     print $fh "$value\n";
145   }
146 }
147 #sub is_tainted {
148 #             return ! eval { join('',@_), kill 0; 1; };
149 #         }
150
151 =item delete KEY
152
153 Deletes the specified configuration key.
154
155 =cut
156
157 sub delete {
158   my($self, $file) = @_;
159   my $dir = $self->dir;
160   if ( $self->exists($file) ) {
161     warn "[FS::Conf] DELETE $file\n";
162     unlink "$dir/$file";
163   }
164 }
165
166 =item config_items
167
168 Returns all of the possible configuration items as FS::ConfItem objects.  See
169 L<FS::ConfItem>.
170
171 =cut
172
173 sub config_items {
174   my $self = shift; 
175   #quelle kludge
176   @config_items,
177   map { 
178         my $basename = basename($_);
179         $basename =~ /^(.*)$/;
180         $basename = $1;
181         new FS::ConfItem {
182                            'key'         => $basename,
183                            'section'     => 'billing',
184                            'description' => 'Alternate template file for invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
185                            'type'        => 'textarea',
186                          }
187       } glob($self->dir. '/invoice_template_*')
188   ;
189 }
190
191 =back
192
193 =head1 BUGS
194
195 If this was more than just crud that will never be useful outside Freeside I'd
196 worry that config_items is freeside-specific and icky.
197
198 =head1 SEE ALSO
199
200 "Configuration" in the web interface (config/config.cgi).
201
202 httemplate/docs/config.html
203
204 =cut
205
206 @config_items = map { new FS::ConfItem $_ } (
207
208   {
209     'key'         => 'address',
210     'section'     => 'deprecated',
211     'description' => 'This configuration option is no longer used.  See <a href="#invoice_template">invoice_template</a> instead.',
212     'type'        => 'text',
213   },
214
215   {
216     'key'         => 'alerter_template',
217     'section'     => 'billing',
218     'description' => 'Template file for billing method expiration alerts.  See the <a href="../docs/billing.html#invoice_template">billing documentation</a> for details.',
219     'type'        => 'textarea',
220   },
221
222   {
223     'key'         => 'apacheroot',
224     'section'     => 'deprecated',
225     'description' => '<b>DEPRECATED</b>, add a <i>www_shellcommands</i> <a href="../browse/part_export.cgi">export</a> instead.  The directory containing Apache virtual hosts',
226     'type'        => 'text',
227   },
228
229   {
230     'key'         => 'apacheip',
231     'section'     => 'apache',
232     'description' => 'The current IP address to assign to new virtual hosts',
233     'type'        => 'text',
234   },
235
236   {
237     'key'         => 'apachemachine',
238     'section'     => 'deprecated',
239     'description' => '<b>DEPRECATED</b>, add a <i>www_shellcommands</i> <a href="../browse/part_export.cgi">export</a> instead.  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.',
240     'type'        => 'text',
241   },
242
243   {
244     'key'         => 'apachemachines',
245     'section'     => 'apache',
246     'description' => '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.',
247     'type'        => 'textarea',
248   },
249
250   {
251     'key'         => 'bindprimary',
252     'section'     => 'deprecated',
253     'description' => '<b>DEPRECATED</b>, add a <i>bind</i> <a href="../browse/part_export.cgi">export</a> instead.  Your BIND primary nameserver.  This enables export of /var/named/named.conf and zone files into /var/named',
254     'type'        => 'text',
255   },
256
257   {
258     'key'         => 'bindsecondaries',
259     'section'     => 'deprecated',
260     'description' => '<b>DEPRECATED</b>, add a <i>bind_slave</i> <a href="../browse/part_export.cgi">export</a> instead.  Your BIND secondary nameservers, one per line.  This enables export of /var/named/named.conf',
261     'type'        => 'textarea',
262   },
263
264   {
265     'key'         => 'business-onlinepayment',
266     'section'     => 'billing',
267     'description' => '<a href="http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment">Business::OnlinePayment</a> support, at least three lines: processor, login, and password.  An optional fourth line specifies the action or actions (multiple actions are separated with `,\': for example: `Authorization Only, Post Authorization\').    Optional additional lines are passed to Business::OnlinePayment as %processor_options.',
268     'type'        => 'textarea',
269   },
270
271   {
272     'key'         => 'business-onlinepayment-description',
273     'section'     => 'billing',
274     'description' => 'String passed as the description field to <a href="http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment">Business::OnlinePayment</a>.  Evaluated as a double-quoted perl string, with the following variables available: <code>$agent</code> (the agent name), and <code>$pkgs</code> (a comma-separated list of packages to which the invoiced being charged applies)',
275     'type'        => 'text',
276   },
277
278   {
279     'key'         => 'bsdshellmachines',
280     'section'     => 'deprecated',
281     'description' => '<b>DEPRECATED</b>, add a <i>bsdshell</i> <a href="../browse/part_export.cgi">export</a> instead.  Your BSD flavored shell (and mail) machines, one per line.  This enables export of `/etc/passwd\' and `/etc/master.passwd\'.',
282     'type'        => 'textarea',
283   },
284
285   {
286     'key'         => 'countrydefault',
287     'section'     => 'UI',
288     'description' => 'Default two-letter country code (if not supplied, the default is `US\')',
289     'type'        => 'text',
290   },
291
292   {
293     'key'         => 'cybercash3.2',
294     'section'     => 'billing',
295     'description' => '<a href="http://www.cybercash.com/cashregister/">CyberCash Cashregister v3.2</a> support.  Two lines: the full path and name of your merchant_conf file, and the transaction type (`mauthonly\' or `mauthcapture\').',
296     'type'        => 'textarea',
297   },
298
299   {
300     'key'         => 'cyrus',
301     'section'     => 'deprecated',
302     'description' => '<b>DEPRECATED</b>, add a <i>cyrus</i> <a href="../browse/part_export.cgi">export</a> instead.  This option used to integrate with <a href="http://asg.web.cmu.edu/cyrus/imapd/">Cyrus IMAP Server</a>, three lines: IMAP server, admin username, and admin password.  Cyrus::IMAP::Admin should be installed locally and the connection to the server secured.',
303     'type'        => 'textarea',
304   },
305
306   {
307     'key'         => 'cp_app',
308     'section'     => 'deprecated',
309     'description' => '<b>DEPRECATED</b>, add a <i>cp</i> <a href="../browse/part_export.cgi">export</a> instead.  This option used to integrate with <a href="http://www.cp.net/">Critial Path Account Provisioning Protocol</a>, four lines: "host:port", username, password, and workgroup (for new users).',
310     'type'        => 'textarea',
311   },
312
313   {
314     'key'         => 'deletecustomers',
315     'section'     => 'UI',
316     'description' => 'Enable customer deletions.  Be very careful!  Deleting a customer will remove all traces that this customer ever existed!  It should probably only be used when auditing a legacy database.  Normally, you cancel all of a customers\' packages if they cancel service.',
317     'type'        => 'checkbox',
318   },
319
320   {
321     'key'         => 'deletepayments',
322     'section'     => 'UI',
323     'description' => 'Enable deletion of unclosed payments.  Be very careful!  Only delete payments that were data-entry errors, not adjustments. Optionally specify one or more comma-separated email addresses to be notified when a payment is deleted.',
324     'type'        => [qw( checkbox text )],
325   },
326
327   {
328     'key'         => 'dirhash',
329     'section'     => 'shell',
330     'description' => 'Optional numeric value to control directory hashing.  If positive, hashes directories for the specified number of levels from the front of the username.  If negative, hashes directories for the specified number of levels from the end of the username.  Some examples: <ul><li>1: user -> <a href="#home">/home</a>/u/user<li>2: user -> <a href="#home">/home</a>/u/s/user<li>-1: user -> <a href="#home">/home</a>/r/user<li>-2: user -> <a href="#home">home</a>/r/e/user</ul>',
331     'type'        => 'text',
332   },
333
334   {
335     'key'         => 'disable_customer_referrals',
336     'section'     => 'UI',
337     'description' => 'Disable new customer-to-customer referrals in the web interface',
338     'type'        => 'checkbox',
339   },
340
341   {
342     'key'         => 'domain',
343     'section'     => 'deprecated',
344     'description' => 'Your domain name.',
345     'type'        => 'text',
346   },
347
348   {
349     'key'         => 'editreferrals',
350     'section'     => 'UI',
351     'description' => 'Enable advertising source modification for existing customers',
352     'type'       => 'checkbox',
353   },
354
355   {
356     'key'         => 'emailinvoiceonly',
357     'section'     => 'billing',
358     'description' => 'Disables postal mail invoices',
359     'type'       => 'checkbox',
360   },
361
362   {
363     'key'         => 'disablepostalinvoicedefault',
364     'section'     => 'billing',
365     'description' => 'Disables postal mail invoices as the default option in the UI.  Be careful not to setup customers which are not sent invoices.  See <a href ="#emailinvoiceauto">emailinvoiceauto</a>.',
366     'type'       => 'checkbox',
367   },
368
369   {
370     'key'         => 'emailinvoiceauto',
371     'section'     => 'billing',
372     'description' => 'Automatically adds new accounts to the email invoice list',
373     'type'       => 'checkbox',
374   },
375
376   {
377     'key'         => 'erpcdmachines',
378     'section'     => '',
379     'description' => 'Your ERPCD authenticaion machines, one per line.  This enables export of `/usr/annex/acp_passwd\' and `/usr/annex/acp_dialup\'',
380     'type'        => 'textarea',
381   },
382
383   {
384     'key'         => 'hidecancelledpackages',
385     'section'     => 'UI',
386     'description' => 'Prevent cancelled packages from showing up in listings (though they will still be in the database)',
387     'type'        => 'checkbox',
388   },
389
390   {
391     'key'         => 'hidecancelledcustomers',
392     'section'     => 'UI',
393     'description' => 'Prevent customers with only cancelled packages from showing up in listings (though they will still be in the database)',
394     'type'        => 'checkbox',
395   },
396
397   {
398     'key'         => 'home',
399     'section'     => 'required',
400     'description' => 'For new users, prefixed to username to create a directory name.  Should have a leading but not a trailing slash.',
401     'type'        => 'text',
402   },
403
404   {
405     'key'         => 'icradiusmachines',
406     'section'     => 'deprecated',
407     'description' => '<b>DEPRECATED</b>, add an <i>sqlradius</i> <a href="../browse/part_export.cgi">export</a> instead.  This option used to enable radcheck and radreply table population - by default in the Freeside database, or in the database specified by the <a href="http://rootwood.haze.st/aspside/config/config-view.cgi#icradius_secrets">icradius_secrets</a> 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.  <blockquote><b>ADDITIONAL DEPRECATED FUNCTIONALITY</b> (instead use <a href="http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Database_Administration.html#Replication">MySQL replication</a> or point icradius_secrets to the external database) - your <a href="ftp://ftp.cheapnet.net/pub/icradius">ICRADIUS</a> machines or <a href="http://www.freeradius.org/">FreeRADIUS</a> (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: <CODE>"radius.isp.tld&nbsp;radius_db&nbsp;radius_user&nbsp;passw0rd"</CODE></blockquote>',
408     'type'        => [qw( checkbox textarea )],
409   },
410
411   {
412     'key'         => 'icradius_mysqldest',
413     'section'     => 'deprecated',
414     'description' => '<b>DEPRECATED</b>, add an <i>sqlradius</i> https://billing.crosswind.net/freeside/browse/part_export.cgi">export</a> instead.  Used to be the destination directory for the MySQL databases, on the ICRADIUS/FreeRADIUS machines.  Defaults to "/usr/local/var/".',
415     'type'        => 'text',
416   },
417
418   {
419     'key'         => 'icradius_mysqlsource',
420     'section'     => 'deprecated',
421     'description' => '<b>DEPRECATED</b>, add an <i>sqlradius</i> https://billing.crosswind.net/freeside/browse/part_export.cgi">export</a> instead.  Used to be the source directory for for the MySQL radcheck table files, on the Freeside machine.  Defaults to "/usr/local/var/freeside".',
422     'type'        => 'text',
423   },
424
425   {
426     'key'         => 'icradius_secrets',
427     'section'     => 'deprecated',
428     'description' => '<b>DEPRECATED</b>, add an <i>sqlradius</i> https://billing.crosswind.net/freeside/browse/part_export.cgi">export</a> instead.  This option used to specify a database for ICRADIUS/FreeRADIUS export.  Three lines: DBI data source, username and password.',
429     'type'        => 'textarea',
430   },
431
432   {
433     'key'         => 'invoice_from',
434     'section'     => 'required',
435     'description' => 'Return address on email invoices',
436     'type'        => 'text',
437   },
438
439   {
440     'key'         => 'invoice_template',
441     'section'     => 'required',
442     'description' => 'Required template file for invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
443     'type'        => 'textarea',
444   },
445
446   {
447     'key'         => 'lpr',
448     'section'     => 'required',
449     'description' => 'Print command for paper invoices, for example `lpr -h\'',
450     'type'        => 'text',
451   },
452
453   {
454     'key'         => 'maildisablecatchall',
455     'section'     => 'deprecated',
456     'description' => '<b>DEPRECATED</b>, now the default.  Turning this option on used to disable the requirement that each virtual domain have a catch-all mailbox.',
457     'type'        => 'checkbox',
458   },
459
460   {
461     'key'         => 'money_char',
462     'section'     => '',
463     'description' => 'Currency symbol - defaults to `$\'',
464     'type'        => 'text',
465   },
466
467   {
468     'key'         => 'mxmachines',
469     'section'     => 'deprecated',
470     'description' => 'MX entries for new domains, weight and machine, one per line, with trailing `.\'',
471     'type'        => 'textarea',
472   },
473
474   {
475     'key'         => 'nsmachines',
476     'section'     => 'deprecated',
477     'description' => 'NS nameservers for new domains, one per line, with trailing `.\'',
478     'type'        => 'textarea',
479   },
480
481   {
482     'key'         => 'defaultrecords',
483     'section'     => 'BIND',
484     'description' => 'DNS entries to add automatically when creating a domain',
485     'type'        => 'editlist',
486     'editlist_parts' => [ { type=>'text' },
487                           { type=>'immutable', value=>'IN' },
488                           { type=>'select',
489                             select_enum=>{ map { $_=>$_ } qw(A CNAME MX NS)} },
490                           { type=> 'text' }, ],
491   },
492
493   {
494     'key'         => 'arecords',
495     'section'     => 'deprecated',
496     'description' => 'A list of tab seperated CNAME records to add automatically when creating a domain',
497     'type'        => 'textarea',
498   },
499
500   {
501     'key'         => 'cnamerecords',
502     'section'     => 'deprecated',
503     'description' => 'A list of tab seperated CNAME records to add automatically when creating a domain',
504     'type'        => 'textarea',
505   },
506
507   {
508     'key'         => 'nismachines',
509     'section'     => 'deprecated',
510     'description' => '<b>DEPRECATED</b>.  Your NIS master (not slave master) machines, one per line.  This enables export of `/etc/global/passwd\' and `/etc/global/shadow\'.',
511     'type'        => 'textarea',
512   },
513
514   {
515     'key'         => 'passwordmin',
516     'section'     => 'password',
517     'description' => 'Minimum password length (default 6)',
518     'type'        => 'text',
519   },
520
521   {
522     'key'         => 'passwordmax',
523     'section'     => 'password',
524     'description' => 'Maximum password length (default 8) (don\'t set this over 12 if you need to import or export crypt() passwords)',
525     'type'        => 'text',
526   },
527
528   {
529     'key'         => 'qmailmachines',
530     'section'     => 'mail',
531     'description' => 'Your qmail machines, one per line.  This enables export of `/var/qmail/control/virtualdomains\', `/var/qmail/control/recipientmap\', and `/var/qmail/control/rcpthosts\'.  Setting this option (even if empty) also turns on user `.qmail-extension\' file maintenance in conjunction with the <b>shellmachine</b> option.',
532     'type'        => [qw( checkbox textarea )],
533   },
534
535   {
536     'key'         => 'radiusmachines',
537     'section'     => 'deprecated',
538     'description' => '<b>DEPRECATED</b>, add an <i>sqlradius</i> <a href="../browse/part_export.cgi">export</a> instead.  This option used to export to be: your RADIUS authentication machines, one per line.  This enables export of `/etc/raddb/users\'.',
539     'type'        => 'textarea',
540   },
541
542   {
543     'key'         => 'referraldefault',
544     'section'     => 'UI',
545     'description' => 'Default referral, specified by refnum',
546     'type'        => 'text',
547   },
548
549 #  {
550 #    'key'         => 'registries',
551 #    'section'     => 'required',
552 #    'description' => 'Directory which contains domain registry information.  Each registry is a directory.',
553 #  },
554
555   {
556     'key'         => 'report_template',
557     'section'     => 'required',
558     'description' => 'Required template file for reports.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
559     'type'        => 'textarea',
560   },
561
562
563   {
564     'key'         => 'maxsearchrecordsperpage',
565     'section'     => 'UI',
566     'description' => 'If set, number of search records to return per page.',
567     'type'        => 'text',
568   },
569
570   {
571     'key'         => 'sendmailconfigpath',
572     'section'     => 'mail',
573     'description' => 'Sendmail configuration file path.  Defaults to `/etc\'.  Many newer distributions use `/etc/mail\'.',
574     'type'        => 'text',
575   },
576
577   {
578     'key'         => 'sendmailmachines',
579     'section'     => 'mail',
580     'description' => 'Your sendmail machines, one per line.  This enables export of `/etc/virtusertable\' and `/etc/sendmail.cw\'.',
581     'type'        => 'textarea',
582   },
583
584   {
585     'key'         => 'sendmailrestart',
586     'section'     => 'mail',
587     'description' => 'If defined, the command which is run on sendmail machines after files are copied.',
588     'type'        => 'text',
589   },
590
591   {
592     'key'         => 'session-start',
593     'section'     => 'session',
594     'description' => 'If defined, the command which is executed on the Freeside machine when a session begins.  The contents of the file are treated as a double-quoted perl string, with the following variables available: <code>$ip</code>, <code>$nasip</code> and <code>$nasfqdn</code>, which are the IP address of the starting session, and the IP address and fully-qualified domain name of the NAS this session is on.',
595     'type'        => 'text',
596   },
597
598   {
599     'key'         => 'session-stop',
600     'section'     => 'session',
601     'description' => 'If defined, the command which is executed on the Freeside machine when a session ends.  The contents of the file are treated as a double-quoted perl string, with the following variables available: <code>$ip</code>, <code>$nasip</code> and <code>$nasfqdn</code>, which are the IP address of the starting session, and the IP address and fully-qualified domain name of the NAS this session is on.',
602     'type'        => 'text',
603   },
604
605   {
606     'key'         => 'shellmachine',
607     'section'     => 'deprecated',
608     'description' => '<b>DEPRECATED</b>, add a <i>shellcommands</i> <a href="../browse/part_export.cgi">export</a> instead.  This option used to contain a single machine with user home directories mounted.  This enables home directory creation, renaming and archiving/deletion.  In conjunction with `qmailmachines\', it also enables `.qmail-extension\' file maintenance.',
609     'type'        => 'text',
610   },
611
612   {
613     'key'         => 'shellmachine-useradd',
614     'section'     => 'deprecated',
615     'description' => '<b>DEPRECATED</b>, add a <i>shellcommands</i> <a href="../browse/part_export.cgi">export</a> instead.  This option used to contain command(s) to run on shellmachine when an account is created.  If the <b>shellmachine</b> option is set but this option is not, <code>useradd -d $dir -m -s $shell -u $uid $username</code> is the default.  If this option is set but empty, <code>cp -pr /etc/skel $dir; chown -R $uid.$gid $dir</code> is the default instead.  Otherwise the value is evaluated as a double-quoted perl string, with the following variables available: <code>$username</code>, <code>$uid</code>, <code>$gid</code>, <code>$dir</code>, and <code>$shell</code>.',
616     'type'        => [qw( checkbox text )],
617   },
618
619   {
620     'key'         => 'shellmachine-userdel',
621     'section'     => 'deprecated',
622     'description' => '<b>DEPRECATED</b>, add a <i>shellcommands</i> <a href="../browse/part_export.cgi">export</a> instead.  This option used to contain command(s) to run on shellmachine when an account is deleted.  If the <b>shellmachine</b> option is set but this option is not, <code>userdel $username</code> is the default.  If this option is set but empty, <code>rm -rf $dir</code> is the default instead.  Otherwise the value is evaluated as a double-quoted perl string, with the following variables available: <code>$username</code> and <code>$dir</code>.',
623     'type'        => [qw( checkbox text )],
624   },
625
626   {
627     'key'         => 'shellmachine-usermod',
628     'section'     => 'deprecated',
629     'description' => '<b>DEPRECATED</b>, add a <i>shellcommands</i> <a href="../browse/part_export.cgi">export</a> instead.  This option used to contain command(s) to run on shellmachine when an account is modified.  If the <b>shellmachine</b> option is set but this option is empty, <code>[ -d $old_dir ] &amp;&amp; mv $old_dir $new_dir || ( chmod u+t $old_dir; mkdir $new_dir; cd $old_dir; find . -depth -print | cpio -pdm $new_dir; chmod u-t $new_dir; chown -R $uid.$gid $new_dir; rm -rf $old_dir )</code> is the default.  Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: <code>$old_dir</code>, <code>$new_dir</code>, <code>$uid</code> and <code>$gid</code>.',
630     #'type'        => [qw( checkbox text )],
631     'type'        => 'text',
632   },
633
634   {
635     'key'         => 'shellmachines',
636     'section'     => 'deprecated',
637     'description' => '<b>DEPRECATED</b>, add a <i>sysvshell</i> <a href="../browse/part_export.cgi">export</a> instead.  Your Linux and System V flavored shell (and mail) machines, one per line.  This enables export of `/etc/passwd\' and `/etc/shadow\' files.',
638      'type'        => 'textarea',
639  },
640
641   {
642     'key'         => 'shells',
643     'section'     => 'required',
644     'description' => '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.',
645     'type'        => 'textarea',
646   },
647
648   {
649     'key'         => 'showpasswords',
650     'section'     => 'UI',
651     'description' => 'Display unencrypted user passwords in the web interface',
652     'type'        => 'checkbox',
653   },
654
655   {
656     'key'         => 'signupurl',
657     'section'     => 'UI',
658     'description' => 'if you are using customer-to-customer referrals, and you enter the URL of your <a href="../docs/signup.html">signup server CGI</a>, the customer view screen will display a customized link to the signup server with the appropriate customer as referral',
659     'type'        => 'text',
660   },
661
662   {
663     'key'         => 'smtpmachine',
664     'section'     => 'required',
665     'description' => 'SMTP relay for Freeside\'s outgoing mail',
666     'type'        => 'text',
667   },
668
669   {
670     'key'         => 'soadefaultttl',
671     'section'     => 'BIND',
672     'description' => 'SOA default TTL for new domains.',
673     'type'        => 'text',
674   },
675
676   {
677     'key'         => 'soaemail',
678     'section'     => 'BIND',
679     'description' => 'SOA email for new domains, in BIND form (`.\' instead of `@\'), with trailing `.\'',
680     'type'        => 'text',
681   },
682
683   {
684     'key'         => 'soaexpire',
685     'section'     => 'BIND',
686     'description' => 'SOA expire for new domains',
687     'type'        => 'text',
688   },
689
690   {
691     'key'         => 'soamachine',
692     'section'     => 'BIND',
693     'description' => 'SOA machine for new domains, with trailing `.\'',
694     'type'        => 'text',
695   },
696
697   {
698     'key'         => 'soarefresh',
699     'section'     => 'BIND',
700     'description' => 'SOA refresh for new domains',
701     'type'        => 'text',
702   },
703
704   {
705     'key'         => 'soaretry',
706     'section'     => 'BIND',
707     'description' => 'SOA retry for new domains',
708     'type'        => 'text',
709   },
710
711   {
712     'key'         => 'statedefault',
713     'section'     => 'UI',
714     'description' => 'Default state or province (if not supplied, the default is `CA\')',
715     'type'        => 'text',
716   },
717
718   {
719     'key'         => 'radiusprepend',
720     'section'     => 'deprecated',
721     'description' => '<b>DEPRECATED</b>, real-time text radius now edits an existing file in place - just (turn off freeside-queued and) edit your RADIUS users file directly.  The contents used to be be prepended to the top of the RADIUS users file (text exports only).',
722     'type'        => 'textarea',
723   },
724
725   {
726     'key'         => 'textradiusprepend',
727     'section'     => 'deprecated',
728     'description' => '<b>DEPRECATED</b>, use RADIUS check attributes instead.  The contents used to be prepended to the first line of a user\'s RADIUS entry in text exports.',
729     'type'        => 'text',
730   },
731
732   {
733     'key'         => 'unsuspendauto',
734     'section'     => 'billing',
735     'description' => 'Enables the automatic unsuspension of suspended packages when a customer\'s balance due changes from positive to zero or negative as the result of a payment or credit',
736     'type'        => 'checkbox',
737   },
738
739   {
740     'key'         => 'usernamemin',
741     'section'     => 'username',
742     'description' => 'Minimum username length (default 2)',
743     'type'        => 'text',
744   },
745
746   {
747     'key'         => 'usernamemax',
748     'section'     => 'username',
749     'description' => 'Maximum username length',
750     'type'        => 'text',
751   },
752
753   {
754     'key'         => 'username-ampersand',
755     'section'     => 'username',
756     'description' => 'Allow the ampersand character (&amp;) in usernames.  Be careful when using this option in conjunction with <a href="#shellmachine-useradd">shellmachine-useradd</a> and other configuration options which execute shell commands, as the ampersand will be interpreted by the shell if not quoted.',
757     'type'        => 'checkbox',
758   },
759
760   {
761     'key'         => 'username-letter',
762     'section'     => 'username',
763     'description' => 'Usernames must contain at least one letter',
764     'type'        => 'checkbox',
765   },
766
767   {
768     'key'         => 'username-letterfirst',
769     'section'     => 'username',
770     'description' => 'Usernames must start with a letter',
771     'type'        => 'checkbox',
772   },
773
774   {
775     'key'         => 'username-noperiod',
776     'section'     => 'username',
777     'description' => 'Disallow periods in usernames',
778     'type'        => 'checkbox',
779   },
780
781   {
782     'key'         => 'username-nounderscore',
783     'section'     => 'username',
784     'description' => 'Disallow underscores in usernames',
785     'type'        => 'checkbox',
786   },
787
788   {
789     'key'         => 'username-nodash',
790     'section'     => 'username',
791     'description' => 'Disallow dashes in usernames',
792     'type'        => 'checkbox',
793   },
794
795   {
796     'key'         => 'username-uppercase',
797     'section'     => 'username',
798     'description' => 'Allow uppercase characters in usernames',
799     'type'        => 'checkbox',
800   },
801
802   {
803     'key'         => 'username_policy',
804     'section'     => '',
805     'description' => 'This file controls the mechanism for preventing duplicate usernames in passwd/radius files exported from svc_accts.  This should be one of \'prepend domsvc\' \'append domsvc\' \'append domain\' or \'append @domain\'',
806     'type'        => 'select',
807     'select_enum' => [ 'prepend domsvc', 'append domsvc', 'append domain', 'append @domain' ],
808     #'type'        => 'text',
809   },
810
811   {
812     'key'         => 'vpopmailmachines',
813     'section'     => 'deprecated',
814     'description' => '<b>DEPRECATED</b>, add a <i>cp</i> <a href="../browse/part_export.cgi">export</a> instead.  This option used to contain your vpopmail pop toasters, one per line.  Each line is of the form "machinename vpopdir vpopuid vpopgid".  For example: <code>poptoaster.domain.tld /home/vpopmail 508 508</code>  Note: vpopuid and vpopgid are values taken from the vpopmail machine\'s /etc/passwd',
815     'type'        => 'textarea',
816   },
817
818   {
819     'key'         => 'vpopmailrestart',
820     'section'     => 'mail',
821     'description' => 'If defined, the shell commands to run on vpopmail machines after files are copied.  An example can be found in eg/vpopmailrestart of the source distribution.',
822     'type'        => 'textarea',
823   },
824
825   {
826     'key'         => 'safe-part_pkg',
827     'section'     => 'UI',
828     'description' => 'Validates package definition setup and recur expressions against a preset list.  Useful for webdemos, annoying to powerusers.',
829     'type'        => 'checkbox',
830   },
831
832   {
833     'key'         => 'safe-part_bill_event',
834     'section'     => 'UI',
835     'description' => 'Validates invoice event expressions against a preset list.  Useful for webdemos, annoying to powerusers.',
836     'type'        => 'checkbox',
837   },
838
839   {
840     'key'         => 'show_ss',
841     'section'     => 'UI',
842     'description' => 'Turns on display/collection of SS# in the web interface.',
843     'type'        => 'checkbox',
844   },
845
846   { 
847     'key'         => 'agent_defaultpkg',
848     'section'     => 'UI',
849     'description' => 'Setting this option will cause new packages to be available to all agent types by default.',
850     'type'        => 'checkbox',
851   },
852
853   {
854     'key'         => 'legacy_link',
855     'section'     => 'UI',
856     'description' => 'Display options in the web interface to link legacy pre-Freeside services.',
857     'type'        => 'checkbox',
858   },
859
860   {
861     'key'         => 'queue_dangerous_controls',
862     'section'     => 'UI',
863     'description' => 'Enable queue modification controls on account pages and for new jobs.  Unless you are a developer working on new export code, you should probably leave this off to avoid causing provisioning problems.',
864     'type'        => 'checkbox',
865   },
866
867   {
868     'key'         => 'security_phrase',
869     'section'     => 'password',
870     'description' => 'Enable the tracking of a "security phrase" with each account.  Not recommended, as it is vulnerable to social engineering.',
871     'type'        => 'checkbox',
872   },
873
874   {
875     'key'         => 'locale',
876     'section'     => 'UI',
877     'description' => 'Message locale',
878     'type'        => 'select',
879     'select_enum' => [ qw(en_US) ],
880   },
881
882   {
883     'key'         => 'signup_server-payby',
884     'section'     => '',
885     'description' => 'Acceptable payment types for the signup server',
886     'type'        => 'selectmultiple',
887     'select_enum' => [ qw(CARD PREPAY BILL COMP) ],
888   },
889
890   {
891     'key'         => 'signup_server-email',
892     'section'     => '',
893     'description' => 'Comma-separated list of email addresses to receive notification of signups via the signup server.',
894     'type'        => 'text',
895   },
896
897
898   {
899     'key'         => 'show-msgcat-codes',
900     'section'     => 'UI',
901     'description' => 'Show msgcat codes in error messages.  Turn this option on before reporting errors to the mailing list.',
902     'type'        => 'checkbox',
903   },
904
905   {
906     'key'         => 'signup_server-realtime',
907     'section'     => '',
908     'description' => 'Run billing for signup server signups immediately, and suspend accounts which subsequently have a balance.',
909     'type'        => 'checkbox',
910   },
911
912   {
913     'key'         => 'declinetemplate',
914     'section'     => 'billing',
915     'description' => 'Template file for credit card decline emails.',
916     'type'        => 'textarea',
917   },
918
919   {
920     'key'         => 'emaildecline',
921     'section'     => 'billing',
922     'description' => 'Enable emailing of credit card decline notices.',
923     'type'        => 'checkbox',
924   },
925
926   {
927     'key'         => 'require_cardname',
928     'section'     => 'billing',
929     'description' => 'Require an "Exact name on card" to be entered explicitly; don\'t default to using the first and last name.',
930     'type'        => 'checkbox',
931   },
932
933   {
934     'key'         => 'enable_taxclasses',
935     'section'     => 'billing',
936     'description' => 'Enable per-package tax classes',
937     'type'        => 'checkbox',
938   },
939
940   {
941     'key'         => 'welcome_email',
942     'section'     => '',
943     'description' => 'Template file for welcome email.  Welcome emails are sent to the customer email invoice destination(s) each time a svc_acct record is created.  See the <a href="http://search.cpan.org/doc/MJD/Text-Template-1.42/Template.pm">Text::Template</a> documentation for details on the template substitution language.  The following variables are available: <code>$username</code>, <code>$password</code>, <code>$first</code>, <code>$last</code> and <code>$pkg</code>.',
944     'type'        => 'textarea',
945   },
946
947   {
948     'key'         => 'welcome_email-from',
949     'section'     => '',
950     'description' => 'From: address header for welcome email',
951     'type'        => 'text',
952   },
953
954   {
955     'key'         => 'welcome_email-subject',
956     'section'     => '',
957     'description' => 'Subject: header for welcome email',
958     'type'        => 'text',
959   },
960   
961   {
962     'key'         => 'welcome_email-mimetype',
963     'section'     => '',
964     'description' => 'MIME type for welcome email',
965     'type'        => 'select',
966     'select_enum' => [ 'text/plain', 'text/html' ],
967   },
968
969 );
970
971 1;
972