LinuxQuestions.org
Review your favorite Linux distribution.
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 07-26-2005, 06:50 AM   #1
vishamr2000
Member
 
Registered: Aug 2004
Posts: 210

Rep: Reputation: 31
executing a script!!


Hi to all,

I would like to know how to execute a script that contains an if-else
statement on a per-packet basis. The if and else part each contain
iptables rules that need to be executed ona packet basis? How can I do
that?I am using RH 9.

Any input will be most appreciated..

Warm regards,
Visham
 
Old 07-26-2005, 11:54 AM   #2
Half_Elf
LQ Guru
 
Registered: Sep 2001
Location: Montreal, Canada
Distribution: Slackware; Debian; Gentoo...
Posts: 2,163

Rep: Reputation: 46
You can't really do this with iptables. Iptables rules are executed in the idea of "first found first applied" you just can't use if/then/else in there.
You better write some C/C++ application with sockets or maybe a perl script to do this. I doubt there is an easy "bash script" solution.
 
Old 07-26-2005, 02:10 PM   #3
demian
Member
 
Registered: Apr 2001
Location: Bremen, Germany
Distribution: Debian
Posts: 303

Rep: Reputation: 30
You are a little vague on the details but this sounds like a job for the QUEUE target. This puts packets in the userspace where they can be handled with libipq. See man 3 libipq and http://www.netfilter.org/documentati...ter-faq-4.html
 
Old 07-27-2005, 04:40 AM   #4
vishamr2000
Member
 
Registered: Aug 2004
Posts: 210

Original Poster
Rep: Reputation: 31
Hi to all,

Half_Elf and demian, many thx for the replies..

Is it possible to get a signal (i don't know from where, maybe a function or the NIC) just before every packet is sent out the NIC. The signal then cause the script to execute. MAybe that will cause the script to execute on a per-packet basis. But I don't know how to go about it. I thought about the QUEUE target but i'm not sure. What according to you should the things I should be looking at?

Thx in advance..

Warm regards,
Visham
 
Old 07-28-2005, 04:13 PM   #5
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Out of curiousity, WHY do you want to do this? Perhaps, rather than being hung up on this script, there is a better way to handle your situation. (And less complex, at that.)
 
Old 07-29-2005, 02:34 AM   #6
vishamr2000
Member
 
Registered: Aug 2004
Posts: 210

Original Poster
Rep: Reputation: 31
Hi to all,

I am using ebtables and I need to implement load balancing on a per-packet basis. That's why i need to run the script after I know the packets have been declared valid and accepted (outgoing packets only).

The script contains an if-else statement containing rules, which cannot run in script more than once.

Regards,
Visham
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Executing install script for ... securehack Linux - Software 6 05-24-2005 11:02 AM
executing shell script on apache nooodles Linux - General 1 06-29-2004 01:51 AM
Script is not executing in Apache!!! linux_child001 Linux - Newbie 1 06-22-2004 05:10 AM
Executing iptables script dat64597 Linux - Security 1 02-09-2003 07:02 PM
executing a shell script from C llama_meme Programming 2 04-01-2002 09:10 PM

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

All times are GMT -5. The time now is 03:42 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