LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 05-12-2019, 01:40 AM   #1
drillsar
Member
 
Registered: Jan 2017
Posts: 144

Rep: Reputation: Disabled
Apache2.4 Ip address allow?


I am trying to lock my wp-admin wordpress to just my ip address

I have the following:

I added this in my VirtualHost configuration

<Files "wp-login.php">
Require ip 123.123.123.123
</Files>

It says You don't have permission to access

I can't figure out why..
 
Old 05-12-2019, 03:00 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by drillsar View Post
I am trying to lock my wp-admin wordpress to just my ip address

I have the following:

I added this in my VirtualHost configuration

<Files "wp-login.php">
Require ip 123.123.123.123
</Files>

It says You don't have permission to access

I can't figure out why..
I guess you've restarted apache after adding the above.
Then make sure the IP you're using to access wp-login.php is the one listed above and you have cleared your browser's cache.
 
Old 05-12-2019, 09:46 AM   #3
drillsar
Member
 
Registered: Jan 2017
Posts: 144

Original Poster
Rep: Reputation: Disabled
Yes did all that but still says I don't have permission.
 
Old 05-12-2019, 10:45 AM   #4
drillsar
Member
 
Registered: Jan 2017
Posts: 144

Original Poster
Rep: Reputation: Disabled
In the error log it says the following:

client 192.168.1.1 denied by server configuration. This is my router. If I add Reguire IP 192.168.1.1 It works but curious why this and not my public ip?

Is that the right approach and it will deny any other IP that tries to access?

<Files wp-login.php>
Require ip 192.168.1.1 #my public ip don't work
</Files>
<Files admin-ajax.php>
Require all granted
</Files>
 
Old 05-12-2019, 12:44 PM   #5
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
client 192.168.1.1 denied by server configuration. This is my router. If I add Reguire IP 192.168.1.1 It works but curious why this and not my public ip?

Is that the right approach and it will deny any other IP that tries to access?
It looks like your router is not just forwarding port 80 to your webserver, but it's acting like a reverse proxy to it.
I guess you should look at the router configuration to see why it's behaving like this.

Anyway, allowing access to the wp-login page, just to your IP it's a good security measure.
You can use also other tools, like fail2ban to stop brute force attacks to wp-login
 
Old 05-12-2019, 03:52 PM   #6
drillsar
Member
 
Registered: Jan 2017
Posts: 144

Original Poster
Rep: Reputation: Disabled
I have no idea where to look why the router is doing this, is it the /etc/hosts, /etc/resolv.conf or dynamic dns?
 
Old 05-13-2019, 02:04 AM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by drillsar View Post
I have no idea where to look why the router is doing this, is it the /etc/hosts, /etc/resolv.conf or dynamic dns?
I don't know.
You should read the router's documentation and perhaps use your favorite search engine to see what you can do.

Regards
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
apache2 (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 spedax Linux - Server 1 09-22-2011 11:47 AM
How to allow a router's address in /etc/hosts.allow? xpucto Linux - Newbie 1 02-26-2008 05:28 AM
Apache2 > "order allow,deny" to allow subdirectories cbonar Linux - Server 13 10-27-2007 03:08 PM
how to get ip address, broadcast address, mac address of a machine sumeshstar Programming 2 03-12-2005 04:33 AM
iptables - drop all -> allow needed OR allow all -> drop specific lucastic Linux - Security 5 12-21-2004 02:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 09:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration