LinuxQuestions.org
Review your favorite Linux distribution.
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-27-2003, 11:44 AM   #1
Smooth
Member
 
Registered: May 2003
Location: /home/melbourne
Distribution: RH 8.0
Posts: 39

Rep: Reputation: 15
Question Firewall setup


How to setup a firewall to deny or allow certain hosts to connect to my computer?
 
Old 05-27-2003, 11:46 AM   #2
manthram
Member
 
Registered: Feb 2002
Location: Fairfax, VA
Distribution: RedHat 8, Mandrake9.1, Slack9
Posts: 456

Rep: Reputation: 31
download fwbuilder

or guarddog

and set them up
 
Old 05-27-2003, 02:10 PM   #3
markus1982
Senior Member
 
Registered: Aug 2002
Location: Stuttgart (Germany)
Distribution: Debian/GNU Linux
Posts: 1,467

Rep: Reputation: 46
Or use a pretty nailed down firewall written from scratch :-)
 
Old 05-28-2003, 12:21 AM   #4
yenonn
Member
 
Registered: Feb 2003
Location: Malaysia
Distribution: Redhat 8.0, 9, Slackware 9.1
Posts: 511

Rep: Reputation: 30
hey, i installed guarddog... then, i see the first messagebox prompt out when i first run it...
it says something like: Guarddog was unable to read the file at /etc/rc.firewall as being a Guarddog Firewall. This probably means that file is not actually a Guarddog firewall.... and bla bla bla.....
what does it mean???
 
Old 05-28-2003, 01:18 AM   #5
markus1982
Senior Member
 
Registered: Aug 2002
Location: Stuttgart (Germany)
Distribution: Debian/GNU Linux
Posts: 1,467

Rep: Reputation: 46
does /etc/rc.firewall exist? anyways you can always choose to folllow my path which will work ...
 
Old 05-28-2003, 01:33 AM   #6
yenonn
Member
 
Registered: Feb 2003
Location: Malaysia
Distribution: Redhat 8.0, 9, Slackware 9.1
Posts: 511

Rep: Reputation: 30
yes... the file is exists...the file has 744 file permission. what does u mean by ur path?? pls help

Last edited by yenonn; 05-28-2003 at 01:34 AM.
 
Old 06-01-2003, 10:51 AM   #7
pjcp64
Member
 
Registered: Dec 2002
Location: Omaha, NE
Distribution: Ubuntu Server and SuSE
Posts: 69

Rep: Reputation: 15
I've included a simple firewall script below. However, you should also consider the option of restricting ip-addresses to specific services in the /etc/xinetd.d/ directory.

For more info on iptables, Oskar Andreasson has write excellent documentation on the use of iptables along with examples.
http://www.linuxsecurity.com/resourc...-tutorial.html


#!/bin/sh
# This is the location of the iptables command
IPTABLES="/sbin/iptables"
#
. /etc/rc.d/init.d/functions

case "$1" in
stop)
action "Shutting down firewall:" echo
$IPTABLES -F
$IPTABLES -P INPUT ACCEPT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -P FORWARD DROP
;;
status)
echo "Status is not supported for firewall"
;;
restart|reload)
$0 stop
$0 start
;;
start)
action "Starting Firewall:" echo

################################################################
#Insert modules- should be done automatically if needed
dmesg -n 1 #Kill copyright display on module load
/sbin/modprobe ip_tables
/sbin/modprobe iptable_filter
/sbin/modprobe ip_conntrack
/sbin/modprobe ip_conntrack_ftp
dmesg -n 6
#
## Flush everything, start from scratch
#
$IPTABLES -F INPUT
$IPTABLES -F OUTPUT
$IPTABLES -F FORWARD

# originally tcp_syncookies and ip_dynaddr were 1
echo 2 > /proc/sys/net/ipv4/conf/all/rp_filter
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 0 > /proc/sys/net/ipv4/conf/all/accept_source_route
echo 0 > /proc/sys/net/ipv4/tcp_timestamps
echo 1 > /proc/sys/net/ipv4/tcp_syncookies
echo 0 > /proc/sys/net/ipv4/conf/all/accept_redirects
echo 1 > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses
echo 1 > /proc/sys/net/ipv4/ip_dynaddr
echo 1 > /proc/sys/net/ipv4/conf/all/log_martians

# You can change this value quite a bit. It's the range of user ports.
echo "55000 65000" >/proc/sys/net/ipv4/ip_local_port_range

#---------- Reduce DoS'ing ability by reducing timeouts
echo 30 > /proc/sys/net/ipv4/tcp_fin_timeout
echo 1800 > /proc/sys/net/ipv4/tcp_keepalive_time
echo 0 > /proc/sys/net/ipv4/tcp_window_scaling
echo 0 > /proc/sys/net/ipv4/tcp_sack

#---------- iptables defaults to these if no matches are found below.
$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -P FORWARD DROP

