Code Search for Developers
 
 
  

configure.pl from AlphaMail at Krugle


Show configure.pl syntax highlighted

#!/usr/bin/perl -w
use strict;

our $apache_root;
our $apache_modules;
our $alphamail;
our $config_dir;
our $log_dir;
our $message_cache_dir;
our $message_cache_time; # seconds to cache temporary files for possible reuse 
our $session_dir;
our $max_message_size; # bytes
our $large_file_dir;
our $large_file_limit; # bytes
our $max_downloads;
our $post_limit; # bytes
our $scratch_space_dir; 
our $user;
our $smtp;
our $session_timeout;
our $preferences_dir;
our $webcache_port;
our $spam_address;
our $allowed_per_page;
our $default_app;
our $sandbox_dir;
our $sandbox_user;
our $sandbox_util;
our $support_email;
our $support_phone;
our $developer_email;
our $imap_servers;
our $organization;
our $base_uri;
our $webserver_domain;
our $os = "";

our $make = 'make';
our $antiword_files = '/usr/share/antiword';

our %progs = ( 
               jpegtopnm => '' . qx(which jpegtopnm 2> /dev/null),
               tifftopnm => '' . qx(which tifftopnm 2> /dev/null),
               giftopnm => '' . qx(which giftopnm 2> /dev/null),
               pngtopnm => '' . qx(which pngtopnm 2> /dev/null),
               pnmscale => '' . qx(which pnmscale 2> /dev/null),
               pnmtojpeg => '' . qx(which pnmtojpeg 2> /dev/null),
               xlhtml => '' . qx(which xlhtml 2> /dev/null),
               antiword => '' . qx(which antiword 2> /dev/null),
               elinks => '' . qx(which elinks 2> /dev/null),
               tar => '' . qx(which tar 2> /dev/null),
               gzip => '' . qx(which gzip 2> /dev/null),
               bzip2 => '' . qx(which bzip2 2> /dev/null),
               unzip => '' . qx(which unzip 2> /dev/null),
               openssl => '' . qx(which openssl 2> /dev/null),
               pnmscale => '' . qx(which pnmscale 2> /dev/null),
               file => '' . qx(which file 2> /dev/null),
               cat => '' . qx(which cat 2> /dev/null) 
              );

sub link_or_copy
{
   my ($a, $b) = (shift, shift);

   warn "No such file: $a" if (!-f $a);
   return if link($a, $b);
   my $o = qx(cp $a $b);
   return if($? == 0);
   warn "Cannot link or copy $a to $b. Please do so manually."
}

sub check
{
   my $pkg = shift;
   my $version = shift;
   my $t;

   eval {
      my $v = `perl -M$pkg -e 'print \$${pkg}::VERSION' 2> /dev/null`;
      $v =~ s/\s*//g;
      $v =~ s/^(\d+\.\d+).*$/$1/;
      die "\n\t$pkg IS NOT INSTALLED.\n" if($v =~ m/^\s*$/);
      die "\n\tThe installed version of $pkg is $v. \tAlpha Mail requires at least version $version.\n" if($v < $version);
   };
   if($@) {
      print STDERR "$@";
      return 0;
   }
   return 1;
}

