Part 2: Some Standard declarations and personalizing for your site

More foundational work. This stuff will configure for your site, and the routines that follow will regularly rely on them.

First, let's declare our modules:

#!/user/bin/perl
use strict;
use Net::LDAP;
use Authen::SASL;
use IO::Socket::SSL;
use Digest::SHA qw/sha1_base64/;
use Mail::Sendmail;
use Crypt::SmbHash;
use CGI;
use CGI qw/:standard/;

And let's set some variables that will be different for everybody:

my $secondaryLdap = "secondaryLdap.example.com";
my $primaryLdap = "primaryLdap.example.com";
my $caFile = '/location/of/certificate/authority/file.txt';
my $defaultBase = "dc=example,dc=com";
my $peopleBase = "ou=People,dc=example,dc=com";
my $groupBase = "ou=Groups,dc=example,dc=com";
my $mailServer = "mail.example.com";
my $adminEmail = "admin\@example.com";

And let's declare a few variables that we will use throughout:

my $base;
my $ldap;
my $ssl;
my $mesg;
my $CGI;

Tags: