Where should this firewall script be placed?
I am running Mandrake 9.1 and currently the IPtables that I have below here is placed in '/etc/rc.local' directory. Should it be placed somewhere else? I did a ports security scan and it came up all stealthed. So I dont know.
Plus, even if I have this code placed on there, should I leave the 'iptables' Services ON or OFF??? As I recall, when I did this security test, I had the service not running and still came up as stealth. (As I could remember). So, my question is, in what directory should this firewall code be placed in? Or, is the 'rc.local' directory OK??? And, should I leave the IPtables under Services left running or not running? Heres the code: Code:
#PROC SETTINGS |
i think that after running your script you could do a:
Code:
service iptables save just my two cents... |
Hello stranger!!!! Win32sux -
So in the console, I do an 'su' and then type the command EXACTLY what you have and then that all I have to do???? Please explain. For some reason, someone told me to paste the code in the rc.local directory. But even though its there, I still get all stealthed ports for some reason. Now please explain, should I take the code and move it in the /etc/sysconfig/iptables????? Please tell me. And should I leave the IPTables Service running the whole time under Services???? |
yeah, that's it... and you can use this command to make sure the rules have kicked-in:
Code:
iptables -L Code:
chmod 755 firewall.txt Code:
#!/bin/sh i believe you could manually put your rules in /etc/sysconfig/iptables if you want... but take a look at it after running the "service iptables save" command cuz i don't think the file is shell-script formatted... i'm sorry i can't give you better answers, as you can see i don't use mandrake and i don't have access to a mandrake box to see for myself... as for your box being stealthed: if you're not allowing any incoming connections on any port then "stealthed" is actually what you want... ;-) |
Ok, Im still a bit confused here.
I got the service iptables save command. Ok.... What output should I really be looking for on these two commnds?: Just please explain when I type these commands, what output should I be looking for in order for this firewall script of mine to work? service iptables save Chmod 755 firewall.txt So, do I have to really have this script in the (rc.local) or the one you mentioned (/etc/sysconfig/iptables)??? But, as so many people had confirmed that my script uses Stateful Packet Inspection, that I really want to keep mine after all. All I want to know is what directory should it be placed in? IT HAS TO BE STATEFUL PACKET INSPECTION IPTABLES**** |
Quote:
Quote:
let's say i have my firewall script in a file called wardialer_firewall.sh... to make it executable and then execute it i would do this: Code:
chmod 755 wardialer_firewall.sh Quote:
Quote:
remember that iptables is only the tool that is used to configure netfilter... technically speaking, your iptables script isn't a "firewall", it's just the script with the instructions to "configure" your firewall... the "service iptables save" thing does nothing but save the configuration in such a manner that it will be there when you reboot... Quote:
take a look at the LQ iptables wiki: http://wiki.linuxquestions.org/wiki/Iptables also - more importantly - here's a page where you can find lots of links to iptables documentation (howtos, faqs, example scripts, tutorials, etc.): http://www.linuxguruz.com/iptables/ once you read-up on iptables all of this will be very clear to you, and easy... =) |
I would like to start from scratch with this explaination: Please exlain the whole thing from scratch, because Im still lost.
Do I have to do the service iptables save first, or the Chmod 755 firewall.txt??? I dont understand why I can't just Cut/Paste it into the other mentioned directory without doing these commands??? What do mean by "Executing" the script??? Thats really has me confused, and I appologize. Ok, I have my current script in the 'rc.local' directory. What should I do with this once I boot into Linux? Please explain the commands in order of importance. What do you mean I have to execute it? Its just a written script, not an application. So, your saying I have to run the execute command everytime I boot??? So where is my actual firewall if the script is not a firewall? And what should I use as an actual firewall if this script is not a firewall?? So my question is, what command do I have to do first in order for this to work the whole time??? The Chmod 755 command or the other one? Do I have to it like this: chmod 755 /etc/sysconfig/iptables And the iptables service under Services, should I leave that running or turned off? |
Quote:
in other words, putting your iptables rules in rc.local will "work", but it's not the "kosher" way of doing things... rc.local is mainly used for other types of things... for something security-oriented like iptables it's better to do it the right way... by using rc.local for your iptables rules there would be a window of opportunity between the time your network card is brought-up and the time your rules take effect - that sucks... Quote:
http://gd.tuwien.ac.at/linuxcommand....l_scripts.html Quote:
remove the iptables rules you have in rc.local... then save the script i posted to a text file, make it executable, and then execute it... now do the "service iptables save" thing and you're done... when you wanna make changes to your firewall configuration simply edit the script and execute it, and when you've checked it's fine you do the save thing... if you screwed-up and the new script sucked you'd stil be okay cuz you hadn't saved it yet... so upon reboot you'd be back to your latest "known-good" configuration... Quote:
Quote:
your iptables script simply "tells" netfilter how you want it to work... the "service iptables save" command simply tells iptables to "remember" the instructions that you've given it, so that you don't have to execute the script yourself everytime you boot... by putting the iptables rules in rc.local you aren't using iptables' "save" feature, you're just running the rules at startup everytime, much like if you would do it manually after the network is up... Quote:
Quote:
http://www.linuxguruz.com/iptables/ also, do some research about shell scripts, make sure you check out the link about shell scripts i posted above... it's important that you know how to make files executable, how to execute them, and what shell scripts are... http://www.google.com/linux?hl=en&lr...=Google+Search |
Ok, I just did the service iptables save command and I saw it was OK. So, I went to the /etc/sysconfig/iptables and I saw the script there. ....
Is this a good sign??? Now, what do I have to do after this??? |
Quote:
the only issue i see is that you're doing it from rc.local... it's important that you learn to work with an individual iptables script and not rely on rc.local for your iptables needs... you can post the output of the "iptables -L" command here by copy/pasting it... Quote:
http://www.linuxquestions.org/questi...threadid=73921 perhaps the file is created the first time you run the save command?? but the main thing is that when using iptables' save feature you don't need to know what file it uses to save the config (cuz you don't need to touch that file yourself)... the most important thing (for now) is that you know how to make/edit your own script, how to make it executable, how to execute it, and how to save it's config... ;-) |
Ok, I just did the service iptables save command and I saw it was OK. So, I went to the /etc/sysconfig/iptables and I saw the script there. ....
Is this a good sign??? Now, what do I have to do after this??? Ok, now, I just truned ON the iptables as RUNNING under the Mandrake Services. Its RUNNING. Now where does the Chmod 755 come into action??? |
the rules you just saved... where'd you run them from??
|
I ran them from the terminal Konsole.... Why?
Heres a recap of what I did in order: 1. Did a service iptables save command and was told me OK. 2. Went into the /etc/sysconfig/iptables and it showed my script. 3. Then I went to Mandrake Sysem services I started iptables as RUNNING. Now its running. 4. Whats next??? Whats next??? I still have the same script in my rc.local. Should I remove that? Now, when should I do the Chmod 755 thing??? |
yes, if you want to do it the right way then remove any iptables stuff from your rc.local...
once you've done that, then save the example script i posted to a text file, make the text file executable, and then execute it... then do the save again... then reboot your computer and do a "iptables -L" and post the output on this thread.... |
But I want to use the script what I posted above. Could I do that??? And which textfile program does Mandrake use?I just feel comfortable with my script. So your saying its not really secure? I may use yours but could I please use mine for now. I just feel comfortable with it.
Ok, how would I make the script executable???? This what confuses me. How can I make the text file executable?? Suppose I use Kwrite, after Pasting my script in there, then how can I make it executable? |
All times are GMT -5. The time now is 01:49 AM. |