Add helper scripts for generating WordPress salts

This commit is contained in:
Aleksandar Puharic 2024-05-24 00:27:14 +02:00
parent 6c7a9812e0
commit f2951e8d8b
Signed by: xZero707
GPG Key ID: 3CC53DCAA9C237BB
3 changed files with 22 additions and 0 deletions

1
bin/generate-wp-salts Symbolic link
View File

@ -0,0 +1 @@
../src/wp-utils/wp-generate-salts

7
src/wp-utils/wp-generate-salt Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
main() {
local length="${1:?}"
tr -dc 'a-zA-Z0-9!@#$%^&*()-=_+[]{};:,.<>?`~' </dev/urandom | head -c "${length}"
}
main "${@}"

14
src/wp-utils/wp-generate-salts Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
main() {
local keys=("AUTH_KEY" "SECURE_AUTH_KEY" "LOGGED_IN_KEY" "NONCE_KEY" "AUTH_SALT" "SECURE_AUTH_SALT" "LOGGED_IN_SALT" "NONCE_SALT")
local key
local value
for key in "${keys[@]}"; do
value="$(src/wp-utils/wp-generate-salt 64)"
echo "WORDPRESS_${key}='${value}'"
done
}
main "${@}"