Forum Moderators: bakedjake

Message Too Old, No Replies

IPTABLES: A Small Question on ~~

Question concerning scripts and SSH

         

IcedCardeo

12:44 am on Jan 28, 2004 (gmt 0)

10+ Year Member



Good evenin' everyone!

I have just a small question. I have heard through people that you can write your own SSH scripts using IPTABLES! I was wondering if anyone would be able to post/email me a basic way of doing this...

I will ONLY be using GAIM, NWN (linux game), and Mozilla. NOTHING ELSE.

Any ideas on what script(s) to write and how to write them? This is my LAST (thank everything thats Holy- lol) struggle before partitioning Gentoo onto my HD.

Thanks in advance,
Iced

IcedCardeo

12:45 am on Jan 28, 2004 (gmt 0)

10+ Year Member



BTW:

Nothing else meaning nothing else ONLINE :)

SeanW

2:40 pm on Jan 28, 2004 (gmt 0)

10+ Year Member



Not sure what you're trying to accomplish... "ssh scripts using iptables"?

IcedCardeo

5:23 pm on Jan 31, 2004 (gmt 0)

10+ Year Member



OHH, doh! lol seems like I only sent 1/2 of the message I had intended...

Well, I had heard on a few linux msg boards that people are able to create their own Firewalls using SSH and Ip Tables. I was wondering if anyone could create a generic (or thorough) one so I could learn how to do something like this.

Thanks,
Iced

SeanW

5:18 pm on Feb 2, 2004 (gmt 0)

10+ Year Member



Ah-ha!

I used to use a script, ie something along the lines of

ALLOWED="22 80 8080"

for i in $ALLOWED; do
iptables -A input -p tcp -M state --state NEW -t ACCEPT
done
iptables -A input -p tcp -M state --state NEW -t DROP

Then I figured out how Red Hat was doing it, and I moved to that.

/etc/sysconfig/iptables is a saved version of the firewall rules, generated by the iptables-save and iptables-restore commands. The format is pretty much the commands with the leading "iptables" stripped off, and organized by chain. The Red Hat sysv init script "iptables" has things like "iptables save" (to make your current rules permament).

If I want to make some changes, I either do it by hand then save, or cut and paste from /etc/sysconfig/iptables and reload my ruleset.

If you still want to go the script method, google for "iptables script", there are many examples.

Sean

IcedCardeo

1:11 am on Feb 6, 2004 (gmt 0)

10+ Year Member



Thanks much! :-)