#! /bin/bash
read -p 'CONFIGURING ROOT USER PWD, PLEASE ENTER PWD IN LASTPASS BELOW - press Enter'
passwd root
apt-get install libpam-radius-auth -y
sed -i 's/127/#127/g' /etc/pam_radius_auth.conf
sed -i 's/other/#other/g' /etc/pam_radius_auth.conf
read -p 'ENTER RADIUS SHARED SECRET FOR PORT 1814 IN LASTPASS : ' radiussecret
sed -i "28i radius.exactasystems.com:1814 $radiussecret" /etc/pam_radius_auth.conf
sed -i "29i radius2.exactasystems.com:1814 $radiussecret" /etc/pam_radius_auth.conf
chmod 0600 /etc/pam_radius_auth.conf
sed -i "4i auth sufficient pam_radius_auth.so" /etc/pam.d/login
sed -i "57i /etc/pam.d/sshd" /etc/pam.d/login
sed -i "58i /etc/pam.d/sudo" /etc/pam.d/login
sed -i "59i /etc/pam.d/su" /etc/pam.d/login
# Adds new local users to authenticate via RADIUS
useradd -m -G sudo,adm -s /bin/bash eric.engardio
useradd -m -G sudo,adm -s /bin/bash darrell.kristof
useradd -m -G sudo,adm -s /bin/bash chandler.curnow
useradd -m -G sudo,adm -s /bin/bash nimai.malle
useradd -m -G sudo,adm -s /bin/bash nicholas.campagna
useradd -m -G sudo,adm -s /bin/bash andrew.walker
useradd -m -G sudo,adm -s /bin/bash noah.engel
useradd -m -G sudo,adm -s /bin/bash leonard.cohn
useradd -m -G sudo,adm -s /bin/bash devon.klausner
useradd -m -G sudo,adm -s /bin/bash alex.hall
sed -i "2i auth [success=done default=bad authinfo_unavail=bad ignore=ignore] pam_radius_auth.so localifdown" /etc/pam.d/sshd
#sed -i "2i auth [success=done default=bad authinfo_unavail=bad ignore=ignore] pam_radius_auth.so" /etc/pam.d/sshd
sed -i "5i auth sufficient pam_radius_auth.so" /etc/pam.d/sudo
mkdir /etc/raddb
cp /etc/pam_radius_auth.conf /etc/raddb/server
service ssh restart