Cloudflare Access is a very ingenious way to protect critical parts of different services, such as maintenance sign-in pages. Cloudflare access is a service that in many cases can replace the use of in-house VPN services. If cloudflare is still unknown to you, then I recommend reading our previous article on cloudflare deployment.
Cloudflare Access from a technical point of view
If you're not interested in technology, but you want to take the security of your WordPress site to a new level, for example, skip this point.
Cloudflare Access is an authentication system that sits between you and your server. Its mission is to prevent unknown parties from accessing critical parts of your online service. So the user needs to identify themselves first - before they can even navigate the browser to the login pane of the site. Cloudflare mimics Google's BeyondCorp system and brings beyondcorp's pros to everyone.
Authentication takes place, for example, with a Google account, Azure Active Directory, or Okta. Cloudflare Access therefore supports the largest and most common authentication procedures. You can also use e-mail to identify yourself.
WordPress dashboard security
Cloudflare Access helps protect almost all pages on the network that need to be restricted. WordPress sign-in page is not very secure as standard. The /wp-admin/ page is almost invariably attacked daily by automatic scanners online. This page should therefore be protected as much as possible. A really good password and password manager already significantly improves security, but constant intrusion attempts by heavy scanners may slow down the functionality of the entire site. Cloudflare Access helps protect your site from these attacks because scanners or other intruders can't even connect to your site's /wp-admin/ page. When an attacker visits the dashboard sign-in page, they first find themselves on cloudflare's authentication page. If an attacker tries to crack this page, they will attack Cloudflare and not your page.
Open the Cloudflare dashboard and navigate to "Access". Click "Manage access" and select many users need access to the WordPress dashboard. Finally, press "Continue". Cloudflare Access is free for the first five users. After five users, the price is $3/user/month.
Scroll to the next item "Login method". Press "Add" to add a new authentication. We use email and a Google account as an example. With the help of email, authentication is done with "One-Time pin" authentication. One-Time pin doesn't require any more configuration at this point. Google authentication requires action in the Google Cloud console. If you don't want to use Google authentication, you can go to the next point.
Google Account Authentication
If you want to identify yourself to Cloudflare Access using a Google account, follow these steps.
For example, name the project "Cloudflare Access" and press "Create".
Press "Create Credentials" and select "OAuth Client ID".
If you see a notification that says "Configure Consent Screen", press it and follow the instructions.
Fill in the "Product Name" field and hit save. Product Name is visible to users when authentication.
Under "Authorized redirect URIs" fill in the following: "https://omadomain.cloudflareaccess.com/cdn-cgi/access/callback" and press "Create".
Copy both: "client ID", as well as "secret" to cloudflare access configuration.
3. Protection and rights assignment
Scroll to "Access Policies" and press "Create Access Policy". We will start protecting the WordPress /wp-admin/ page. We will block access to the login page if the user fails to identify themselves in the previously defined ways.
Under "Application Name" fill in the site name. For example, "omadomain.fi WordPress admin".
Under "Application Domain" in the "path" field, enter "wp-admin". If you use any subdomain, fill it correctly.
In the "Session duration" item, you must specify how long the user's authentication is valid.
Under "Policies," type "Allow" as the name of the first rule, for example, and under "Decision," select "Allow".
Under "Include," select "Email" or if you want to allow the entire organization, then "Emails Ending in" and enter the email address of the person you want to give access to.
We also want another rule that prevents others from accessing the page. Press the "Add new policy" button.
Name the rule "Deny" and select "Deny" under "Decission".
Under "Include", select "Everyone". Finally, press the "Save" button.
Test cloudflare access functionality
Once you have saved the rules, you can go and try the WordPress dashboard. When you try the /wp-admin/ page, your browser is redirected to the Cloudflare access authentication page. Identify yourself and you will be able to continue as normal with 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 help to help protect other sites. You will only replace the address with the address of the page you want to protect.