LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Quick iptables question... (https://www.linuxquestions.org/questions/linux-networking-3/quick-iptables-question-78189/)

FlyingMoose 08-01-2003 08:55 PM

Quick iptables question...
 
Ok, I want to use rsync, but I want to be the only one allowed in. So, I do this:

iptables -A INPUT -p tcp --dport rsync -s ! 1.2.3.4 -j REJECT

my thinking is that this will add a rule, where if a packet is going to the rsync port, and did not come from my IP (1.2.3.4), it will be rejected. However, this rejects ALL packets, whether from my IP or not.

iptables -L gives the following:

Chain INPUT (policy ACCEPT)
target prot opt source destination
REJECT tcp -- !alb-24-92-43-34.nycap.rr.com anywhere tcp dpt:rsync reject-with icmp-port-unreachable

If it matters, I'm using Debian woody r1 with the 2.4bf kernel, upgraded to the newest version (2.4.18-bf2.4). Thanks.

Corin 08-01-2003 09:56 PM

To see exactly what is happening, try this

${IPTABLES} -t filter -N LOG_RSYNC 2> /dev/null
${IPTABLES} -t filter -F LOG_RSYNC
${IPTABLES} -t filter -A LOG_RSYNC -j LOG --log-level 6 --log-prefix "iptables +RSYNC+ : " -m limit --limit 10/min
${IPTABLES} -t filter -A LOG_RSYNC -j DROP

${IPTABLES} -A INPUT -p tcp --dport rsync -s ! 1.2.3.4 -j LOG_RSYNC

then do a

tail -f /var/log/kern.log

(assuming log level 6 points to kern.log on your syslog configuration)

and try rsyncing

Does the rsync server use TCP wrappers?

If it does then you need to worry about hosts.allow entries.

FlyingMoose 08-01-2003 11:35 PM

Nevermind, I'm stupid... I assumed that my reverse DNS had my real IP in it (I have a dynamic IP) but it was incorrect. Sorry to bother ya. :)


All times are GMT -5. The time now is 11:51 AM.