Updated article according to the Cloudflare Zero Trust platform. The guidelines are up to date again.
5.1.2023
Cloudflare Access is a very ingenious way to protect critical parts of various services, such as admin login pages. Cloudflare access is a service that in many cases can replace the use of in-house VPN services. If you are not familiar with Cloudflare, I recommend you read our previous article on Cloudflare deployment.
If you're not interested in technology, but want to take your WordPress site to the next level of security, for example, skip this section.
Cloudflare Access is an authentication system that sits between you and your server. Its purpose is to prevent unknown parties from accessing critical parts of your online service. So the user has to authenticate first - before they can even navigate to the site's login screen in their browser. Cloudflare mimics Google's BeyondCorp system and brings the benefits of BeyondCorp to everyone.
Authentication can be done using a Google Account, Azure Active Directory or Okta, for example. Cloudflare Access therefore supports the largest and most common authentication methods. You can also use email to authenticate if you wish.
With Cloudflare Access, you can protect almost any page on the web that needs to be restricted. The WordPress login page is not very secure by default. The /wp-admin/ page is almost invariably attacked online by automated scanners on a daily basis. This page should therefore be protected as much as possible. A really good password and password manager already significantly improve security, but constant intrusion attempts by heavy scanners can slow down the whole site. With Cloudflare Access, you protect your site from these attacks, as scanners or other intruders cannot even connect to the /wp-admin/ page of your site. When an attacker visits the login page of the control panel, they will first find themselves on the Cloudflare login page. If an attacker tries to break this page, they are attacking Cloudflare, not your page.
NOTE! This guide assumes that you have already activated Cloudflare for use on your website. If you haven't done so you can follow our Cloudflare deployment blog post.
Open the Cloudflare control panel and navigate to "Zero Trust". (Also available at: https://one.dash.cloudflare.com/)
Scroll to the next section "Settings". Under "Login Methods", press: "Add", to add a new login method. We use email and Google accounts as examples. Authentication by email is done with a "One-Time pin" authentication. The One-Time pin does not require any further configuration at this stage. Google authentication requires action in the Google Cloud console. If you do not want to use Google authentication, you can go to the next section.
If you want to sign in to Cloudflare Access using your Google Account, follow these instructions.
Click on "Access" and select "Applications". Cloudflare Access is free for small groups, but becomes chargeable if there are many users. Follow Cloudflare's guidelines if you need a broader user base for your domain.
This view shows all the applications where you use the Cloudflare login interface, Access. Click on "Add an application".
Select "Self-hosted" here for the WordPress installation. This Zero Trust tool is versatile and many SaaS services, for example, can be integrated with this tool. So if you want, you could protect your company's Slack Workspace with the same authentication. Entire networks can also be protected using the same method, but this requires more technical expertise.
We will start securing the WordPress /wp-admin/ page. We will block access to the login page if the user fails to authenticate using the previously defined methods.
Once you've got the rules saved, you can go ahead and try accessing the WordPress control panel. When you try to access the /wp-admin/ page, your browser will be redirected to the Cloudflare access login page. Log in and you can continue with your normal WordPress login.
Cloudflare Access is a really effective way to protect your company's critical pages without having to build a complex VPN network. You can also use the same pattern to protect other sites. Just replace the address with the address of the page you want to protect.