Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
07-26-2005, 06:50 AM
|
#1
|
Member
Registered: Aug 2004
Posts: 210
Rep:
|
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
|
|
|
07-26-2005, 11:54 AM
|
#2
|
LQ Guru
Registered: Sep 2001
Location: Montreal, Canada
Distribution: Slackware; Debian; Gentoo...
Posts: 2,163
Rep:
|
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.
|
|
|
07-26-2005, 02:10 PM
|
#3
|
Member
Registered: Apr 2001
Location: Bremen, Germany
Distribution: Debian
Posts: 303
Rep:
|
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
|
|
|
07-27-2005, 04:40 AM
|
#4
|
Member
Registered: Aug 2004
Posts: 210
Original Poster
Rep:
|
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
|
|
|
07-28-2005, 04:13 PM
|
#5
|
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507
Rep: 
|
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.)
|
|
|
07-29-2005, 02:34 AM
|
#6
|
Member
Registered: Aug 2004
Posts: 210
Original Poster
Rep:
|
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
|
|
|
All times are GMT -5. The time now is 10:00 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|