# Check for required packages:
sub verify_packages
{
   my $ok = 1;
   print STDERR "Checking for required packages (use cpan(1) to update/install on errors).\n";
   $ok &= check('Apache2::SiteControl', 1.01);
   $ok &= check('Apache2::AuthCookie', 3.04);
   $ok &= check('Apache2::Request', 2.0);
   $ok &= check('mod_perl2', 2.0);
   $ok &= check('MIME::Parser', 5.4);
   $ok &= check('MIME::Types', 1.16);
   $ok &= check('Net::SMTP', 2.29);
   $ok &= check('Net::Domain', 1.00);
   $ok &= check('HTML::Entities', 1.29);
   $ok &= check('Log::Log4perl', 0.47);
   $ok &= check('Unicode::IMAPUtf7', 2.0);
   $ok &= check('Time::Format', 1.0);
   $ok &= check('Text::Wrap', 2001.0929);
   $ok &= check('Crypt::CBC', 2.14);
   $ok &= check('Crypt::CAST5', 0.04);
   $ok &= check('Data::Dumper', 2.0);
   $ok &= check('Carp', 1.0);
   $ok &= check('Encode', 2.0);
   $ok &= check('IO::File', 1.0);
   $ok &= check('IO::Socket', 1.25);
   $ok &= check('IO::Socket::INET', 1.24);
   $ok &= check('Text::Aspell', 0.04);
   $ok &= check('MIME::Words', 5.417);
   $ok &= check('Time::HiRes', 1.59);
   $ok &= check('Digest::MD5', 2);
   $ok &= check('Email::Address', 1.80);
   $ok &= check('Email::Date', 1.0);
   $ok &= check('Unicode::Collate', 0.51);
   $ok &= check('Date::Calc', 5.4);
   $ok &= check('Math::BigInt::GMP', 1.18);
   $ok &= check('Net::SSH::Perl', 1.28);
   $ok &= check('GD::Graph', 1.43);
   $ok &= check('Bundle::HTML::Mason', 0.09);
   $ok &= check('HTML::Mason', 1.30);
   if(!$ok) {
      print STDERR "Please install the missing packages and re-run.\n";
      exit 1;
   } else {
      print STDERR "OK\n";
   }
      
}

sub ask
{
   my $question = shift;
   my $default = shift;
   my @responses = @_;
   my $resp;

   if(@responses) {
      do {
         $" = ", ";
         print "$question (@responses): [$default] ";
         $resp = <STDIN>;
         chomp $resp;
         $resp = $default if(length($resp) == 0);
      } while(!grep(!/\Q$resp\E/, @responses));
      $" = " ";
   } else {
      print "$question: [$default] ";
      $resp = <STDIN>;
      chomp $resp;
      $resp = $default if(length($resp) == 0);
   }

   return $resp;
}

sub ask_for_dir
{
   my $question = shift;
   my $default = shift;
   my $must_exist = shift;
   my $resp;
   my $yn;

   do {
      print "$question [$default]: ";
      $resp = <STDIN>;
      chomp $resp;
      $resp = $default if(length($resp) == 0);
      if(!$must_exist && (!-d $resp || !-w $resp)) {
         print STDERR "Cannot write to $resp\n";
         $yn = ask("Create the directory?", "y", "n");
         chomp $yn;
         mkdir $resp if($yn eq 'y');
      }
   } while(length($resp) == 0 || !-d $resp || !-w $resp);

   return $resp;
}

sub create_config_files
{
   my %dirmap = (
      'alphamail.conf' => "$config_dir/apache",
      'init.pl' => "$config_dir",
      'log4perl.conf' => "$config_dir",
      );
   my $fn;
   my $line;

   for my $file (keys %dirmap)
   {
      $file =~ s!^.*/!!g;
      print STDERR "Configuring $file to $dirmap{$file}/$file\n";
      open DATA, "<$alphamail/conf/$file";
      open OUT, ">$dirmap{$file}/$file";
      while($line = <DATA>)
      {
         $line =~ s/CONFIG_DIRECTORY/$config_dir/g;
         $line =~ s/APACHECONF_DIRECTORY/$config_dir\/apache/g;
         $line =~ s/ALPHAMAIL_BASE/$base_uri/g;
         $line =~ s/ALPHAMAIL_DOMAIN/$webserver_domain/g;
         $line =~ s/ALPHAMAIL_DIRECTORY/$alphamail/g;
         $line =~ s/SESSION_DIRECTORY/$session_dir/g;
         $line =~ s/ALPHAMAIL_POSTLIMIT/$post_limit/g;
         $line =~ s/ALPHAMAIL_SCRATCHSPACE/$scratch_space_dir/g;
         $line =~ s/ALPHAMAIL_ERRORFILE/$alphamail\/htdocs\/mail\/error.html/g;
         $line =~ s/LOG_DIRECTORY/$log_dir/g;
         $line =~ s/ALPHA_USER/$user/g;
         $line =~ s/APACHE_ROOT/$apache_root/g;
         $line =~ s/APACHE_MODDIR/$apache_modules/g;
         print OUT $line;
      }
      close OUT;
      close DATA;
   }
}

