LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 05-29-2003, 01:47 AM   #1
florin
LQ Newbie
 
Registered: May 2003
Posts: 2

Rep: Reputation: 0
Post RH-Lokkit-0-50 problem


hello!

I tried to configure my firewall (under RH 9.0) to allow secure access only from one computer and also to permit ping from that machine, but didn't work! :-(

here is the example:
...
-A RH-Lokkit-0-50-INPUT -p tcp -m tcp -s 192.168.1.1/32 --dport 22 --syn -j ACCEPT
-A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 22 --syn -j REJECT
...
-A RH-Lokkit-0-50-INPUT -p icmp -s 192.168.1.1/32 -j ACCEPT
-A RH-Lokkit-0-50-INPUT -p icmp -j REJECT
...

what's wrong here? there is a syntax problem? have somebody any sugestion? do you know some usefull links with some RH-Lokkit-0-50 firewall examples?

thanks a lot!

florin
 
Old 05-29-2003, 12:50 PM   #2
Pcghost
Senior Member
 
Registered: Feb 2003
Location: The Arctic
Distribution: Fedora, Debian, OpenSuSE and Android
Posts: 1,820

Rep: Reputation: 46
RH-Lokkit, or Gnome-Lokkit is only used if you have really simple needs. It is just a script generator for iptables. The way you would write that first rule would be
From the command line enter the following

iptables -A INPUT -p tcp -s ! 192.168.1.1 --destination-port 22 -j DROP
(This will accept port 22 connections only from that ip address).

And the second rule
iptables -A INPUT -p icmp -s ! 192.168.1.1 -j DROP

Give that a shot..
 
Old 05-30-2003, 08:04 AM   #3
florin
LQ Newbie
 
Registered: May 2003
Posts: 2

Original Poster
Rep: Reputation: 0
hey!

thanks for your reply!

I used those roules, but ... any changes. Then, I wrote a firewall script, like following:

#!/bin/bash

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

/sbin/iptables -F INPUT
/sbin/iptables -F OUTPUT
/sbin/iptables -F FORWARD

/sbin/iptables -F ping
/sbin/iptables -X ping
/sbin/iptables -N ping

/sbin/iptables -F ssh
/sbin/iptables -X ssh
/sbin/iptables -N ssh

/sbin/iptables -F ftp
/sbin/iptables -X ftp
/sbin/iptables -N ftp

/sbin/iptables -A INPUT -p icmp -j ping

/sbin/iptables -A INPUT -p tcp --dport 21 -j ftp
/sbin/iptables -A INPUT -p udp --dport 21 -j ftp


#/sbin/iptables -A INPUT -p tcp -s ! 192.168.3.1/32 --dport 22 -j DROP
#/sbin/iptables -A INPUT -p udp -s ! 192.168.3.1/32 --dport 22 -j DROP

/sbin/iptables -A INPUT -p tcp --dport 22 -j ssh
/sbin/iptables -A INPUT -p udp --dport 22 -j ssh

/sbin/iptables -A ping -s 192.168.1.1/32 -j ACCEPT
/sbin/iptables -A ping -s 192.168.1.110/32 -j ACCEPT
/sbin/iptables -A ping -j DROP

/sbin/iptables -A ftp -s 192.168.1.0/24 -j ACCEPT
/sbin/iptables -A ftp -s 192.168.3.0/24 -j ACCEPT
/sbin/iptables -A ftp -j DROP

/sbin/iptables -A ssh -s 192.168.1.1/32 -j ACCEPT
/sbin/iptables -A ssh -s 192.168.1.110/32 -j ACCEPT
/sbin/iptables -A ssh -j DROP

but also ... didn't work :-( The hosts.allow file is well configured, and can't ping or have ssh connection from the other machine ...

what could be wrong? any suggestion?

greets!

florin
 
Old 05-31-2003, 11:17 AM   #4
Pcghost
Senior Member
 
Registered: Feb 2003
Location: The Arctic
Distribution: Fedora, Debian, OpenSuSE and Android
Posts: 1,820

Rep: Reputation: 46
Don't use the path /sbin/ in your script. If Iptable is running it is not needed and clutters up the script.

Using custom tables (like ssh above) can make iptables more confusing than it needs to be. Are you using this firewall to protect against machines on your internal network? I see the rule

/sbin/iptables -A ftp -s 192.168.1.0/24 -j ACCEPT

and I wonder why not just say

iptables -A INPUT -i $INTINT -s 192.168.1.0/24 -j ACCEPT

which would accept ALL connections on the internal interface from the ip range 192.168.1.0/24

I try to stick with just the following tables
INPUT
OUTPUT
FORWARD
PREROUTING
POSTROUTING

Tends to make things easier and cleaner in the scripting.
I would check out "Red Hat Linux Firewalls" from your local library if they have it. It's the greatest book ever on iptables.

I hope this helps. Describe exactly what connections you want to allow from the Internet and from the local network and we'll take another stab at this.. :-)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
allow vnc through lokkit meping Linux - Software 3 09-29-2005 12:07 PM
how to activate lokkit esdee Linux - Security 1 08-25-2004 12:26 PM
Is there anything else like lokkit? Rotwang Linux - Networking 3 05-28-2004 12:15 PM
Lokkit stew Linux - Networking 3 05-23-2003 10:01 AM
Bypassing lokkit, gnome-lokkit and redhat-config-securitylevel on RedHat 8.0 Son77 Linux - Security 3 10-18-2002 03:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 01:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration