Archive for the tag 'Perl'

Using Perl to make changes to your DNS files

Example : You would like to change “v=spf1 a mx ip4:1.2.3.4 ?all” to “v=spf1 a mx ip4:1.2.3.4 -all”

of course, where 1.2.3.4 should be replaced by your server IP.

If you’d rather do this to all of your domain, you can use perl

cd /var/named

perl -pi -e ’s/\?all/\-all/’ *.db

change /var/named to the appropriate directory for your db files for your OS (/etc/bind, /etc/namdb)

Restart named after making the changes.

SBDavid

Perl MD5 module for Webmin

Perl MD5 module for Webmin

The Webmin Users and Groups module supports the encryption of passwords with the MD5 algorithm, if your system supports it. However, this depends on the Perl MD5 module, which can be downloaded from

http://www.cpan.org/modules/by-module/MD5/MD5-1.7.tar.gz.

Once downloaded, enter the following commands to install the module :

gunzip MD5-1.7.tar.gz
tar xvf MD5-1.7.tar
cd MD5-1.7
perl Makefile.PL
make
make install

If you are using Webmin 0.83 or above, an even easier option is to use the Perl Modules module to make and install the MD5 module from CPAN.

SBDavid

Upgrade Perl to 5.8.8 (Cpanel 11.4.2)

Upgrade Perl to 5.8.8 (Cpanel 11.4.2)

The cpanel 11 requires perl version 5.8.8. To upgrade the perl version in the server you can use following steps:-

1. Download perl 5.8.8 using following link:-

# wget http://layer1.cpanel.net/perl588installer.tar.gz

2. Untar the tar package using following command

# tar -vzxf perl588installer.tar.gz

3. Then Install

# cd perl588installer
# ./install

Once this has completed, execute the following to ensure that all modules required by cPanel are installed, and restart cPanel:

/usr/local/cpanel/bin/checkperlmodules
/usr/local/cpanel/startup

4. Check and confirm the perl version using the command:

perl -v
SBDavid

Using Perl to Change TTL Values

Using Perl to Change TTL Values

We’ll change the TTL from 14400 to 100 seconds for all domains

perl -pi -e ’s/14400/100/’ named.db

When changing the IP of a domain, end users will have the old IP of the domain cached at their ISP’s nameservers for a duration of the TTL (time to live). The default value is 14400 seconds (4 hours). This means, that when you change the IP of the sever, the worst case, is the end users will be using the wrong IP for 4 hours before the cache expires and the IP is recached with the correct value.

The simple way to minimize this propogation error is to lower the TTL.

SBDavid

Installing Perl Modules

Installing Perl Modules.

Perl Modules can be obtained from the CPAN (Comprehensive Perl Archive Network) at http://search.cpan.org.

The easiest way to install Perl modules on Unix is to use the CPAN module. For example:

shell> perl -MCPAN -e shell
cpan> install DBI
cpan> install DBD::mysql

DBD::mysql is the Perl5 Database Interface driver for the MySQL database.

To find a particular module, use the i command, followed by an expression that you want to search for:

cpan> i /Time/

CPAN.pm will go out to the CPAN mirrror that you selected, download the list of modules, and tell you which ones match the search word.

To install a module, just type:

cpan> install Time::CTime

CPAN.pm takes care of the whole process. It downloads the compressed file, unpacks it, builds it, and installs it all for you, unless there is a problem with the installation process. If there are other modules on which this module relies, it will also download and install those.

« Prev