Re: Acces ftp passive mode with iptables

From: ujay (ujay50-NOSPAM-@shaw.ca)
Date: 01/18/02

  • Next message: Jem Berkes: "Re: Selective Apache Access"

    From: ujay <ujay50-NOSPAM-@shaw.ca>
    Date: Fri, 18 Jan 2002 05:15:07 GMT
    
    

    Michael (Cegonha) wrote:

    > Hi !
    >
    > How can accept ftp passive mode with iptables ?
    >
    > thanks
    >
    > Michael
    >

    passive mode involves connection on ports >1023 on both machines, passed
    via ftp by the PORT command to the connecting client. The
    ip_conntrack_ftp module recognizes the connection as RELATED to the
    original outgoing connection to port 21.

    modprobe ip_conntrack
    modprobe ip_conntrack_ftp

    # ftp conntrack

    # This involves a connection INbound from port 20 on the remote machine,
    to a local port
    # passed over the ftp channel via a PORT command. The ip_conntrack_ftp
    module recognizes
    # the connection as RELATED to the original outgoing connection to port
    21 so we don't
    # need NEW as a state match.

    iptables -A INPUT -i ethx -p tcp --sport 20 -m state --state
    ESTABLISHED,RELATED -j ACCEPT

    iptables -A OUTPUT -o ethx -p tcp --dport 20 -m state --state
    ESTABLISHED -j ACCEPT

    # passive ftp

    UNPRIV="1024:65535"

    iptables -A INPUT -i ethx -p tcp --sport $UNPRIV --dport $UNPRIV -m
    state --state ESTABLISHED -j ACCEPT

    iptables -A OUTPUT -o ethx -p tcp --sport $UNPRIV --dport $UNPRIV -m
    state --state ESTABLISHED,RELATED -j ACCEPT



    Relevant Pages

    • RE: Telnet/ftp problems SBS2000
      ... Please make sure your client computers are configured as both Firewall ... will find two options "Enable folder view for FTP sites" and "Use Passive ... that the control connection has been successfully established, ... (other than port 21) ...
      (microsoft.public.windows.server.sbs)
    • Re: IPSwitch, Inc. WS_FTP Server
      ... > bounce attack as well as PASV connection hijacking. ... > The FTP bounce vulnerability allows a remote attacker to cause the ... > anonymously along with any internal addresses that the FTP server has ... That means it's got to handle a PORT ...
      (Bugtraq)
    • RE: FTP Window of opportunity?
      ... target on the line when in reality it was just a firewall lying to them. ... The connection connects and then immediately ... Subject: FTP Window of opportunity? ... the FTP port shows up. ...
      (Pen-Test)
    • Re: Passive means what during FTP?
      ... :227 Entering Passive Mode ... :ftp: connect: No route to host ... The FTP data transfer uses a connection that is separate from the ... address and port number to connect to for the data transfer. ...
      (comp.os.linux.setup)
    • Re: Iptables FTP question
      ... think all other related would be from specific modules,the FTP and IRC ... Keep in mind that connection ... source port of 20 if it is for port mode data connections(for a standard ... I would also break down your rules into chains instead of appending such ...
      (comp.security.firewalls)

  • Quantcast