Answer the question
In order to leave comments, you need to log in
How to restrict outgoing requests from a specific user or IP on Ubuntu 16.04.4?
Hello!
There was a problem on the server. A virus has appeared on one of the sites (which is not known), and this virus uses server resources. The server received a complaint (and specifically to a specific IP). If the problem is not solved, then the next 24 hours IP on the server will be blocked.
How can I block outgoing connections from a specific IP address or user?
Tried using ufw service but it didn't work
sudo ufw deny from 123.456.789.123
Answer the question
In order to leave comments, you need to log in
On "naked" iptables (and, accordingly, in any Linux distribution), the task can be solved like this:
modprobe nf_conntrack
iptables -A OUTPUT -s ip_сервера -m state --state established,related -j ACCEPT
iptables -A OUTPUT -s ip_сервера -m state --state new,invalid -j DROP
conntrack -F
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question