Skip to content

Commit fc60118

Browse files
committed
Update keys and salts with random values from api.wordpress.org. Props nacin. see #12159
git-svn-id: https://develop.svn.wordpress.org/trunk@13026 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 86d7ef0 commit fc60118

File tree

2 files changed

+40
-6
lines changed

2 files changed

+40
-6
lines changed

wp-admin/setup-config.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,24 @@ function display_header() {
168168
if ( !empty($wpdb->error) )
169169
wp_die($wpdb->error->get_error_message());
170170

171+
require_once( ABSPATH . WPINC . '/plugin.php' );
172+
require_once( ABSPATH . WPINC . '/http.php' );
173+
wp_fix_server_vars();
174+
/**#@+
175+
* @ignore
176+
*/
177+
function get_bloginfo() {
178+
return 'http://' . $_SERVER['HTTP_HOST'] . str_replace( $_SERVER['PHP_SELF'], '/wp-admin/setup-config.php', '' );
179+
}
180+
/**#@-*/
181+
182+
$secret_keys = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/?salt=1' );
183+
if ( is_wp_error( $secret_keys ) )
184+
$secret_keys = false;
185+
else
186+
$secret_keys = explode( "\n", wp_remote_retrieve_body( $secret_keys ) );
187+
$key = 0;
188+
171189
foreach ($configFile as $line_num => $line) {
172190
switch (substr($line,0,16)) {
173191
case "define('DB_NAME'":
@@ -185,6 +203,17 @@ function display_header() {
185203
case '$table_prefix =':
186204
$configFile[$line_num] = str_replace('wp_', $prefix, $line);
187205
break;
206+
case "define('AUTH_KEY":
207+
case "define('SECURE_A":
208+
case "define('LOGGED_I":
209+
case "define('NONCE_KE":
210+
case "define('AUTH_SAL":
211+
case "define('SECURE_A":
212+
case "define('LOGGED_I":
213+
case "define('NONCE_SA":
214+
if ( $secret_keys )
215+
$configFile[$line_num] = str_replace('put your unique phrase here', substr( $secret_keys[$key++], 27, 64 ), $line );
216+
break;
188217
}
189218
}
190219
if ( ! is_writable(ABSPATH) ) :

wp-config-sample.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,23 @@
3434
define('DB_COLLATE', '');
3535

3636
/**#@+
37-
* Authentication Unique Keys.
37+
* Authentication Unique Keys and Salts.
3838
*
3939
* Change these to different unique phrases!
40-
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/ WordPress.org secret-key service}
40+
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/?salt=1 WordPress.org secret-key service}
4141
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
4242
*
4343
* @since 2.6.0
4444
*/
45-
define('AUTH_KEY', 'put your unique phrase here');
46-
define('SECURE_AUTH_KEY', 'put your unique phrase here');
47-
define('LOGGED_IN_KEY', 'put your unique phrase here');
48-
define('NONCE_KEY', 'put your unique phrase here');
45+
define('AUTH_KEY', 'put your unique phrase here');
46+
define('SECURE_AUTH_KEY', 'put your unique phrase here');
47+
define('LOGGED_IN_KEY', 'put your unique phrase here');
48+
define('NONCE_KEY', 'put your unique phrase here');
49+
define('AUTH_SALT', 'put your unique phrase here');
50+
define('SECURE_AUTH_SALT', 'put your unique phrase here');
51+
define('LOGGED_IN_SALT', 'put your unique phrase here');
52+
define('NONCE_SALT', 'put your unique phrase here');
53+
4954
/**#@-*/
5055

5156
/**

0 commit comments

Comments
 (0)