mirror of
https://github.com/PierreGode/Linux-Active-Directory-join-script.git
synced 2025-12-21 16:50:13 +01:00
Added Password encryption
Added Password encryption to generate encrypted password for automated joining with readfile encryption will genetate encrypted.dat > (your password encrypted) and private_key.pem public_key.pem all tree files are needed to decrypt the password. Find a way to get private_key.pem from outside source. Please do NOT store your private_key.pem with the other files untill the joining process. encrypt a password with sudo sh ADconnection.sh -p
This commit is contained in:
parent
c2f67ff05d
commit
0237a4b281
@ -1866,7 +1866,28 @@ exit
|
|||||||
fi
|
fi
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
################################## encrypt pwd ###############################
|
||||||
|
encrypt(){
|
||||||
|
echo "This will create 3 files public key, private key and encrypted file"
|
||||||
|
echo "make sure to store private file"
|
||||||
|
sudo openssl genrsa -out private_key.pem 2048
|
||||||
|
sudo openssl rsa -in private_key.pem -out public_key.pem -outform PEM -pubout
|
||||||
|
echo "Please type password to encrypt"
|
||||||
|
stty -echo
|
||||||
|
read pass
|
||||||
|
echo "$pass" > encryptpwd.txt
|
||||||
|
stty echo
|
||||||
|
if [ -z "$pass" ]
|
||||||
|
then
|
||||||
|
echo "passwd is empty"
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
sudo openssl rsautl -encrypt -inkey public_key.pem -pubin -in encryptpwd.txt -out encrypted.dat
|
||||||
|
sudo rm -rf encryptpwd.txt
|
||||||
|
ls
|
||||||
|
fi
|
||||||
|
exit
|
||||||
|
}
|
||||||
################################## info ##################################
|
################################## info ##################################
|
||||||
readmes(){
|
readmes(){
|
||||||
clear
|
clear
|
||||||
@ -2053,6 +2074,14 @@ while test $# -gt 0; do
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
-p|--p)
|
||||||
|
if test $? -gt 0; then
|
||||||
|
encrypt
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
-l|--l)
|
-l|--l)
|
||||||
if test $? -gt 0; then
|
if test $? -gt 0; then
|
||||||
DATE=$(date +%H:%M)
|
DATE=$(date +%H:%M)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user