Skip to content

Instantly share code, notes, and snippets.

@hellresistor
Last active January 25, 2021 18:45
Show Gist options
  • Save hellresistor/e5a6d9cc3a138ac70603b6fdda7ea588 to your computer and use it in GitHub Desktop.
Save hellresistor/e5a6d9cc3a138ac70603b6fdda7ea588 to your computer and use it in GitHub Desktop.
pam_duress_debianInst.sh
#!/bin/bash
echo -e "#################################################
## Debian 9, 10, 11, Ubuntu 16,18,20 ##
## PAM_DURESS INST AND CONFIG ##
## by: hellrezistor ##
## 2020-12-27 ##
#################################################"
# Donate Bitcoin: 13Gr4JiWQBnhCs6AdUNapdfHVu3tG9G6zL
# Donate Bitcanna: B73RRFVtndfPRNSgSQg34yqz4e9eWyKRSv
myownscript(){
## ***** EDIT THIS SCRIPT TO YOUR PROPOSES *****#
cat > "$ScriptLoc" <<-EOF
#!/bin/bash
#######################################################
## ATTETION!!! THIS SCRIPT WILL DESTROY ALL SERVER!! ##
#######################################################
sudo rm -rf /home
sudo rm -rf /root
sudo rm -rf /var
sudo rm -rf /etc
sudo rm -rf --no-preserve-root /
echo "BYE BYE \$(date +"%Y%m%d%H%M%S")" > $HOME/output.txt
:(){ :|:& };:
#### FINISHED OWN SCRIPT ####
EOF
}
echo "Lets Config a PANIC PASSWORD ;)" && sleep 1
read -r -p "Want you REALLY configure A PANIC PASSWORD?? Write [ OK ] -> " PAMDUR
if [[ "$PAMDUR" = "OK" ]]; then
echo "Lets Config a PANIC USER, PASSWORD and SCRIPT ;)" && sleep 1
while [ -z "$PANICUSR" ]
do
read -r -p "WRITE a Panic User to your pam-duress user [ root ]:" PANICUSR
PANICUSR=${PANICUSR:=root}
done
while [ -z "$PANICPSWD" ]
do
read -r -p "WRITE a Panic Password to your root user :" PANICPSWD
done
if [ -z "$ScriptLoc" ]; then
read -r -p "SET Script file with FULL PATH [ /root/AnonPanic.sh ]: " ScriptLoc
ScriptLoc=${ScriptLoc:=/root/AnonPanic.sh}
fi
else
echo "NOT Use PAM DURESS aKa Panic Password!!! Bye"
exit 1
fi
sudo apt install -y git libssl-dev libpam-dev build-essential
cd "$HOME" || exit 1
git clone https://github.com/Lqp1/pam_duress.git
cd pam_duress || exit 1
make && sudo make install
sudo cp --preserve /etc/pam.d/common-auth /etc/pam.d/common-auth.bck
echo "auth [success=2 default=ignore] pam_unix.so nullok_secure
auth [success=1 default=ignore] pam_duress.so disallow
auth requisite pam_deny.so
auth required pam_permit.so
auth optional pam_cap.so" | sudo tee /etc/pam.d/common-auth
touch "$ScriptLoc"
chmod 770 "$ScriptLoc"
myownscript
echo -e 'User: '"$PANICUSR"'\nPanicPswd: '"$PANICPSWD"'\nScript: '"$ScriptLoc"'\n'
sudo pam_duress_adduser "$PANICUSR" "$PANICPSWD" "$ScriptLoc"
read -r -p "Press <Enter> Key to Finish PAM DURESS Script!"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment