Jump to content

Admin folder change name


Recommended Posts

When hackers try to attack your website the first thing they will do, they will try to access admin page. To make it harder for hackers, PrestaShop renames admin folder to random gibberish. It's kinda stupid but this is the way PrestaShop works.

You can't have admin named "admin", but you can name it "bo" or "badmin" or "admi". 

 

  • Haha 1
Link to comment
Share on other sites

  • 2 months later...

It's changed at initContent() function from AdminLoginControllerCore class:

if (basename(_PS_ADMIN_DIR_) == 'admin' && file_exists(_PS_ADMIN_DIR_.'/../admin/')) {
    $rand = 'admin'.sprintf('%03d', rand(0, 999)).Tools::strtolower(Tools::passwdGen(6)).'/';
    if (@rename(_PS_ADMIN_DIR_.'/../admin/', _PS_ADMIN_DIR_.'/../'.$rand)) {
        Tools::redirectAdmin('../'.$rand);
    } else {
        $this->context->smarty->assign(array(
            'wrong_folder_name' => true
        ));
    }
} else {
    $rand = basename(_PS_ADMIN_DIR_).'/';
}

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...