Dual Fix: “deprecated pam_stack module” and “Unable to open env file: /etc/environment”

/var/log/secure gets slammed with these errors every time anyone tries to connect to any service which requires authorization.  The fix has been elusive, as Ensim continues to re-write the pam.d files, but running this script will take care of both issues posthaste.

Save this as /usr/local/sbin/fix_pam:

#!/bin/sh

# —————————————————————————–
#
# fix_pam ver 1.0a
#
# (c) Copyright 2007 Mark Steel / Catalyst IT. All rights reserved.
#
# This script may only be distributed unmodified.
#
# This script is intended to be used to fix the “depracated pam stack module”
# errors on servers and virtual hosts.
#
# NOTE: THIS SCRIPT IS NOT GPL
#
# —————————————————————————–

perl -i -p -e ’s/required(.*)pam_stack.so service=system-auth/include\tsystem-auth/’ /etc/pam.d/*
perl -i -p -e ’s/pam_pwdb/pam_unix/’ /etc/pam.d/*
perl -i -p -e ’s/pam_env.so$/pam_env.so readenv=0/’ /etc/pam.d/system-auth

perl -i -p -e ’s/pam_env.so$/pam_env.so readenv=0/’ /home/virtual/FILESYSTEMTEMPLATE/siteinfo/etc/pam.d/system-auth
VIRTUAL=`find /home/virtual/FILESYSTEMTEMPLATE -name pam.d`
for i in $VIRTUAL; do
perl -i -p -e ’s/required(.*)pam_stack.so service=system-auth/include\tsystem-auth/’ $i/*
perl -i -p -e ’s/pam_pwdb/pam_unix/’ $i/*
done

DOMAINS=`sitelookup -a site_root`
for i in $DOMAINS; do
perl -i -p -e ’s/required(.*)pam_stack.so service=system-auth/include\tsystem-auth/’ $i/etc/pam.d/*
perl -i -p -e ’s/pam_pwdb/pam_unix/’ $i/etc/pam.d/*
perl -i -p -e ’s/pam_env.so$/pam_env.so readenv=0/’ $i/etc/pam.d/system-auth
done

service saslauthd restart

Run once, and you’re golden.

Tip: Mark Steel @ CatalystX

3 Comments »

PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php4/imap.so’ – /usr/lib/php4/imap.so: cannot open shared object file: No such file or directory in Unknown on line 0

#!/bin/bash

if [ ! -f /root/bin/dsitelookup ]; then
DOMAIN_LIST=`sitelookup -a domain`
else
DOMAIN_LIST=`dsitelookup -a domain`
fi

for i in $DOMAIN_LIST; do
replace “extension_dir = /usr/lib/php4″ “extension_dir = /usr/lib/php/modules” — /home/virtual/$i/etc/php.ini
cp -f /etc/virtualhosting/templates/apache/var/www/interpreters/php-script /home/virtual/$i/var/www/interpreters/
done

Enjoy.

No Comments »

Parallels/Ensim Awstats 6.8

Here are the notes and instructions for installing or upgrading Ensim Awstats to ver 6.8

READ THE NOTES PRIOR TO INSTALLATION!
*******************************************
Note 1: You need to have root access and SSH capabilities

Note 2: If you have a virtDomain.sh and a virtDomain.tar, then you will need to merge the two together in order for this to work. You should know how to do this if you already have customizations installed. Prior versions of my Ensimized version of Awstats can follow the instructions as if it’s a new install. Just say yes for overwriting the files during the copying of files phase.

Note 3: I have coded and tested this on a Parallels 10.3.1 / CentOS 5.2 machine. This code use to work with Ensim 3.5 (Redhat 7.3) and above prior to the Fedora and CentOS releases. Can’t imagine it not working for any of the Ensim/Parallels builds.

Note 4: The original idea, scripts etc. belonged to an Ensim forum board member “ho247″. Both no longer are around and I have been updating this script since 5.6. Special thanks goes to him.

Note 5: Usual disclaimers, warranties etc. apply. No guarantees. This is a “as-is” product.

Note 6: Special bonus! Included is a daily cron script to clean out the mail.quarantine folder on each and every virtual domain. It will dump all quarantined files older than 7 days.

Note 7: Upgrading to this version does not destroy your previous data. In fact, folks who have been using hand installed copies of Awstats have been able to convert over their data to this version.

Note 8: Extremely stressed out servers ( i.e. ones with tons of domains on them, or modestly populated ones that are extrememly busy) have reported excessive cpu usage during its initial run via cron. It can actually bring those servers to its knees. Not a surprise, considering their machines are already “stressed” so this will put another load onto your daily cron jobs. Remember that it is accessing your apache logs, so if they are big…guess what. It will take some time, and need processor muscle to complete it’s task. Once the initial data collection by awstats is finished, it drops down a bit. Stressed servers should consider adding this add-on, in the beginning of the month, and in the early morning when the logs are still small in size. You have been warned.

Check to see if you have a virtDomain.sh or a virtDomain.tar ie. ls or ls -la
(if you do…proceed to note 2.)

Usage: /root/awstats-install/awstats-install [--server-install][--domain-install ]
Pick one and then afterwards check and see if it works. The example below is for a server wide install.

cd /root
rm -fr awstats-install
wget http://www.customensimbackup.com/download/ensim-awstats-6.8.tar.gz
tar -zxvf ./ensim-awstats-6.8.tar.gz
cd /etc/appliance/customization
rm -f /etc/appliance/customization/awstats.sh
cp /root/awstats-install/virtDomain.sh /etc/appliance/customization
cp /root/awstats-install/virtDomain.tar /etc/appliance/customization
cd /root/awstats-install
./awstats-install –server-install
run-parts /etc/cron.daily

/awstats is where awstats is located for each domain.
/awstats/docs is where awstats docs are located for each domain.
get a cup of coffee….DONE!

Side note: If you want to password protect the awstats directory, here is one possible solution out of many that actually works.

I strongly suggest that you password protect your stats to avoid server corruption!

See: http://forums.theplanet.com/index.php?showtopic=53427 and don’t forget to thank forum board member “cweb” for his hard work.

1 Comment »

Ensim friendly phpMyAdmin upgrade 2.11.5.2 (final)

This one is easy to do, and is 100% Ensim compatible. This will also work as a stand alone application. Side note: the 2.11 series is the last series that will support php4. Afterwards, php5 will be the only thing considered. Remember Aug. 8, 2008 is rapidly approaching. Get your servers upgraded and updated today while you have a chance to fix stuff.

SSH into the server as root,

cd /root
rm -f upgrade_phpMyAdmin
wget http://www.customensimbackup.com/download/upgrade_phpMyAdmin
chmod 700 upgrade_phpMyAdmin
./upgrade_phpMyAdmin

Enjoy!

6 Comments »

Ensim friendly phpMyAdmin upgrade 2.11.5.1 (final)

This one is easy to do, and is 100% Ensim compatible. This will also work as a stand alone application. Side note: the 2.11 series is the last series that will support php4. Afterwards, php5 will be the only thing considered.

SSH into the server as root,

cd /root
rm -f upgrade_phpMyAdmin
wget http://www.customensimbackup.com/download/upgrade_phpMyAdmin
chmod 700 upgrade_phpMyAdmin
./upgrade_phpMyAdmin

Enjoy!

No Comments »

Ensim friendly phpMyAdmin upgrade 2.11.5 (final)

This one is easy to do, and is 100% Ensim compatible. This will also work as a stand alone application. Side note: the 2.11 series is the last series that will support php4. Afterwards, php5 will be the only thing considered.

SSH into the server as root,

cd /root
rm -f upgrade_phpMyAdmin
wget http://www.customensimbackup.com/download/upgrade_phpMyAdmin
chmod 700 upgrade_phpMyAdmin
./upgrade_phpMyAdmin

Enjoy!

No Comments »

Sites can no longer SFTP into their domains after a clean install

New install, CentOS5.0 (or RHEL5.0) and Ensim X 10.3

It will ask for the password and even go through the motions of allowing site users the ability to connect but then it just closes the connection with no explanations or error.
Here are the procedures for running the script:

pico -w fix_sftp
chmod +x fix_sftp
./fix_sftp

Here is the actual code for the script it self:

#!/bin/bash

file[1]="/usr/lib/libnss3.so"
file[2]="/usr/lib/libplc4.so"
file[3]="/usr/lib/libplds4.so"
file[4]="/usr/lib/libnspr4.so"
sitelist=`sitelookup -a domain`

for i in $sitelist; do
cp ${file[*]} /home/virtual/$i/usr/lib
cp ${file[*]} /home/virtual/FILESYSTEMTEMPLATE/siteinfo/usr/lib
done

Enjoy.

5 Comments »

Unable to open env file: /etc/environment errors

01-Dec-2008 NOTE: This post is superceded with a different method. 
See http://www.ensimfixes.com/?p=46

The /var/log/secure log is full of these stupid error messages. For some reason, they forgot to add this file to all the domains and the server. The fix is really easy!

touch /etc/environment
for i in `sitelookup -a domain`; do touch /home/virtual/$i/etc/environment; done

Enjoy!

No Comments »

Ensim friendly phpMyAdmin upgrade 2.11.2.1 (final)

This one is easy to do, and is 100% Ensim compatible. This will also work as a stand alone application. Side note: the 2.11 series is the last series that will support php4. Afterwards, php5 will be the only thing considered.

SSH into the server as root,

cd /root
rm -f upgrade_phpMyAdmin
wget http://www.customensimbackup.com/download/upgrade_phpMyAdmin
chmod 700 upgrade_phpMyAdmin
./upgrade_phpMyAdmin

Enjoy!

No Comments »

Ensim friendly phpMyAdmin upgrade 2.11.1.2 (final)

This one is easy to do, and is 100% Ensim compatible. This will also work as a stand alone application. Side note: the 2.11 series is the last series that will support php4. Afterwards, php5 will be the only thing considered.

SSH into the server as root,

cd /root
rm -f upgrade_phpMyAdmin
wget http://www.customensimbackup.com/download/upgrade_phpMyAdmin
chmod 700 upgrade_phpMyAdmin
./upgrade_phpMyAdmin

Enjoy!

No Comments »

Next »