login - How can I prevent anyone from logging into a WordPress failover site?

I have a nightly script set up to copy our site (and database) to a failover server. If our primary goes down, the failo

I have a nightly script set up to copy our site (and database) to a failover server. If our primary goes down, the failover server will provide service.

Since the failover server is overwritten every night, I don't want any of our 100+ users to login and make changes that will be overwritten soon after. I plan to have a notice on the login page telling them the site is down and can't be edited, but users may ignore it.

Can I prevent all users from logging into the site when it's on this failover server without clobbering all the passwords in a database?

I have a nightly script set up to copy our site (and database) to a failover server. If our primary goes down, the failover server will provide service.

Since the failover server is overwritten every night, I don't want any of our 100+ users to login and make changes that will be overwritten soon after. I plan to have a notice on the login page telling them the site is down and can't be edited, but users may ignore it.

Can I prevent all users from logging into the site when it's on this failover server without clobbering all the passwords in a database?

Share Improve this question asked Oct 24, 2019 at 17:27 Stephen SStephen S 1236 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

One sure-fire, yet simple, method is to scramble the AUTH_KEY constant in the wp-config.php file on the backup server.

In wp-config.php, change your AUTH_KEY line to append rand(). Example:

define('AUTH_KEY',         'YOUR-SUPER-SECURE-GENERATED-KEY' . rand());

On every page, the logged-in key is altered. This prevents users from staying logged in. Note: rand() is very insecure. But we're not saving hashes, just trying to create a new value on each page load, so this should be sufficient. An attacker would need to know your AUTH_KEY (since we're appending the random value), and this setup is focusing on preventing good users from logging in, not trying to harden security against bad users.

If a user tries to login, the login page will redirect them back to the login page indefinitely, since the cookie generated with the old AUTH_KEY is invalid each time a page is loaded.

When copying your site over every night, copy all files except wp-config.php. This may already be required for your current setup, as the connection to the failover database might have different credentials.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745055322a4608628.html

相关推荐

  • login - How can I prevent anyone from logging into a WordPress failover site?

    I have a nightly script set up to copy our site (and database) to a failover server. If our primary goes down, the failo

    19小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信