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 »

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

  1. crankycronos on 01 Dec 2008 at 7:08 am #

    Good job. It actually works.

  2. cepheid on 02 Feb 2009 at 4:36 am #

    A reminder that this must be run after upgrading the Ensim/Parallels Pro control panel. I just upgraded from 10.3.0 to 10.3.3, and of course had to run this script again.

  3. jorge on 10 Mar 2009 at 4:07 pm #

    Thanks, it works fine.

    Another line repeated endlessly is: ‘ error setting IPV6_V6ONLY: Protocol not available’ every time a FTP transfer goes underway.
    Any idea on how to deal with it? there’s nothing in the web

    Thanks again

Trackback URI | Comments RSS

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word