block server access/connection to remote url
Hi, I'd like to block any access from my server to a specific url and am wondering the/a best way to go about this?
I have root access to my fully-managed VPS.
My host said that they add the url to be blocked by iptables.
However, looking online about using iptables this way shows that it can work but is perhaps not the best way... one person on serverfault put it this way:
" It's possible, but it's like trying to weld a Phillips bit on the side of a hammer so you can use it to drive screws."
...which is funny, hope you got a laugh too ;)
So, host says they can use the IP address currently associated with the URL so that iptables is better able to block outgoing connection for the time being... my concern is that the IP may change in future, which is why I want to just block the URL.
To be specific, I want to block connection to a specific URL (or is it URI?) that looks like this:
(http:// equivalent also) If its not practical to be so specific, I am fine blocking access to the domain name entirely. Wondering if there is a way to do this by messing with DNS - eg. make it so that the server is not able (one way or another) to effectively resolve the name to an IP or some such... this is something like I would hack together on my PC via my hosts file... don't know enough about how to approach this with my server... :) Any guidance appreciated, thanks very much.
https://example.com/wp-admin/admin-ajax.php
(http:// equivalent also) If its not practical to be so specific, I am fine blocking access to the domain name entirely. Wondering if there is a way to do this by messing with DNS - eg. make it so that the server is not able (one way or another) to effectively resolve the name to an IP or some such... this is something like I would hack together on my PC via my hosts file... don't know enough about how to approach this with my server... :) Any guidance appreciated, thanks very much.
-
Wondering if there is a way to do this by messing with DNS - eg. make it so that the server is not able (one way or another) to effectively resolve the name to an IP or some such... this is something like I would hack together on my PC via my hosts file... don't know enough about how to approach this with my server.
Hello, You could modify the /etc/hosts file on your server, though keep in mind it's unsupported. It's one of the methods discussed on the following URL: How to deny all the communications between our server and particular domain and its subdomains? Thank you.0 -
Hello, You could modify the /etc/hosts file on your server, though keep in mind it's unsupported. It's one of the methods discussed on the following URL:
So yeah, that all makes good sense, and the question seems to be: How to add a wildcard DNS record (*.example.com A 127.0.0.1) to the local DNS server on my server? I'll google and check docs, etc... if you can save me some time re. what to edit and where, well, that'd be great :) Cheers, Max0 -
How to add a wildcard DNS record (*.example.com A 127.0.0.1) to the local DNS server on my server?
Hello, You'd create a DNS zone for "example.com" using "WHM >> Add a DNS Zone" and then add the wildcard entry using "WHM >> Edit DNS Zone". However, I believe editing the /etc/hosts file on the server is the better approach as far as workarounds because outgoing connections may not always use the local server for DNS resolution. Thank you.0
Please sign in to leave a comment.
Comments
3 comments