jasonmorganson
2/23/2013 - 4:40 AM

Download and install PAM modules

Download and install PAM modules

function isdone() {

  if [ $? -eq 0 ];then
    echo "done."
  else
    echo ""
    echo "Something went wrong!"
    exit 1
  fi
}



echo ""
echo "Setup PAM security modules"
echo ""



#
# PAM Auto Blacklist (pam_abl)
#
echo "* PAM Auto Blacklist (pam_abl):"

# Download PAM Auto Blacklist (pam_abl)
echo -n "  Downloading... "
curl -s -O -L http://downloads.sourceforge.net/project/pam-abl/pam-abl/pam-abl-0.5.0.tar.gz 
isdone

# Extract PAM Auto Blacklist (pam_abl)
echo -n "  Extracting... "
tar -xf pam-abl-0.5.0.tar.gz
isdone

# CMake PAM Auto Blacklist (pam_abl)
echo -n "  CMake... "
cd pam-abl
mkdir -p cmake_build
cd cmake_build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/ ../ >/dev/null 2>&1
isdone

# Make PAM Auto Blacklist (pam_abl)
echo -n "  Make... "
make >/dev/null 2>&1
isdone

# Install PAM Auto Blacklist (pam_abl)
echo -n "  Install.. "
mkdir -p /var/lib/abl
make install >/dev/null 2>&1
isdone

# Cleanup PAM Auto Blacklist (pam_abl)
echo -n "  Cleanup... "
cd ../../
rm pam-abl-0.5.0.tar.gz
rm -r pam-abl
isdone



#
# Google Authenticator PAM Module  
#
echo "* Google Authenticator PAM Module:"

# Download Google Authenticator PAM Module  
echo -n "  Downloading... "
curl -s -O -L https://google-authenticator.googlecode.com/files/libpam-google-authenticator-1.0-source.tar.bz2
isdone

# Extract Authenticator PAM Module  
echo -n "  Extracting... "
tar -xjf libpam-google-authenticator-1.0-source.tar.bz2
isdone

# Install Authenticator PAM Module  
echo -n "  Install.. "
cd libpam-google-authenticator-1.0
make install >/dev/null 2>&1
isdone

# Cleanup Authenticator PAM Module  
echo -n "  Cleanup... "
cd ../
rm libpam-google-authenticator-1.0-source.tar.bz2
rm -r libpam-google-authenticator-1.0
isdone



#
# Duo Security PAM Module 
#
echo "* Duo Security PAM Module:"

# Download Duo Security PAM Module
echo -n "  Downloading... "
curl -s -O -L https://dl.duosecurity.com/duo_unix-latest.tar.gz 
isdone

# Extract Duo Security PAM Module
echo -n "  Extracting... "
tar zxf duo_unix-latest.tar.gz
isdone

# Configure Duo Security PAM Module
echo -n "  Configure... "
cd duo_unix-1.9
./configure --with-pam --prefix=/usr >/dev/null 2>&1
isdone

# Make Duo Security PAM Module
echo -n "  Make... "
make >/dev/null 2>&1
isdone

# Install Duo Security PAM Module
echo -n "  Install.. "
make install >/dev/null 2>&1
isdone

# Cleanup Duo Security PAM Module
echo -n "  Cleanup... "
cd ../
rm duo_unix-latest.tar.gz
rm -r duo_unix-1.9
isdone