mirror of
https://github.com/PierreGode/Linux-Active-Directory-join-script.git
synced 2025-12-21 08:50:12 +01:00
Merge pull request #47 from PierreGode/PierreGode-patch-1
Update security
This commit is contained in:
commit
496908f80f
@ -2482,26 +2482,27 @@ exit
|
||||
}
|
||||
################################## encrypt pwd ###############################
|
||||
encrypt(){
|
||||
echo "This will create 3 files public key, private key and encrypted file"
|
||||
echo "make sure to store private file"
|
||||
echo "This will create 3 files: public key, private key, and encrypted file."
|
||||
echo "Make sure to store the private key file securely."
|
||||
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"
|
||||
|
||||
echo "Please type the password to encrypt:"
|
||||
stty -echo
|
||||
read pass
|
||||
echo "$pass" > encryptpwd.txt
|
||||
stty echo
|
||||
if [ -z "$pass" ]
|
||||
then
|
||||
echo "passwd is empty"
|
||||
exit
|
||||
if [ -z "$pass" ]; then
|
||||
echo "Password is empty"
|
||||
exit 1
|
||||
else
|
||||
sudo openssl pkeyutl -encrypt -inkey public_key.pem -pubin -in encryptpwd.txt -out encrypted.dat
|
||||
sudo rm -rf encryptpwd.txt
|
||||
echo -n "$pass" | sudo openssl pkeyutl -encrypt -inkey public_key.pem -pubin -out encrypted.dat
|
||||
pass=""
|
||||
echo "Encryption complete. Files created:"
|
||||
ls
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
################################## info ##################################
|
||||
readmes(){
|
||||
clear
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user