sub fix_permissions
{
   print "\n\nI will now fix the permissions of the web directories.\n";
   $user = ask("What user does your apache daemon run as?", "apache");
   qx(mkdir $alphamail/mason);
   qx(chown -R $user "$alphamail/htdocs" "$alphamail/mason" "$config_dir" "$session_dir" "$message_cache_dir" "$log_dir" "$preferences_dir" "$large_file_dir" "$scratch_space_dir");
   qx(chmod 700 "$config_dir" "$session_dir" "$message_cache_dir" "$preferences_dir" "$large_file_dir" "$scratch_space_dir");
   qx(chmod 755 "$log_dir");
}

sub generate_app_config
{
   open DATA, ">$config_dir/alphamail_config";
   print DATA <<EOF;
# WARNING: Config file is re-read on changes; however, there is a possibility
# for it to get a partial read, which could cause all sorts of problems. Until
# I add a mechanism for locking, your best bet is to save this as an alternate
# file, and then use UNIX mv to move it over top of the old config. That way,
# you are changing the hard link, not the content, of what the server sees.
# Worst case is it does not find the config file, which will still cause it to
# update properly.

# This variable tells alphamail what MX is served by which IMAP servers. It
# also indicates where the extra (user-generated) folders are on that server,
# and what the path separator is.
# The format is a comma separated list of mx=server:port[prefix/]. Port is
# optional. For example,
# imap_servers: nowhere.org=imap.nowhere.org:993[mail/], somewhere.com=cyrus.overt.com[INBOX.]
# imap servers: mx=imap_server:port[prefix], ...
imap_servers: $imap_servers

# Variables used for the login screen:
organization_name: $organization
base_uri: $base_uri

# Port where the imap_webcache daemon lives
webcache_port: $webcache_port

# session_timeout is the number of seconds of idle time before we ask for the
# user's password again.
session_timeout: $session_timeout

# User preferences and addressbook location
prefsdir: $preferences_dir

# The location of temporary message files, created while parsing MIME (incoming
# and outgoing). This will also be where attachments are decoded and stored.
message_tmpdir: $message_cache_dir

# These files should be scheduled for cleanup as they get old (i.e. not been
# accessed for 10 minutes).
message_tmpdir_cachetime: $message_cache_time

# Some mail messages come in plain text with extremely long line lengths. This
# parameter indicates what width to wrap them to.
textwrap_columns: 80

# Sandbox parameters. Where to find the executable (which must be setuid root),
# and where to put the files that the external viewers will work on.
sandbox_util: $sandbox_util
sandbox: $sandbox_dir

# ATTACHMENT VIEWERS. 

# These utilities are needed by the attachment viewers. They (and all the files
# they use) must be hard linked into the sandbox directory.

# on-the-fly icon image generation
jpegtopnm: $progs{jpegtopnm}
pnmtojpeg: $progs{pnmtojpeg}
pnmscale: $progs{pnmscale}
tifftopnm: $progs{tifftopnm}
giftopnm: $progs{giftopnm}
pngtopnm: $progs{pngtopnm}
cat: $progs{cat}
# Height of the attachment icons for images
iconsize: 50

# MUST support z option (use GNU tar)
tar: $progs{tar}
unzip: $progs{unzip}

# Word document converter
antiword: $progs{antiword}

# Excel spreadsheet converter
xlhtml: $progs{xlhtml}

# HTML to text conversion
elinks: $progs{elinks}

# deriving mime type for files: (file(1) on most UNIX systems)
file: /usr/bin/file

# User Preference defaults
default_trash: mail/Trash
default_sent: mail/sent-mail
default_drafts: mail/Drafts
default_signature_on_top: 0
default_icon_preview: 1
default_linkify: 0
default_skipsendreport: 0
default_skip_images: 0
default_messages_per_page: $default_app
default_quicknav: 0

# Spam reporting
spam_address: $spam_address

# Allowed page sizes of message indexes
allowed_per_page: $allowed_per_page

# ATTACHMENT LIMITS
# Maximum message size with attachments (bytes)
max_message_size: $max_message_size

# FILE SHARING OPTIONS:
# File vault directory (large attachment alternative)
large_file_dir: $large_file_dir

# Maximum size of files in file vault (bytes)
large_file_limit: $large_file_limit
large_file_max_downloads: $max_downloads
# Number of days until filevault files are deleted
large_file_expiration: 14

# Openssl (used for encryption)
openssl: $progs{openssl}

# SMTP server:
smtp: $smtp

# Support contact info:
support_phone: $support_phone
support_email: $support_email

developer_email: $developer_email

# Nologin settings. Change nologin to 1 in order to disable logins. Users who
# are still logged in will be shown the logout_message, and new logins will be
# disabled with the nologin_message. This takes effect immediately upon save of
# the config file (which is reread every time you change it).
nologin: 0
nologin_message: The system is down for maintenance until 1:15pm.
logout_message: The system is going down for maintenance until 1:15pm.

# motd: message of the day. This will appear at the bottom of the login screen.
# Useful for notifications like planned outages. If you change this and save,
# it updates immediately on the site.
motd:

# Quotas are currently UO specific
enable_quota: 0

# MIME type extensions for identification of outgoing attachments, in Apache
# format (i.e. mime.types)
EOF

   close DATA;
}

