Iptables Rules to allow Git

I have a client that wanted to use Git on their VPS. My firewall was blocking it and I had to do a little research. Git uses port 9418 to communicate. You don’t want to open up the port externally so I used stateful inspection to open the port only if we established the connection.

Here are the iptables rules:

# allow git
iptables -A OUTPUT -o eth0 -p tcp –dport 9418 -m state –state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -i eth0 -p tcp –sport 9418 -m state –state ESTABLISHED -j ACCEPT

This entry was posted in Web Hosting. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>