Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2013
    Location
    in the clouds
    Posts
    33
    Plugin Contributions
    0

    Default .htaccess help needed for static IP address

    Hello, after a few weeks of suspicious activity on my website, my webhost kindly blocked a whole range of IP addresses at their firewall level after they confirmed that there was a consistent probing for Zen Cart vulnerabilities. This stopped all of these attempts and I have seemingly not had any more major probing other than the normal script kiddies/bots etc since. But my webhost also recommended I applied a .htaccess rule to limit access to my shops admin via IP. So, I have had BT change my broadband from a dynamic IP to a static IP and I have added the following rule to my admin's .htaccess file

    order deny,allow
    deny from all
    allow from xxx.xxx.xxx.xxx (My static IP)

    This seemed to work great and I was a bit more relaxed, as being hack terrifies me as I am new to Zen Cart/selling online, having only taken over this role from a colleague that passed away 9 months ago. So now, when I go to www.mywebshop.com/myadmin outside of work's internet, I am returned with the denied by the server's error page. BUT if I go to www.mywebshop.com/myadmin/index.php I am returned with the admin login screen, I can log in and use the shop admin. Can someone kindly tell me what I have done wrong? How can I still access the shop's Admin, from a different IP address that is allow from xxx.xxx.xxx.xxx (My static IP).

    Thank you, Isabella.

  2. #2
    Join Date
    Apr 2006
    Location
    West Salem, IL
    Posts
    2,888
    Plugin Contributions
    0

    Default Re: .htaccess help needed for static IP address

    you can add another line below that with a new allowed ip address

    Code:
    order deny,allow
    deny from all
    allow from xxx.xxx.xxx.xxx (My static IP)
    allow from xxx.xxx.xxx.xxx
    allow from xxx.xxx.xxx.xxx
    etc....
    Mike
    AEIIA - Zen Cart Certified & PCI Compliant Hosting
    The Zen Cart Forum...Better than a monitor covered with post-it notes!

  3. #3
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: .htaccess help needed for static IP address

    Quote Originally Posted by barco57 View Post
    you can add another line below that with a new allowed ip address

    Code:
    order deny,allow
    deny from all
    allow from xxx.xxx.xxx.xxx (My static IP)
    allow from xxx.xxx.xxx.xxx
    allow from xxx.xxx.xxx.xxx
    etc....
    I think though that this will provide the same result(s) as seen above.

    I believe the question is, why is it that someone can reach the admin login screen even though there is something in the .htaccess that seems like it should prevent it? And as a result of being able to access it, what needs to be done to prevent access?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    Sep 2013
    Location
    in the clouds
    Posts
    33
    Plugin Contributions
    0

    Default Re: .htaccess help needed for static IP address

    Yes. That is correct. I have a rule in place to block access to the admin fold from all but one IP address. But it seems to not work Any ideas why?

  5. #5
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: .htaccess help needed for static IP address

    Quote Originally Posted by izzysoup View Post
    Yes. That is correct. I have a rule in place to block access to the admin fold from all but one IP address. But it seems to not work Any ideas why?
    Offhand, I can't see why it shouldn't work, but personally I think that there is a better solution anyway.

    Log onto your sites Cpanel, and click on the option to "Password Protect Directories", then navigate your way to your admin directory and click on it. This will bring up a page where you van enter a password. Create a new password (different from your store admin password) and save the settings.

    Now when people attempt to access you admin folder (from anywhere) they've be greeted with an 'enter password' popup box before they can go any further, and if by some sheer fluke they happen to get passed this password protection they'll still need to kniw the username/password for the admin of your store.

    The downside of this is when *you* want to log into the admin of the store you'll need to enter two different passwords.

    Just a suggestion.

    Cheers
    RodG

    ps. You could also use

    Order Allow,Deny
    Allow from xxx.xxx.xxx.xxx


    It's more efficient than the Deny,Allow. Anything not specifically allowed is denied.
    http://httpd.apache.org/docs/2.2/mod...ost.html#order
    Last edited by RodG; 8 Sep 2014 at 06:24 PM.

  6. #6
    Join Date
    Sep 2013
    Location
    in the clouds
    Posts
    33
    Plugin Contributions
    0

    Default Re: .htaccess help needed for static IP address

    Many thanks RodG. I have added the password "Password Protect Directories" via the cPanel. I also believe I have solved the IP problem, by adding the following in green. It may seem overkill, but it brings me more peace of mind after the constant and direct probing we were suffering.

    # but now allow just *certain* necessary files:
    <FilesMatch "(^$|^favicon.ico$|.*\.(php|js|css|jpg|gif|png)$)">
    Order deny,allow
    Deny from all
    Allow from ***.***.***.***

    </FilesMatch>

  7. #7
    Join Date
    Sep 2013
    Location
    in the clouds
    Posts
    33
    Plugin Contributions
    0

    Default Re: .htaccess help needed for static IP address

    Ah yes, I will change to
    Order Allow,Deny
    Allow from xxx.xxx.xxx.xxx

 

 

Similar Threads

  1. Make static url in .htaccess?
    By fancyui in forum General Questions
    Replies: 0
    Last Post: 20 Aug 2010, 05:08 PM
  2. .htaccess file for root directory needed
    By samar777 in forum Installing on a Linux/Unix Server
    Replies: 4
    Last Post: 28 Jul 2010, 03:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg