FTP Follies

I set out tonight to rebuild the websites, and instead discovered a wee little gotcha in firewalling.

It seems that ftp builds not one but two connections, one for control and one for data. (It’s an old protocol, and security didn’t matter when everyone knew everyone).. Go see a book for the details, but the end result is that plain vanilla IPtables will NOT recognize the second connection (data) as RELATED to the first. Bill McCarty in Linux Firewalls, which I have been relying on seems to have made the same mistake.

I don’t have an ftp server inside the firewall, but we need to both upload and download to other servers. If you just enable port 21 –state NEW, you can start the session, but die on the PORT command.

I went googling, and sure enough the maintainers of iptables do ftp too. The secret is to modprobe in ip_nat_ftp, and ip_conntrack_ftp, and then magically ftp works.

Predictably these modules are not reloaded automatically on reboot. There’s a /etc/modules.conf file that the man page implies will cause them to be loaded, but there’s at least one level of indirection, because that’s one weird looking file. But that’s a problem for another day.

This entry was posted in Tech Stuff. Bookmark the permalink. Trackbacks are closed, but you can post a comment.

Post a Comment

Your email is never published nor shared. 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=""> <s> <strike> <strong>

*
*

  • Recent Posts

  • Lisa’s Twitter Stream

    Follow @LisaMackhill on twitter.

  • Archives

  • Categories

  • Meta

  • Google site search

    Custom Search