b69f47aa0e897bc80e2fa66c5cc1c96a8791e416
[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'     => 'deprecated',
232     'description' => '<b>DEPRECATED</b>, add an <i>apache</i> <a href="../browse/part_export.cgi">export</a> instead.  Used to be 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'     => 'deprecated',
246     'description' => '<b>DEPRECATED</b>, add an <i>apache</i> <a href="../browse/part_export.cgi">export</a> instead.  Used to be 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-ach',
273     'section'     => 'billing',
274     'description' => 'Alternate <a href="http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment">Business::OnlinePayment</a> support for ACH transactions (defaults to regular <b>business-onlinepayment</b>).  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.',
275     'type'        => 'textarea',
276   },
277
278   {
279     'key'         => 'business-onlinepayment-description',
280     'section'     => 'billing',
281     '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 for which these charges apply)',
282     'type'        => 'text',
283   },
284
285   {
286     'key'         => 'bsdshellmachines',
287     'section'     => 'deprecated',
288     '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\'.',
289     'type'        => 'textarea',
290   },
291
292   {
293     'key'         => 'countrydefault',
294     'section'     => 'UI',
295     'description' => 'Default two-letter country code (if not supplied, the default is `US\')',
296     'type'        => 'text',
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'         => 'unapplypayments',
329     'section'     => 'UI',
330     'description' => 'Enable "unapplication" of unclosed payments.',
331     'type'        => 'checkbox',
332   },
333
334   {
335     'key'         => 'dirhash',
336     'section'     => 'shell',
337     '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>',
338     'type'        => 'text',
339   },
340
341   {
342     'key'         => 'disable_customer_referrals',
343     'section'     => 'UI',
344     'description' => 'Disable new customer-to-customer referrals in the web interface',
345     'type'        => 'checkbox',
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'         => 'exclude_ip_addr',
378     'section'     => '',
379     'description' => 'Exclude these from the list of available broadband service IP addresses. (One per line)',
380     'type'        => 'textarea',
381   },
382   
383   {
384     'key'         => 'erpcdmachines',
385     'section'     => 'deprecated',
386     'description' => '<b>DEPRECATED</b>, ERPCD is no longer supported.  Used to be ERPCD authenticaion machines, one per line.  This enables export of `/usr/annex/acp_passwd\' and `/usr/annex/acp_dialup\'',
387     'type'        => 'textarea',
388   },
389
390   {
391     'key'         => 'hidecancelledpackages',
392     'section'     => 'UI',
393     'description' => 'Prevent cancelled packages from showing up in listings (though they will still be in the database)',
394     'type'        => 'checkbox',
395   },
396
397   {
398     'key'         => 'hidecancelledcustomers',
399     'section'     => 'UI',
400     'description' => 'Prevent customers with only cancelled packages from showing up in listings (though they will still be in the database)',
401     'type'        => 'checkbox',
402   },
403
404   {
405     'key'         => 'home',
406     'section'     => 'required',
407     'description' => 'For new users, prefixed to username to create a directory name.  Should have a leading but not a trailing slash.',
408     'type'        => 'text',
409   },
410
411   {
412     'key'         => 'icradiusmachines',
413     'section'     => 'deprecated',
414     '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>',
415     'type'        => [qw( checkbox textarea )],
416   },
417
418   {
419     'key'         => 'icradius_mysqldest',
420     'section'     => 'deprecated',
421     'description' => '<b>DEPRECATED</b>, add an <i>sqlradius</i> <a href="../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/".',
422     'type'        => 'text',
423   },
424
425   {
426     'key'         => 'icradius_mysqlsource',
427     'section'     => 'deprecated',
428     'description' => '<b>DEPRECATED</b>, add an <i>sqlradius</i> <a href="../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".',
429     'type'        => 'text',
430   },
431
432   {
433     'key'         => 'icradius_secrets',
434     'section'     => 'deprecated',
435     'description' => '<b>DEPRECATED</b>, add an <i>sqlradius</i> <a href="../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.',
436     'type'        => 'textarea',
437   },
438
439   {
440     'key'         => 'invoice_from',
441     'section'     => 'required',
442     'description' => 'Return address on email invoices',
443     'type'        => 'text',
444   },
445
446   {
447     'key'         => 'invoice_template',
448     'section'     => 'required',
449     'description' => 'Required template file for invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
450     'type'        => 'textarea',
451   },
452
453   {
454     'key'         => 'lpr',
455     'section'     => 'required',
456     'description' => 'Print command for paper invoices, for example `lpr -h\'',
457     'type'        => 'text',
458   },
459
460   {
461     'key'         => 'maildisablecatchall',
462     'section'     => 'deprecated',
463     '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.',
464     'type'        => 'checkbox',
465   },
466
467   {
468     'key'         => 'money_char',
469     'section'     => '',
470     'description' => 'Currency symbol - defaults to `$\'',
471     'type'        => 'text',
472   },
473
474   {
475     'key'         => 'mxmachines',
476     'section'     => 'deprecated',
477     'description' => 'MX entries for new domains, weight and machine, one per line, with trailing `.\'',
478     'type'        => 'textarea',
479   },
480
481   {
482     'key'         => 'nsmachines',
483     'section'     => 'deprecated',
484     'description' => 'NS nameservers for new domains, one per line, with trailing `.\'',
485     'type'        => 'textarea',
486   },
487
488   {
489     'key'         => 'defaultrecords',
490     'section'     => 'BIND',
491     'description' => 'DNS entries to add automatically when creating a domain',
492     'type'        => 'editlist',
493     'editlist_parts' => [ { type=>'text' },
494                           { type=>'immutable', value=>'IN' },
495                           { type=>'select',
496                             select_enum=>{ map { $_=>$_ } qw(A CNAME MX NS)} },
497                           { type=> 'text' }, ],
498   },
499
500   {
501     'key'         => 'arecords',
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'         => 'cnamerecords',
509     'section'     => 'deprecated',
510     'description' => 'A list of tab seperated CNAME records to add automatically when creating a domain',
511     'type'        => 'textarea',
512   },
513
514   {
515     'key'         => 'nismachines',
516     'section'     => 'deprecated',
517     '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\'.',
518     'type'        => 'textarea',
519   },
520
521   {
522     'key'         => 'passwordmin',
523     'section'     => 'password',
524     'description' => 'Minimum password length (default 6)',
525     'type'        => 'text',
526   },
527
528   {
529     'key'         => 'passwordmax',
530     'section'     => 'password',
531     'description' => 'Maximum password length (default 8) (don\'t set this over 12 if you need to import or export crypt() passwords)',
532     'type'        => 'text',
533   },
534
535   {
536     'key'         => 'qmailmachines',
537     'section'     => 'deprecated',
538     'description' => '<b>DEPRECATED</b>, add <i>qmail</i> and <i>shellcommands</i> <a href="../browse/part_export.cgi">exports</a> instead.  This option used to export `/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.',
539     'type'        => [qw( checkbox textarea )],
540   },
541
542   {
543     'key'         => 'radiusmachines',
544     'section'     => 'deprecated',
545     '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\'.',
546     'type'        => 'textarea',
547   },
548
549   {
550     'key'         => 'referraldefault',
551     'section'     => 'UI',
552     'description' => 'Default referral, specified by refnum',
553     'type'        => 'text',
554   },
555
556 #  {
557 #    'key'         => 'registries',
558 #    'section'     => 'required',
559 #    'description' => 'Directory which contains domain registry information.  Each registry is a directory.',
560 #  },
561
562   {
563     'key'         => 'report_template',
564     'section'     => 'required',
565     'description' => 'Required template file for reports.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
566     'type'        => 'textarea',
567   },
568
569
570   {
571     'key'         => 'maxsearchrecordsperpage',
572     'section'     => 'UI',
573     'description' => 'If set, number of search records to return per page.',
574     'type'        => 'text',
575   },
576
577   {
578     'key'         => 'sendmailconfigpath',
579     'section'     => 'deprecated',
580     'description' => '<b>DEPRECATED</b>, add a <i>sendmail</i> <a href="../browse/part_export.cgi">export</a> instead.  Used to be sendmail configuration file path.  Defaults to `/etc\'.  Many newer distributions use `/etc/mail\'.',
581     'type'        => 'text',
582   },
583
584   {
585     'key'         => 'sendmailmachines',
586     'section'     => 'deprecated',
587     'description' => '<b>DEPRECATED</b>, add a <i>sendmail</i> <a href="../browse/part_export.cgi">export</a> instead.  Used to be sendmail machines, one per line.  This enables export of `/etc/virtusertable\' and `/etc/sendmail.cw\'.',
588     'type'        => 'textarea',
589   },
590
591   {
592     'key'         => 'sendmailrestart',
593     'section'     => 'deprecated',
594     'description' => '<b>DEPRECATED</b>, add a <i>sendmail</i> <a href="../browse/part_export.cgi">export</a> instead.  Used to define the command which is run on sendmail machines after files are copied.',
595     'type'        => 'text',
596   },
597
598   {
599     'key'         => 'session-start',
600     'section'     => 'session',
601     '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.',
602     'type'        => 'text',
603   },
604
605   {
606     'key'         => 'session-stop',
607     'section'     => 'session',
608     '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.',
609     'type'        => 'text',
610   },
611
612   {
613     'key'         => 'shellmachine',
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 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.',
616     'type'        => 'text',
617   },
618
619   {
620     'key'         => 'shellmachine-useradd',
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 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>.',
623     'type'        => [qw( checkbox text )],
624   },
625
626   {
627     'key'         => 'shellmachine-userdel',
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 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>.',
630     'type'        => [qw( checkbox text )],
631   },
632
633   {
634     'key'         => 'shellmachine-usermod',
635     'section'     => 'deprecated',
636     '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>.',
637     #'type'        => [qw( checkbox text )],
638     'type'        => 'text',
639   },
640
641   {
642     'key'         => 'shellmachines',
643     'section'     => 'deprecated',
644     '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.',
645      'type'        => 'textarea',
646  },
647
648   {
649     'key'         => 'shells',
650     'section'     => 'required',
651     '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.',
652     'type'        => 'textarea',
653   },
654
655   {
656     'key'         => 'showpasswords',
657     'section'     => 'UI',
658     'description' => 'Display unencrypted user passwords in the web interface',
659     'type'        => 'checkbox',
660   },
661
662   {
663     'key'         => 'signupurl',
664     'section'     => 'UI',
665     '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',
666     'type'        => 'text',
667   },
668
669   {
670     'key'         => 'smtpmachine',
671     'section'     => 'required',
672     'description' => 'SMTP relay for Freeside\'s outgoing mail',
673     'type'        => 'text',
674   },
675
676   {
677     'key'         => 'soadefaultttl',
678     'section'     => 'BIND',
679     'description' => 'SOA default TTL for new domains.',
680     'type'        => 'text',
681   },
682
683   {
684     'key'         => 'soaemail',
685     'section'     => 'BIND',
686     'description' => 'SOA email for new domains, in BIND form (`.\' instead of `@\'), with trailing `.\'',
687     'type'        => 'text',
688   },
689
690   {
691     'key'         => 'soaexpire',
692     'section'     => 'BIND',
693     'description' => 'SOA expire for new domains',
694     'type'        => 'text',
695   },
696
697   {
698     'key'         => 'soamachine',
699     'section'     => 'BIND',
700     'description' => 'SOA machine for new domains, with trailing `.\'',
701     'type'        => 'text',
702   },
703
704   {
705     'key'         => 'soarefresh',
706     'section'     => 'BIND',
707     'description' => 'SOA refresh for new domains',
708     'type'        => 'text',
709   },
710
711   {
712     'key'         => 'soaretry',
713     'section'     => 'BIND',
714     'description' => 'SOA retry for new domains',
715     'type'        => 'text',
716   },
717
718   {
719     'key'         => 'statedefault',
720     'section'     => 'UI',
721     'description' => 'Default state or province (if not supplied, the default is `CA\')',
722     'type'        => 'text',
723   },
724
725   {
726     'key'         => 'radiusprepend',
727     'section'     => 'deprecated',
728     '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).',
729     'type'        => 'textarea',
730   },
731
732   {
733     'key'         => 'textradiusprepend',
734     'section'     => 'deprecated',
735     '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.',
736     'type'        => 'text',
737   },
738
739   {
740     'key'         => 'unsuspendauto',
741     'section'     => 'billing',
742     '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',
743     'type'        => 'checkbox',
744   },
745
746   {
747     'key'         => 'usernamemin',
748     'section'     => 'username',
749     'description' => 'Minimum username length (default 2)',
750     'type'        => 'text',
751   },
752
753   {
754     'key'         => 'usernamemax',
755     'section'     => 'username',
756     'description' => 'Maximum username length',
757     'type'        => 'text',
758   },
759
760   {
761     'key'         => 'username-ampersand',
762     'section'     => 'username',
763     'description' => 'Allow the ampersand character (&amp;) in usernames.  Be careful when using this option in conjunction with <a href="../browse/part_export.cgi">exports</a> which execute shell commands, as the ampersand will be interpreted by the shell if not quoted.',
764     'type'        => 'checkbox',
765   },
766
767   {
768     'key'         => 'username-letter',
769     'section'     => 'username',
770     'description' => 'Usernames must contain at least one letter',
771     'type'        => 'checkbox',
772   },
773
774   {
775     'key'         => 'username-letterfirst',
776     'section'     => 'username',
777     'description' => 'Usernames must start with a letter',
778     'type'        => 'checkbox',
779   },
780
781   {
782     'key'         => 'username-noperiod',
783     'section'     => 'username',
784     'description' => 'Disallow periods in usernames',
785     'type'        => 'checkbox',
786   },
787
788   {
789     'key'         => 'username-nounderscore',
790     'section'     => 'username',
791     'description' => 'Disallow underscores in usernames',
792     'type'        => 'checkbox',
793   },
794
795   {
796     'key'         => 'username-nodash',
797     'section'     => 'username',
798     'description' => 'Disallow dashes in usernames',
799     'type'        => 'checkbox',
800   },
801
802   {
803     'key'         => 'username-uppercase',
804     'section'     => 'username',
805     'description' => 'Allow uppercase characters in usernames',
806     'type'        => 'checkbox',
807   },
808
809   {
810     'key'         => 'username_policy',
811     'section'     => 'deprecated',
812     '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\'',
813     'type'        => 'select',
814     'select_enum' => [ 'prepend domsvc', 'append domsvc', 'append domain', 'append @domain' ],
815     #'type'        => 'text',
816   },
817
818   {
819     'key'         => 'vpopmailmachines',
820     'section'     => 'deprecated',
821     'description' => '<b>DEPRECATED</b>, add a <i>vpopmail</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',
822     'type'        => 'textarea',
823   },
824
825   {
826     'key'         => 'vpopmailrestart',
827     'section'     => 'deprecated',
828     'description' => '<b>DEPRECATED</b>, add a <i>vpopmail</i> <a href="../browse/part_export.cgi">export</a> instead.  This option used to define the shell commands to run on vpopmail machines after files are copied.  An example can be found in eg/vpopmailrestart of the source distribution.',
829     'type'        => 'textarea',
830   },
831
832   {
833     'key'         => 'safe-part_pkg',
834     'section'     => 'UI',
835     'description' => 'Validates package definition setup and recur expressions against a preset list.  Useful for webdemos, annoying to powerusers.',
836     'type'        => 'checkbox',
837   },
838
839   {
840     'key'         => 'safe-part_bill_event',
841     'section'     => 'UI',
842     'description' => 'Validates invoice event expressions against a preset list.  Useful for webdemos, annoying to powerusers.',
843     'type'        => 'checkbox',
844   },
845
846   {
847     'key'         => 'show_ss',
848     'section'     => 'UI',
849     'description' => 'Turns on display/collection of SS# in the web interface.',
850     'type'        => 'checkbox',
851   },
852
853   { 
854     'key'         => 'agent_defaultpkg',
855     'section'     => 'UI',
856     'description' => 'Setting this option will cause new packages to be available to all agent types by default.',
857     'type'        => 'checkbox',
858   },
859
860   {
861     'key'         => 'legacy_link',
862     'section'     => 'UI',
863     'description' => 'Display options in the web interface to link legacy pre-Freeside services.',
864     'type'        => 'checkbox',
865   },
866
867   {
868     'key'         => 'queue_dangerous_controls',
869     'section'     => 'UI',
870     '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.',
871     'type'        => 'checkbox',
872   },
873
874   {
875     'key'         => 'security_phrase',
876     'section'     => 'password',
877     'description' => 'Enable the tracking of a "security phrase" with each account.  Not recommended, as it is vulnerable to social engineering.',
878     'type'        => 'checkbox',
879   },
880
881   {
882     'key'         => 'locale',
883     'section'     => 'UI',
884     'description' => 'Message locale',
885     'type'        => 'select',
886     'select_enum' => [ qw(en_US) ],
887   },
888
889   {
890     'key'         => 'selfservice_server-quiet',
891     'section'     => '',
892     'description' => 'Disable decline and cancel emails generated by transactions initiated by the selfservice server. Not recommended, unless the customer will get instant feedback from a customer service UI, and receiving an email would be confusing/overkill.',
893     'type'        => 'checkbox',
894   },
895
896   {
897     'key'         => 'signup_server-quiet',
898     'section'     => '',
899     'description' => 'Disable decline and cancel emails generated by transactions initiated by the signup server. Not recommended, unless the customer will get instant feedback from a customer service UI, and receiving an email would be confusing/overkill. Does not disable welcome emails.',
900     'type'        => 'checkbox',
901   },
902
903   {
904     'key'         => 'signup_server-payby',
905     'section'     => '',
906     'description' => 'Acceptable payment types for the signup server',
907     'type'        => 'selectmultiple',
908     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB PREPAY BILL COMP) ],
909   },
910
911   {
912     'key'         => 'signup_server-email',
913     'section'     => '',
914     'description' => 'Comma-separated list of email addresses to receive notification of signups via the signup server.',
915     'type'        => 'text',
916   },
917
918
919   {
920     'key'         => 'show-msgcat-codes',
921     'section'     => 'UI',
922     'description' => 'Show msgcat codes in error messages.  Turn this option on before reporting errors to the mailing list.',
923     'type'        => 'checkbox',
924   },
925
926   {
927     'key'         => 'signup_server-realtime',
928     'section'     => '',
929     'description' => 'Run billing for signup server signups immediately, and suspend accounts which subsequently have a balance.',
930     'type'        => 'checkbox',
931   },
932
933   {
934     'key'         => 'declinetemplate',
935     'section'     => 'billing',
936     'description' => 'Template file for credit card decline emails.',
937     'type'        => 'textarea',
938   },
939
940   {
941     'key'         => 'emaildecline',
942     'section'     => 'billing',
943     'description' => 'Enable emailing of credit card decline notices.',
944     'type'        => 'checkbox',
945   },
946
947   {
948     'key'         => 'cancelmessage',
949     'section'     => 'billing',
950     'description' => 'Template file for cancellation emails.',
951     'type'        => 'textarea',
952   },
953
954   {
955     'key'         => 'cancelsubject',
956     'section'     => 'billing',
957     'description' => 'Subject line for cancellation emails.',
958     'type'        => 'text',
959   },
960
961   {
962     'key'         => 'emailcancel',
963     'section'     => 'billing',
964     'description' => 'Enable emailing of cancellation notices.',
965     'type'        => 'checkbox',
966   },
967
968   {
969     'key'         => 'require_cardname',
970     'section'     => 'billing',
971     'description' => 'Require an "Exact name on card" to be entered explicitly; don\'t default to using the first and last name.',
972     'type'        => 'checkbox',
973   },
974
975   {
976     'key'         => 'enable_taxclasses',
977     'section'     => 'billing',
978     'description' => 'Enable per-package tax classes',
979     'type'        => 'checkbox',
980   },
981
982   {
983     'key'         => 'welcome_email',
984     'section'     => '',
985     '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>.',
986     'type'        => 'textarea',
987   },
988
989   {
990     'key'         => 'welcome_email-from',
991     'section'     => '',
992     'description' => 'From: address header for welcome email',
993     'type'        => 'text',
994   },
995
996   {
997     'key'         => 'welcome_email-subject',
998     'section'     => '',
999     'description' => 'Subject: header for welcome email',
1000     'type'        => 'text',
1001   },
1002   
1003   {
1004     'key'         => 'welcome_email-mimetype',
1005     'section'     => '',
1006     'description' => 'MIME type for welcome email',
1007     'type'        => 'select',
1008     'select_enum' => [ 'text/plain', 'text/html' ],
1009   },
1010
1011   {
1012     'key'         => 'payby-default',
1013     'section'     => 'UI',
1014     'description' => 'Default payment type.  HIDE disables display of billing information and sets customers to BILL.',
1015     'type'        => 'select',
1016     'select_enum' => [ '', qw(CARD DCRD CHEK DCHK LECB BILL COMP HIDE) ],
1017   },
1018
1019   {
1020     'key'         => 'svc_acct-notes',
1021     'section'     => 'UI',
1022     'description' => 'Extra HTML to be displayed on the Account View screen.',
1023     'type'        => 'textarea',
1024   },
1025
1026   {
1027     'key'         => 'radius-password',
1028     'section'     => '',
1029     'description' => 'RADIUS attribute for plain-text passwords.',
1030     'type'        => 'select',
1031     'select_enum' => [ 'Password', 'User-Password' ],
1032   },
1033
1034   {
1035     'key'         => 'radius-ip',
1036     'section'     => '',
1037     'description' => 'RADIUS attribute for IP addresses.',
1038     'type'        => 'select',
1039     'select_enum' => [ 'Framed-IP-Address', 'Framed-Address' ],
1040   },
1041
1042   {
1043     'key'         => 'svc_acct-alldomains',
1044     'section'     => '',
1045     'description' => 'Allow accounts to select any domain in the database.  Normally accounts can only select from the domain set in the service definition and those purchased by the customer.',
1046     'type'        => 'checkbox',
1047   },
1048
1049   {
1050     'key'         => 'dump-scpdest',
1051     'section'     => '',
1052     'description' => 'destination for scp database dumps: user@host:/path',
1053     'type'        => 'text',
1054   },
1055
1056   {
1057     'key'         => 'users-allow_comp',
1058     'section'     => '',
1059     'description' => 'Usernames which can create complimentary customers, one per line.  If no usernames are entered, all users can create complimentary accounts.',
1060     'type'        => 'textarea',
1061   },
1062
1063 );
1064
1065 1;
1066