Re: iptables & tcp wrappers

From: Toby Heywood (toby.heywood_at_doofruds.net)
Date: 09/28/04

  • Next message: Bowes, Ronald (EST): "RE: iptables & tcp wrappers"
    Date: Mon, 27 Sep 2004 23:02:25 +0100
    To: Meatplow <greg@meatplow.com>
    
    
    

    I have to admit that I am not the best to advise on iptables but I
    believe I can answer your questions.

    Try using

    #iptables -A INPUT -p tcp -s PUT_IP_HERE -d 0/0 --syn -j LOG
    #iptables -A INPUT -p tcp -s PUT_IP_HERE -d 0/0 --syn -j DROP

    For additional security I would restrict the interface that you expect
    traffic to come in on as well. For example;

    #iptables -A INPUT -i eth2 -s ip_address -d 0/0 -p tcp --syn -j DROP

    If you want line numbers then try;

    #iptables -L -v --line-numbers

    With regards to blocking access to ssh and allowing from only a
    specified ip, if would do the following

    1) #iptables -P INPUT DROP
    2) #iptables -A INPUT -i eth2 -s example_ip -d ip_of_server -p tcp -m
    tcp --dport ssh -m state --state NEW,ESTABLISHED -j ACCEPT

    Step one sets the default policy for the INPUT table, thus dropping all
    incoming traffic. Step two allows ssh access from the specified ip only
    if it is coming in via interface eth2.

    Hope this is what you wanted.

    Toby

    Meatplow wrote:

    >-----BEGIN PGP SIGNED MESSAGE-----
    >Hash: SHA1
    >
    >
    >Hello.
    >
    >I'm running RH Enterprise edition.
    >
    >I'm relatively new to iptables. I am getting the common intrusion
    >attempts with some of the common uses of test/guest/root/ and a
    >couple others I've been able to add the IPs to the to iptables.,
    >but
    >I'd really like a log that tells me the info that I want to know.
    >
    >My basic input command is this :
    >#iptables -A INPUT -p tcp -s PUT_IP_HERE -d 0/0 --syn -j DROP
    >
    >iptables seem a little convoluted. Example. To delete a line -
    >supposedly give it a line and it will be deleted/modified. My
    >problem is even with #iptable -L -v there is no line number ?
    >
    >My goal is to block all incoming ssh attempts except IP#.
    >This is where I got into hosts.allow/deny as mentioned below.
    >
    >I've tried to find many different types of commands and it works to
    >some degree, but not the way I'd expect it to.
    >
    >Any help would be appreciated. I'm not completely sure that I
    >understand iptables as well as I want/need to. I've also toyed
    >around with the hosts.allow/hosts.deny and have not been successful.
    >
    >
    >
    >I know that there is a lot of info in here, and I'm tired. I'll
    >leave it at that
    >
    >
    >Thanks in advance for your time and help.
    >
    >Meatplow
    >greg ta meatplow.com
    >
    >
    >Thanks again.
    >
    >-----BEGIN PGP SIGNATURE-----
    >Version: PGPfreeware 6.5.8 for non-commercial use <http://www.pgp.com>
    >
    >iQA/AwUBQVSBsR42gIcyjrnjEQJIqwCfWAShp7r+J1XNNjQq6sbvvD03WZ8AoNrg
    >ctQ837g5pQDafgBhTTeeMr1V
    >=niWK
    >-----END PGP SIGNATURE-----
    >
    >
    >
    >
    >
    >
    >

    
    



  • Next message: Bowes, Ronald (EST): "RE: iptables & tcp wrappers"

    Relevant Pages

    • Re: Layering portsentry and ipchains
      ... >> PortSentry well iptables notice a system scanning ports on your ... Appart from ssh, I allow only related/established. ... >> list of trusted sites, and you can always manually overide the block. ... rather than running off the logs would be preferable. ...
      (comp.os.linux.security)
    • [fw-wiz] iptables reject all packets for ssh port 22 except for my host name/ip issue ...
      ... I had iptables set to only allow ssh on port 22 from my hostname and ip ... address (was not sure if host or ip was the proper way, ... # Disable all other ssh access ...
      (Firewall-Wizards)
    • Re: SSH connection problem
      ... could be blocking access to port 22. ... not allowing you access to that port. ... ps -A | grep iptable gives nothing so i guess iptables is not running. ... You've demonstrated that you can ssh between the 2 boxes in one ...
      (Ubuntu)
    • Re: IPTABLES: Per erfolgreichem SSH Login Ports =?iso-8859-15?Q?=F6ffnen?=
      ... Also sollen weitere Ports z.B. nur mit dem korrekten Keyfile ... Entkopple doch den Teil, der iptables aufruft, von dem teil, der ... wenn sich jemand per ssh einloggt. ... kommandos absetzt und keinen User-input entgegen nimmt. ...
      (de.comp.security.firewall)
    • forwarding ssh connections through a gateway
      ... I was playing with iptables and the 'ssh -p' command today trying to ... One problem is the ssh client side is getting the key back from the ... echo "ssh forwarding for port 1222" ...
      (comp.os.linux.networking)