Entice Posted January 17, 2018 Share Posted January 17, 2018 So I've been monitoring one of my sites' login sessions and noticed visits to the backend login page. While I believe having the session throttle module installed does its' magic, I was still concerned about any login attempts. So I decided to create add a honey pot into the admin login process since no one should be trying to login except me under a specific username. Before even the session login occurs in the module, if the username doesn't match, it Logs the attempt Saves the ip to a list on an admin page Redirects the user to the 404 page Site immediately checks if ip address exists in the banned list. Throws error on all pages thereafter for that ip address. This may be going a bit overboard but after seeing constant visits to the backend login page that I believe only I should be visiting, it peaked interest as to what ways I could further protect the back end. As long as I'm careful not to ban myself, should take care of those attempts. I know I may have a chance of banning an IP shared by many such as a cafe or cell phone network, let alone having ips cycle around, but we'll see how it goes. Anyone else have any thoughts on methods of protecting the backend of processwire? (Aside from https://processwire.com/docs/security/admin/) 1 Link to comment Share on other sites More sharing options...
gmclelland Posted January 17, 2018 Share Posted January 17, 2018 You could use Cloudflare.com's DNS and set a Page Rule to set the security level to "High" for your admin url. I've never had much luck blocking IP addresses. Link to comment Share on other sites More sharing options...
flydev Posted January 18, 2018 Share Posted January 18, 2018 9 hours ago, Entice said: So I decided to create add a honey pot into the admin login process since no one should be trying to login except me under a specific username. Before even the session login occurs in the module I am highly interested to see how in term of code you manage this. Did you hardcoded the login name in a hook or something like that ? As you say that you are monitoring a login for a specific username, you could prevent a login by hiding deeper the admin by naming the page with something complex you only know, eg. an url based on a HASH. 3 Link to comment Share on other sites More sharing options...
Entice Posted January 18, 2018 Author Share Posted January 18, 2018 7 hours ago, flydev said: I am highly interested to see how in term of code you manage this. Did you hardcoded the login name in a hook or something like that ? As you say that you are monitoring a login for a specific username, you could prevent a login by hiding deeper the admin by naming the page with something complex you only know, eg. an url based on a HASH. It's nothing fancy, but I currently don't have it tied to a hook yet. It's a scrap job as I was just exploring ideas to monitor login attempts to the backend. I've placed it where the login occurs for the backend in the \wire\modules\Process\ProcessLogin\ProcessLogin.module if($name != "admin" // Or whatever username){ // Log Attempt $this->wire('log')->save('attempts', long2ip($this->wire('session')->getIP(true)).':'.$name.':'.$pass); // Get Honeypot Page that contains textarea of banned ips $honeypot = $this->pages->get("/processwire/honeypot/"); // Get IP Address $ip = long2ip($this->wire('session')->getIP(true)); // Concatenate to textarea and Save Page $honeypot->of(false); $honeypot->banned = ($honeypot->banned != "")?($honeypot->banned.','.$ip):($ip);; $honeypot->save(); $honeypot->of(true); // Redirect to 404 $this->wire('session')->redirect('/404/'); } // The rest of the login occurs below: if($this->wire('session')->login($name, $pass)) { //.... } I'm sure you can hook it before the session login but I didn't bother looking into it so I'm going to just leave it in the process module for now and see what gets captured. It might just be google previewing the url before I visit it or something. We'll see. 1 1 Link to comment Share on other sites More sharing options...
flydev Posted January 18, 2018 Share Posted January 18, 2018 Thanks you very much. FYI the problem you will encounter with a modified core module, its all the modified code will be ripped off when updating the site. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now