having some trouble with fresh squid server on a VPS box.
I have the box secured with iptables – simple iptables -P INPUT DROP, and only my home ip is allowed to connect.
The problem is, whatever http_port I set in squid.conf, squid does not listen when default action on INPUT chain is DENY.
I have an openvpn server on the same box and it works flawlessly without any settings except allowing my home IP to connect (2nd rule).
So this config works and squid listens on specific port:
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT all -- <myip> anywhere
ACCEPT all -- 192.168.0.0/24 anywhere
root@aatest:~# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 26548/sshd
tcp 0 0 0.0.0.0:13630 0.0.0.0:* LISTEN 887/openvpn
tcp 0 0 10.8.0.1:13631 0.0.0.0:* LISTEN 30715/(squid-1)
tcp6 0 0 :::22 :::* LISTEN 26548/sshd
But this one does not work –
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT all -- <myip> anywhere
ACCEPT all -- 192.168.0.0/24 anywhere
root@aatest:~# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 26548/sshd
tcp 0 0 0.0.0.0:13630 0.0.0.0:* LISTEN 887/openvpn
tcp6 0 0 :::22 :::* LISTEN 26548/sshd
So I need some help to figure out which exact rule I must add so squid would start listening correctly while iptables would still allow only one IP to connect to server. I tried many types of rules – allowing local interface, local address, dport, etc. Squid just won’t start to listen unless I allow any-any with default input policy or additional rule.