##--------- Set basic rules
#----------- Above list ripped from http://www.linux-mag.com/2000-01/bestdefense_02.html
$IPTABLES -A INPUT -m unclean -j DROP
$IPTABLES -A INPUT -m state --state INVALID -j DROP

$IPTABLES -A FORWARD -m unclean -j DROP
$IPTABLES -A FORWARD -m state --state INVALID -j DROP

$IPTABLES -A INPUT -i lo -j ACCEPT
$IPTABLES -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT # allow replies coming in

#----------------------------------------------------------------------
# This is where you would start customizing your permissions.
#----------------------------------------------------------------------

# Disallow TELNET and log the attempt.
$IPTABLES -A INPUT -p tcp --dport 23 -j LOG --log-prefix "__TELNET__"
$IPTABLES -A INPUT -p tcp --dport 23 -j DROP

# Allow SSH for all ip addresses
# $IPTABLES -A INPUT -p tcp --dport 22 -j ACCEPT

# Allow SSH for a specific ip address
# $IPTABLES -A INPUT -p tcp -s 10.50.1.99/32 --dport 22 -j ACCEPT

# I'm sure you can through ranges in there too.

#NON REDHAT SYSTEMS, COMMENT/REMOVE ALL BELOW
;;
*)
echo "Useage: firewall (start|stop|restart)"
exit 1
esac

exit 0
 
Old 06-01-2003, 10:56 AM   #8
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
yenonn, that warning just means that you havent run Guarddog on your machine before, and the firewall script isnt in the order that Guarddog would generate it. It'll only happen when you start Guarddog after making changes to your firewall without using Guarddog.
 
Old 06-04-2003, 07:19 PM   #9
yenonn
Member
 
Registered: Feb 2003
Location: Malaysia
Distribution: Redhat 8.0, 9, Slackware 9.1
Posts: 511

Rep: Reputation: 30
ok, i just find out, guarddog only can performing IP filtering, and what if i want guarddog to perform an IP routing for me...??
so, can i do it??? i really doubting for it....
guarddog is writting the iptables rules in /etc/rc.firewall file...
how can it make thing work??
i mean somehow iptables should have a config file for user to customize (i am not sure what is the name of the file, i am just have a wild guess on it). so, i am wondering how can guarddog make iptables rules available?
may be i will look for the iptable tutorial, Oskar Andreasson's documentation. actually, i hate reading.... reading is just making me sleeping....especially the Oskar's documentation is really bulky and it seems to be so technical... so.... are there any others resources that give me a straight forward, at least giving me a rough idea what can the iptables does....thanks....
 
Old 06-05-2003, 07:55 PM   #10
pjcp64
Member
 
Registered: Dec 2002
Location: Omaha, NE
Distribution: Ubuntu Server and SuSE
Posts: 69

Rep: Reputation: 15
The firewall is simply a script that you run. In the case of GuardDog ==> ./etc/rc.firewall
You can list the current rules currently in use with ==> iptables -L
By "performing an ip routing", are you referring to having a firewall that allows internal PCs to access the internet? If so, you can find some fine examples by searching for NAT, ip masquerading, or ip masking.
 
Old 03-04-2004, 09:03 PM   #11
Slycordinator
Member
 
Registered: Dec 2002
Location: Washington State
Posts: 30

Rep: Reputation: 15
Quote:
Originally posted by yenonn
ok, i just find out, guarddog only can performing IP filtering, and what if i want guarddog to perform an IP routing for me...??
Guarddog is a firewall only. According to the people that make the program IP routing and masquerading aren't primarily security devices and are therefore not in the program.

But they provide a program called "Guidedog" for this (can't comment on it, as I've never used it).
http://www.simonzone.com/software/guidedog/

Quote:
so, can i do it??? i really doubting for it....
guarddog is writting the iptables rules in /etc/rc.firewall file...
how can it make thing work??
i mean somehow iptables should have a config file for user to customize (i am not sure what is the name of the file, i am just have a wild guess on it). so, i am wondering how can guarddog make iptables rules available?
may be i will look for the iptable tutorial, Oskar Andreasson's documentation. actually, i hate reading.... reading is just making me sleeping....especially the Oskar's documentation is really bulky and it seems to be so technical... so.... are there any others resources that give me a straight forward, at least giving me a rough idea what can the iptables does....thanks....
Assuming you've compiled your kernel with the correct modules for ipfiltering and have installed iptables, the script that guarddog writes should work.
 
  


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
Is a firewall necessary in this setup? cerrayon Linux - Security 4 06-27-2004 07:34 PM
help with client side NFS-firewall setup and server side NIS-firewall setup niverson Linux - Networking 3 02-02-2004 08:52 AM
Firewall Setup Q nixtech Linux - Networking 1 08-15-2003 08:47 PM
Setup A Firewall kelper Linux - Security 1 07-14-2003 02:57 PM
Firewall Setup Golem Linux - Newbie 2 01-31-2002 06:56 AM

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

All times are GMT -5. The time now is 08:29 AM.

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