Page 1 of 1

Limit /admin acccess by ip

Posted: Tue Apr 07, 2020 12:44 pm
by namit
Hi all,

Just wondering if anyone know easy to to limit access to the /admin control panel by external ip address like an iptable room or htaccess file.

Thanks appreciate any input.

Re: Limit /admin acccess by ip

Posted: Tue Jul 11, 2023 7:28 pm
by nehakakar
Hi Namit,
Yes you can block on both IPTables or an .htaccess file.
Using IPTables you can run the following command to allow access from a specific IP address and block all others.

Code: Select all

iptables -A INPUT -p tcp --dport 80 -s YOUR_IP_ADDRESS -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j DROP
Save the IPTables rules to persist across reboots
iptables-save > /etc/iptables/rules.v4

Then Restart the IPTables.
systemctl restart iptables

____________________

On .htaccess here how you can block.

Code: Select all

order deny,allow
deny from all
allow from YOUR_IP_ADDRESS
Both methods will restrict access
Good luck