iptables woes on woody, not accepting inbound connections

Ask a Question related to Debian, Design and Development.

  1. #1

    Default iptables woes on woody, not accepting inbound connections

    Hi,

    I'm in the middle of trying to build a secure webserver, using stock
    woody (2.4.18-bf2.4),
    the box is completely updates from last night. I install just the base
    (never used deselect or taskselect) during the install,
    Once it was installed, I have installed:

    apache
    php4
    ssh
    dnsutils
    lynx
    iptables (choose not to run the init.d script)

    The machine can surf the web no problem and accept inbound port 80 and
    22 connections from other boxes on the same subnet.
    (the box is at present not locked down, as I'm making sure certain
    configurations work, then I will reinstall off the network and build it
    up that way.)

    I decided to test iptables, using a very,very basic script below:

    #/bin/bash

    /sbin/modprobe iptables
    /sbin/modprobe ipt_state
    /sbin/modprobe ip_conntrack

    /sbin/iptables -F
    /sbin/iptables -X

    /sbin/iptables -P INPUT DROP
    /sbin/iptables -P OUTPUT DROP
    /sbin/iptables -P FORWARD DROP

    /sbin/iptables -A INPUT -i lo -j ACCEPT
    /sbin/iptables -A OUTPUT -o lo -j ACCEPT

    /sbin/iptables -A OUTPUT -p udp -o eth0 --dport 53 --sport 1024:65535 -j
    ACCEPT
    /sbin/iptables -A INPUT -p udp -i eth0 --sport 53 --dport 1024:65535 -j
    ACCEPT

    /sbin/iptables -A OUTPUT -o eth0 -m state --state ESTABLISHED,RELATED -j
    ACCEPT

    /sbin/iptables -A INPUT -p tcp -i eth0 --dport 22 --sport 1024:65535 -m
    state --state NEW -j ACCEPT
    /sbin/iptables -A INPUT -p tcp -i eth0 --dport 80 --sport 1024:65535 -m
    state --state NEW -j ACCEPT

    I can do outbound nslookup requests no problem, but it now fails to
    allow inbound connections at all, to either port 80 or port 22.

    I have another box (this one is running redhat 8), which I'm replacing
    with debian woody, so I killed that and loaded on a bloat riddled basic
    rh install, ran the same script and that works as expected, allowing
    inbound connections, all the same modules are loaded.

    Just for the record, I'm running a woody/sarge/sid mix on my laptop and
    that does the same as my test woody box, it just refused to accept
    inbound connections

    This is driving my mad, can anyone possibly point me in the right
    direction, as it seems there may be something debian specific that I'm
    missing.

    cheers in advance

    Mark


    --
    To UNSUBSCRIBE, email to [email]debian-user-request@lists.debian.org[/email]
    with a subject of "unsubscribe". Trouble? Contact [email]listmaster@lists.debian.org[/email]
    Mark C Guest

  2. Similar Questions and Discussions

    1. Server not accepting connections
      I am now completely unable to connect to one of my client's website's using Contribute. I had to uninstall all of my CS3 programs (long story), and...
    2. Does anyone get the error message "Contribute cannotconnect or is not accepting connections"?
      Says it all. Connection is fine and enabled. Can't publish, cancel or edit my draft. Seems to happen randomly. Anyone ever had this problem?
    3. Not accepting connections
      My problem is exactly the same as what has been described here except that once a page is being edited, they get the "Contribute could not connect...
    4. Server is Down, not accepting connections ..
      I get this mssg about 8 times in 10 when I'm trying to upload to my site using Contribute. Anybody know what's happening, or if there's a fix for...
    5. dosemu-freedos on woody / using glibc from woody+sid?
      On Sat, 2003-06-28 at 13:50, Felix Natter wrote: You could grab the dosemu and dosemu-freedos deb-src packages and build them yourself. It's...
  3. #2

    Default Re: iptables woes on woody, not accepting inbound connections

    Just to confirm, if I do not use state connections, and use static
    instead i.e:

    /sbin/iptables -A INPUT -p tcp -i eth0 --dport 22 \
    --sport 1024:65535 -j ACCEPT

    /sbin/iptables -A OUTPUT -p tcp -o eth0 --sport 22 \
    --dport 1024:65535 -j ACCEPT

    It works perfectly.

    Mark


    --
    To UNSUBSCRIBE, email to [email]debian-user-request@lists.debian.org[/email]
    with a subject of "unsubscribe". Trouble? Contact [email]listmaster@lists.debian.org[/email]
    Mark C Guest

  4. #3

    Default Re: iptables woes on woody, not accepting inbound connections

    On Tue, Jul 22, 2003 at 11:56:48PM +0100, Mark C wrote:
    >
    > I decided to test iptables, using a very,very basic script below:
    >

    [ ... ]

    > This is driving my mad, can anyone possibly point me in the right
    > direction, as it seems there may be something debian specific that I'm
    > missing.
    >

    I would have add LOG rules in order to try and found out what happens
    to those inbound packets. Maybe this is not the firewall but something
    else, like tcpwrappers?
    --

    Shaul Karl, shaulka@bezeqint.n e t


    --
    To UNSUBSCRIBE, email to [email]debian-user-request@lists.debian.org[/email]
    with a subject of "unsubscribe". Trouble? Contact [email]listmaster@lists.debian.org[/email]
    Shaul Karl Guest

  5. #4

    Default Re: iptables woes on woody, not accepting inbound connections

    Have a look at Shorewall ([url]http://www.shorewall.net[/url]).

    It's a lot easier than struggling directly with iptables and Tom Eastep
    is a great manager of his list at [email]shorewall-users@lists.shorewall.net[/email].

    John





    On Wed, 2003-07-23 at 13:30, Shaul Karl wrote:
    > On Tue, Jul 22, 2003 at 11:56:48PM +0100, Mark C wrote:
    > >
    > > I decided to test iptables, using a very,very basic script below:
    > >
    >
    >
    > [ ... ]
    >
    >
    > > This is driving my mad, can anyone possibly point me in the right
    > > direction, as it seems there may be something debian specific that I'm
    > > missing.
    > >
    >
    >
    > I would have add LOG rules in order to try and found out what happens
    > to those inbound packets. Maybe this is not the firewall but something
    > else, like tcpwrappers?
    > --
    >
    > Shaul Karl, shaulka@bezeqint.n e t
    >
    >
    > --
    > To UNSUBSCRIBE, email to [email]debian-user-request@lists.debian.org[/email]
    > with a subject of "unsubscribe". Trouble? Contact [email]listmaster@lists.debian.org[/email]
    >


    --
    To UNSUBSCRIBE, email to [email]debian-user-request@lists.debian.org[/email]
    with a subject of "unsubscribe". Trouble? Contact [email]listmaster@lists.debian.org[/email]
    John Hedge Guest

  6. #5

    Default Re: iptables woes on woody, not accepting inbound connections


    Once upon a time Shaul Karl was quoted as saying:
    > would have add LOG rules in order to try and found out what happens
    > to those inbound packets.
    Sorry I missed that off the post, logging does actually drop inbound
    packets on eth0 to ssh or apache, it would seem after banging my head on a
    wall, that using statefull inspection is not working or I missunderstood
    something,
    In hte past I have always used static rules, as these are very similar to
    the old ipchans way, using static tunles work fine, the connections are
    received etc, but with statefull they are dropped...
    > else, like tcpwrappers?
    Nope my system works fine with my hosts.allow/hosts.deny setup,
    adding a firewalll to this equation would not effect this issue at all.


    --
    To steal ideas from one person is plagiarism,
    to steal ideas from many is research.



    --
    To UNSUBSCRIBE, email to [email]debian-user-request@lists.debian.org[/email]
    with a subject of "unsubscribe". Trouble? Contact [email]listmaster@lists.debian.org[/email]
    Mark C Guest

  7. #6

    Default Re: iptables woes on woody, not accepting inbound connections


    Once upon a time John Hedge was quoted as saying:
    > Have a look at Shorewall ([url]http://www.shorewall.net[/url]).
    I really want to only use standard debian packages, apart from using LIDS
    on a 2.4.21 kernel latter on, I have my main standalone firewall (Cisco
    Pix 515e), and I really want to setup a basic firewall on each server
    (both on hte DMX and SIN), to make sure that only those connections that I
    want specific to each server can get in and out of the servers.

    > It's a lot easier than struggling directly with iptables and Tom Eastep
    > is a great manager of his list at [email]shorewall-users@lists.shorewall.net[/email].
    I'm not struggling with iptables, I have always been able to set it up
    perfectly ok, understand the way it works without having to rack my
    brains,
    the only thing I cannot get working is using the -m state --state ? way of
    working, working with the old way (i.e ipchans way of doing stiff, static
    rules) I have no problem with


    Mark

    --
    To steal ideas from one person is plagiarism,
    to steal ideas from many is research.



    --
    To UNSUBSCRIBE, email to [email]debian-user-request@lists.debian.org[/email]
    with a subject of "unsubscribe". Trouble? Contact [email]listmaster@lists.debian.org[/email]
    Mark C Guest

  8. #7

    Default Re: iptables woes on woody, not accepting inbound connections

    Hi Mark,

    On Tue, 22 Jul 2003 23:56:48 +0100, Mark C wrote:
    > I can do outbound nslookup requests no problem, but it now fails to
    > allow inbound connections at all, to either port 80 or port 22.
    At a quick look I think the problem is here.....
    > /sbin/iptables -A INPUT -p tcp -i eth0 --dport 22 --sport 1024:65535 -m
    > state --state NEW -j ACCEPT
    > /sbin/iptables -A INPUT -p tcp -i eth0 --dport 80 --sport 1024:65535 -m
    > state --state NEW -j ACCEPT
    These rules will allow incoming connections to ports 22 and 80, BUT the
    --state rule limits this to only new connections. Once the connection is
    established, this rule is ignored. So your external clients can connect
    to the server, but cannot send any actual data to it!

    I think you need an additional rule which looks like this:

    iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT

    (I haven't tried any of this out btw; it's just some educated guesswork
    after looking at your firewall rules.)

    --
    rd.


    --
    To UNSUBSCRIBE, email to [email]debian-user-request@lists.debian.org[/email]
    with a subject of "unsubscribe". Trouble? Contact [email]listmaster@lists.debian.org[/email]
    Richard Downer Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139