Skip to content

Instantly share code, notes, and snippets.

@hellresistor
Last active July 24, 2024 10:50
Show Gist options
  • Save hellresistor/a4c542415a2d437e21afc235260d2366 to your computer and use it in GitHub Desktop.
Save hellresistor/a4c542415a2d437e21afc235260d2366 to your computer and use it in GitHub Desktop.
installation and configuration new pam_duress system on debian
#!/bin/bash
echo -e "#################################################
## Debian 11 Ubuntu 20 ##
## PAM_DURESS INST AND CONFIG ##
## by: hellresistor ##
## 2021-01-29 ##
#################################################"
# Donate Bitcoin: 1292xDndXSxZgRkq1jZJfUTRdcGeictoUv
# Donate Bitcanna: bcna14dz7zytpenkyyktqvzq2mw7msfyp0y3zg48xqw
myownscript(){
## ***** EDIT THIS SCRIPT TO YOUR PROPOSES *****#
cat > "$ScriptFile" <<-EOF
#!/bin/bash
#######################################################
## ATTETION!!! THIS SCRIPT WILL DESTROY ALL SERVER!! ##
#######################################################
sudo rm -rf /var
sudo rm -rf /etc
sudo rm -rf /home
sudo rm -rf /root
echo "BYE BYE \$(date +"%Y%m%d%H%M%S")" | sudo tee -a /why
:(){ :|:& };:
#### 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
if [ -z "$ScriptLoc" ]; then
read -r -p "SET Script Directory with FULL PATH [ /root/.duress ]: " ScriptLoc
ScriptLoc=${ScriptLoc:=/root/.duress}
ScriptFile="$ScriptLoc/AnonPanic.sh"
fi
else
echo "NOT Use PAM DURESS aKa Panic Password!!! Bye"
exit 1
fi
sudo apt install -y git build-essential libpam0g-dev libssl-dev
cd "$HOME" || exit 1
git clone https://github.com/nuvious/pam-duress.git
cd pam-duress || exit 1
make
sudo make install
make clean
#make uninstall
mkdir -p $ScriptLoc
sudo mkdir -p /etc/duress.d
myownscript
duress_sign $ScriptFile
chmod -R 500 $ScriptLoc
chmod 400 $ScriptLoc/*.sha256
chown -R $PANICUSR $ScriptLoc
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
auth requisite pam_deny.so
auth required pam_permit.so
" | sudo tee /etc/pam.d/common-auth
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