Created
February 24, 2017 13:58
-
-
Save mysterious-static/f192addd0319127f90156173084d9ab3 to your computer and use it in GitHub Desktop.
Rotate WordPress salts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget -O new-salts.key https://api.wordpress.org/secret-key/1.1/salt/ | |
sed -i '1s|^|\n*/\n|' new-salts.key | |
sed -i "/#@+/,/#@-/{ /#@+/{p; r new-salts.key | |
}; /#@-/p; d }" wp-config.php | |
rm -f new-salts.key |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The idea here is to preserve the comment structure that I'm using to find the salts in wp-config so that you can rotate them as many times as you want. Seems to work okay for me.