tinyproxy
tinyproxy

Reputation: 385

iptables allow request started by server

As you can image, we need iptables to block the ports we do not need to protect server. But I need to request some third party resource, and I got confuse on how to do it. Here are my iptables rules

iptables -F
iptables -A INPUT -p UDP -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -s 110.75.147.65/32 -j ACCEPT
iptables -A INPUT -s localhost -j ACCEPT
iptables -A INPUT -j DROP

And 110.75.147.65/32 is the one of third party servers' IP, I wonder if there are any way to allow all connection started by my server such as curl https://www.google.com/, otherwise I need to add all my third party servers' IP to the iptables rules.

Upvotes: 1

Views: 1119

Answers (1)

tschodt
tschodt

Reputation: 164

How about

iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

Upvotes: 4

Related Questions