sub mkdir_p
{
   my $directory = shift;
   my $perms = shift;
   $perms = 0755 if(!defined($perms));
   my @comp = split '/', $directory;
   my $dir;

   $dir = "/";
   for my $c (@comp) {
      $dir .= "/$c";
      if(!-d $dir) {
         mkdir "$dir", $perms or die "Could not create $dir";
      }
   }
}

sub create_sandbox
{
   my %dep;
   my ($a, $b, $uid, $gid, $c, $d, $e, $homedir) = getpwnam($sandbox_user);
   my ($dirname, $f);

   die "No such user $sandbox_user" if(!defined($a));

   die "Unable to write to sandbox $sandbox_dir" if(!-w $sandbox_dir);
   mkdir_p("$sandbox_dir/tmp", 0777);
   `chown $sandbox_user "$sandbox_dir/tmp"`;
   `chmod 777 "$sandbox_dir/tmp"`;

   $homedir = "$sandbox_dir$homedir";
   mkdir_p($homedir);
   chown $uid, $gid, $homedir or die "Cannot change ownership of $homedir to $sandbox_user";

   mkdir_p("$sandbox_dir/etc");
   link_or_copy "/etc/ld.so.conf", "$sandbox_dir/etc/ld.so.conf";
   link_or_copy "/etc/ld.so.cache", "$sandbox_dir/etc/ld.so.cache";
   link_or_copy "/etc/passwd", "$sandbox_dir/etc/passwd";
   link_or_copy "/etc/group", "$sandbox_dir/etc/group";

   # Collect all dependencies, and make links
   for my $prog (keys %progs) {
      my $loc = $progs{$prog};
      chomp $loc;
      $loc =~ m'^(.*)/[^/]*$';
      $dirname = $1;
      mkdir_p("$sandbox_dir$dirname");
      link_or_copy $loc, "$sandbox_dir$dirname/$prog";

      # Do the same for dependencies
      my @deps = qx(ldd $progs{$prog});
      for $d (@deps) {
         if($d =~ m'\s(/\S*)\s') {
            $f = $1;
            $f =~ m'^(.*/)[^/]*$';
            my $base = $1;
            print "Adding dependency $f for $prog\n";
            $dep{$f} = 1;
            while(-l $f) { # Find the _real_ file as well
               $f = readlink $f;
               $f = $base . $f if($f !~ m'^/');
               $dep{$f} = 1;
               print "Adding dependency $f for $prog\n";
            }
         }
      }
   }

   for $d (keys %dep) {
      $d =~ m'^(.*)/([^/]*)$';
      $dirname = $1;
      my $filename = $2;
      mkdir_p("$sandbox_dir$dirname");
      link_or_copy $d, "$sandbox_dir$d";
   }

   while(!-d $antiword_files) {
      $antiword_files = ask_for_dir("Where are the Antiword shared files? ", $antiword_files, 1);
   }
   print "linking/copying antiword files";
   mkdir_p("$sandbox_dir$antiword_files");
   for $f (<$antiword_files/*>)
   {
      if(!-d $f) {
         link_or_copy "$f", "$sandbox_dir$f";
      }
   }

   print "Building sandbox utility\n";
   my @lines = qx(cd $alphamail/util/sandbox; SANDBOX="$sandbox_dir" USER="$sandbox_user" BUILD_OS="$os" $make clean sandbox 2>&1);
   print "@lines";
   die "Build failed!" if(!-x "$alphamail/util/sandbox/sandbox");
   print "Build complete.\n";

   chown 0, 0, $sandbox_util or die "Could not set root permission on $sandbox_util";
   chmod 04755, $sandbox_util or die "Could not set setuid on $sandbox_util";
}

sub create_sandbox_osx
{
   my %dep;
   my ($a, $b, $uid, $gid, $c, $d, $f, $e, $homedir) = getpwnam($sandbox_user);

   die "No such user $sandbox_user" if(!defined($a));

   die "Unable to write to sandbox $sandbox_dir" if(!-w $sandbox_dir);
   mkdir_p("$sandbox_dir/tmp", 0777);
   `chown $sandbox_user "$sandbox_dir/tmp"`;
   `chmod 777 "$sandbox_dir/tmp"`;

   $homedir = "$sandbox_dir$homedir";
   mkdir_p($homedir);
   chown $uid, $gid, $homedir or die "Cannot change ownership of $homedir to $sandbox_user";

   mkdir_p("$sandbox_dir/etc");
   link "/etc/passwd", "$sandbox_dir/etc/passwd";
   link "/etc/group", "$sandbox_dir/etc/group";

   # Collect all dependencies, and make links
   for my $prog (keys %progs) {
      my $loc = $progs{$prog};
      chomp $loc;
      $loc =~ m'^(.*)/[^/]*$';
      my $dirname = $1;
      mkdir_p("$sandbox_dir$dirname");
      link $loc, "$sandbox_dir$dirname/$prog" or warn "Unable to link $loc to $sandbox_dir$dirname/$prog. This will cause run-time problems. Be sure to install them, add them to the sandbox, and edit alphamail_config to reflect their installed location.";

      # Do the same for dependencies
      my @deps = qx(otool -L $progs{$prog});
      for my $d (@deps) {
         if($d =~ m'\s(/\S*)\s') {
            my $f = $1;
            $f =~ m'^(.*/)[^/]*$';
            my $base = $1;
            print "Adding dependency $f for $prog\n";
            $dep{$f} = 1;
            while(-l $f) { # Find the _real_ file as well
               $f = readlink $f;
               $f = $base . $f if($f !~ m'^/');
               $dep{$f} = 1;
               print "Adding dependency $f for $prog\n";
            }
         }
      }
   }

   for my $d (keys %dep) {
      $d =~ m'^(.*)/([^/]*)$';
      my $dirname = $1;
      my $filename = $2;
      mkdir_p("$sandbox_dir$dirname");
      link_or_copy($d, "$sandbox_dir$d");
   }

   while(!-d $antiword_files) {
      $antiword_files = ask_for_dir("Where are the Antiword shared files? ", $antiword_files, 1);
   }
   print "linking/copying antiword files";
   mkdir_p("$sandbox_dir$antiword_files");
   for $f (<$antiword_files/*>)
   {
      if(!-d $f) {
         link_or_copy "$f", "$sandbox_dir$f";
      }
   }

   print "Building sandbox utility\n";
   my @lines = qx(cd $alphamail/util/sandbox; SANDBOX="$sandbox_dir" USER="$sandbox_user" $make clean sandbox 2>&1);
   print "@lines";
   die "Build failed!" if(!-x "$alphamail/util/sandbox/sandbox");
   print "Build complete.\n";

   chown 0, 0, $sandbox_util or die "Could not set root permission on $sandbox_util";
   chmod 04755, $sandbox_util or die "Could not set setuid on $sandbox_util";
}

sub configure_servers
{
   print <<EOIM;

Alphamail can support any number of mail exchanges. In this section of
configuration, you will be asked for the mail exchange (the stuff after \@ in a
mail address), and then you will be asked for the IMAP server that has access
to the mailboxes for that exchange. One pair of questions will be asked for
each exchange/server.
EOIM

   $imap_servers = "";
   my ($mx, $svr, $prefix, $separator, $port, $yn);
   do {
      do {
         $mx = ask("Mail exchange: ", '');
         $svr = ask("IMAP server for $mx: ", $mx);
         $port = ask("IMAP server port for $svr? If you use 993, SSL will be used to connect. Any other port will NOT use SSL/TLS: ", '993');
         $prefix = ask("What is the normal mail folder prefix on $svr? ", 'mail');
         do {
            $separator = ask("What is the path separator for IMAP on $svr (commonly '/' or '.')? ", '/');
         } while(!$separator);
         $prefix =~ s/\Q$separator\E+$//; # Make sure only one separator appears
         $yn = ask("IMAP server $svr:$port gives access to user\@$mx mail, and extra folders are under the $prefix$separator? ", 'y', 'y', 'n');
      } while(!$yn || $yn ne 'y');
      $imap_servers .= ", " if($imap_servers);
      if($port) {
         $imap_servers .= "$mx=$svr:$port\[$prefix$separator\]";
      } else {
         $imap_servers .= "$mx=$svr\[$prefix$separator\]";
      }
      $yn = ask("Enter another? ", 'y', 'y', 'n');
   } while($yn && $yn eq 'y');
}

sub sandbox_setup
{
   print <<SANDBOX_MSG;

AlphaMail uses a sandbox when running external viewers (like elinks and
pnmtojpeg). This is a security feature that helps eliminates security problems
with the external viewer program weaknesses.

IMPORTANT NOTE: The sandbox MUST be on the same filesystem as the other
directories that alphamail uses, since it uses hard links to avoid copying
files from one place to another.
SANDBOX_MSG
   $sandbox_dir = ask_for_dir("Where should the sandbox be created?", "$alphamail/sandbox", 0);
   $sandbox_user = ask("What user should the sandbox be owned by?", "nobody");
   `rm -rf $sandbox_dir/*` if(length($sandbox_dir) > 5);
   $sandbox_util = "$alphamail/util/sandbox/sandbox";

   for my $prog (sort keys %progs) {
      chomp $progs{$prog};
      if(! -x $progs{$prog}) {
         print STDERR "Cannot find $prog.\n";
         $progs{$prog} = ask("Location and name of $prog: ", "/usr/bin/$prog");
         if(! -x $progs{$prog}) {
            print STDERR "WARNING: $progs{$prog} does not exist or is not executable.\n";
         }
      } else {
         print STDERR "Found $prog.\n";
      }
   }

   if($os eq 'osx') {
      create_sandbox_osx;
   } else {
      create_sandbox;
   }
}

sub determine_build_env
{
   my $d = `pwd`;
   chomp $d;

   while($os !~ /^(linux|osx|freebsd)$/i) {
      $os = ask("Linux, OSX, or FreeBSD?", 'linux');
   }

   $os = lc($os);
   if($os eq 'freebsd') {
      $make = 'gmake';
      $antiword_files = '/usr/local/share/antiword';
   }

   while(1) {
      $alphamail = ask_for_dir("Where are the Alpha Mail files?", $d, 1);
      if(!-r "$alphamail/lib/AlphaMail/Middleware.pm") {
         print STDERR "That does not appear to be the correct directory. Please give the directory name which contains lib, etc, htdocs, ...)\n";
         next;
      }
      else {
         last;
      }
   }
}

sub get_system_params
{
   my $sn = qx(hostname -f);
   chomp $sn;
   $webserver_domain = ask("What domain name will Alphamail run under (Apache host or virtual host name)? ", $sn);
   $organization = ask("What organization should be shown on the login screen? ", "University of Oregon");
   $base_uri = ask("What URI should Alphamail be installed at? ", "/alphamail");
   $base_uri =~ s/\/$//;
   $config_dir = ask_for_dir("Directory for configuration files: ", "$alphamail/etc", 0);
   mkdir "$config_dir/apache";
   $log_dir = ask_for_dir("Directory for log files: ", "$alphamail/log", 0);
   $message_cache_dir = ask_for_dir("Directory for message cache: ", "$alphamail/messages", 0);
   $message_cache_time = ask("How long (in minutes) should temporary files be cached before deletion: ", 10);
   $scratch_space_dir = ask_for_dir("Where should upload files be stored during upload? This MUST be on the same filesystem as the message cache: ", "$alphamail/tmp", 0);
   $preferences_dir = ask_for_dir("Directory for user preferences and address books: ", "$alphamail/prefs", 0);
   $session_dir = ask_for_dir("Directory for session info: ", "$alphamail/sessions", 0);
   mkdir "$session_dir/locks";
   $large_file_dir = ask_for_dir("Directory for large file sharing: ", "$alphamail/filevault", 0);

   $session_timeout = ask("How long (in seconds) can a user be idle before session timeout?", 300);
   $webcache_port = ask("What localhost port hosts the imap_webcache?", 1234);
   $spam_address = ask("What email address should spam reports be sent to?", "");
   $allowed_per_page = ask("Enter a comma separated list of allowed page sizes for message indexes: ", "10, 20, 35, 50");
   $allowed_per_page =~ m/^(\d+)\D/;
   $default_app = $1;
   $smtp = ask("What is your smtp server's hostname?", "");
   $max_message_size = ask("How big can a message with attachments be (in bytes)?", 10 * 1024 * 1024);
   $large_file_limit = ask("What is the file size limit for the file vault (in bytes)?", 200 * 1024 * 1024);
   $max_downloads = ask("How many times should I allow a shared file to be downloaded?", 7);

   $post_limit = ask("\n\nWhat do you want for a hard limit on HTTP POST?\nThis should be a number much larger than the largest upload you see as\na non-attack. If this limit is reached, there is no good way to give the\nuser a proper error message, so it should be at least somewhat larger\nthan your file size limits for the file vault.\nZero means no limit.\nSize (in bytes): ", 200*1024*1024);

   $support_email = ask("\n\nWhat email address should users use for support?", '');
   $support_phone = ask("\n\nWhat phone number should users call for support?", "");
   $developer_email = ask("\n\nWhat is your developer's email address?", '');
}

sub show_status
{
   print <<EOF;

STATUS OF CONFIGURATION
=======================
Configuration files written to: $config_dir
Sandbox root configured to be: $sandbox_dir
Sandbox utility will run as: $sandbox_user

Logs will be stored in: $log_dir
Cached messages will be in $message_cache_dir for $message_cache_time minutes
Session information will be in: $session_dir. 
User preferences will be in: $preferences_dir. 

NOTE: $log_dir may contain sensitive information if you are running in DEBUG
mode. See $config_dir/log4perl.conf to set logging levels.

To finish installation:

Place $alphamail/etc/apache/alphamail.conf into your apache module directory,
or add it with an Apache Include directive, and restart your apache 2.x server.

EOF
}

#  *************************************************************************
#  ********************** BEGIN ENTRY CODE *********************************
#  *************************************************************************

verify_packages; 
determine_build_env;
sandbox_setup;
get_system_params;
configure_servers;
create_config_files;
fix_permissions;
generate_app_config;
show_status;

1;




See more files for this project here

AlphaMail

AlphaMail is an accelerated web mail interface with a C++ middleware layer that is more effective than an IMAP proxy which is a highly scalable (10k+ users). The interface includes modern features, Section 508 compliance, and universal browser support.

Project homepage: http://sourceforge.net/projects/alphamail
Programming language(s): C++,Java,JavaScript,Perl
License: other

  configure.pl