Daystate wrote:How can I restrict access to X3 control panel to IPs from one country as I do not have static IP but can happily limit access to one country only.
There is no simple recipe to allow IPs from ONE country, as one country (depending on what country) can have thousands of IP ranges. For example Germany:
https://lite.ip2location.com/germany-ip-address-ranges
Normally, you can set the allowed RANGE to the IP range of your internet provider. Or if you have MULTIPLE internet providers (for example mobile internet, office, home etc), you could set a couple of IP ranges from your internet service providers. For me, I have used something like this earlier (example):
# ADMIN PROTECT, IP only
RewriteCond %{REQUEST_URI} ^(.*)panel
RewriteCond %{REMOTE_ADDR} !^217\.237\.156\.[0-9]+
RewriteCond %{REMOTE_ADDR} !^2\.20\.248\.[0-9]+
RewriteRule .* - [F,NS]
In the above example, I am allowing access from only IP ranges
217.237.156.XXX and
2.20.248.XXX. Normally, your ISP will keep you on a single IP range like that, so it will suffice to allow login only from your IP range.
If you used a service like
Cloudflare, you could utilize the "CF-Country-Code" header that they forward for each request.