I am working on a shell script that blocks all incoming and outgoing connections
for 10 hours. After then hours everything will be unblocked again.
i am using the ipfw command and put it to sleep the amount of time in seconds.
this works so far, so good. But the problem, I am facing now, is, that when I restart the computer the script will be killed. As I have very low programming skills, I think I need to store a variable to /var/lib and call it when the computer gets restarted. What's the best way to solve this problem. Thank you in advance.
If you block for the same 10 hours every day then put what you have in a simple script.
Write the script so that the ipfw command is a full specification: /path/to/ipfw
will give the the actual path, this is a non-working example:
Do all of this a the root user:
Let's say you want to block traffic starting at 19:00, make your script run every day of the week at 10:00 -- as root use:
Enter the following
Save the changes. The code will automatically run every day.
This is how to do it. Why? In most shops this would cause a production box to have lots of problems. It is very unusual, except possibly for a personal desktop.
Thank you for response Jim.
I just stumbled over the crontab solution. To give you a little bit more background on this project: I found an old AOL 10 hours free Internet disk at home. You might remember this, finding them in your mail in the '00's
anyways, I started to create the idea of making an app that you start and all in/out connections will be blocked for 10 hours. Even when you restart the computer. so, it's more an art project. This app is free for download for everyone. Long story short:
The user who has downloaded and installed the app should be able to have any Internet connection for 10 hours. Even when he/she restarts their computer.
I think, I have to create a crontab and make it "login or after restart", then I have to call the variable with date the application was started.
okay, here's another update on the script I'm working on.
somehow it seems, I cannot calculate the variable for $ENDDATE and $REMAINING to work. What am I doing wrong?
How to make a log that will log all ips that connect to the server or send packets? And how to block an ip that make packets flood and try to DDoS? Thanks. (1 Reply)
I am looking for an iptables command to allow incoming UDP packets for my Linux server
also is there a command I can use to set the default action for outgoing packets to accept?
Thank you (1 Reply)
I am using Linux box. i am able to send mails through sendmail to local and other domains.
i am not receving any incoming mails.
dovecot service is running. (4 Replies)
Hi everyone,
I am hoping anyone of you could help me in this weird problem we have in 1 of our Solaris 10 servers. Lately, we have been having some ftp problems in this server. Though it can ping any server within the network, it seems that it can only ftp to a select few. For most servers, the... (4 Replies)
Hi everybody. I have the next scenary:
eth0: WAN
eth1: DMZ
eth2: LAN
I need to block all incoming trafic from the internet through my network LAN using iptables. I have squid but i need to do this using ipatbles.
I have been listening about iptables -A FORDAWARD but I am stuck right... (0 Replies)
I have a few clients connecting to the server(which is using select()) and theyre trying to send messages to each other. How do I wait for input on stdin and at the same time I wait for data to being sent from the server? Should I use select() in my client too? How exactly though? (1 Reply)
Hey guys,
I am working on a Cshell script and I am stuck on this one part. I need to be able to copy in files to my directory but give them different names so they don't overwrite each other. For example, my folder already contains FILE.1 I want my script to name the next file copied over... (5 Replies)
Hi All,
I require to develop some script which will continuously be looking for mails from some specific mail addresses on AIX server. Once any such mail arrives, the process will look into the mail subject and mail body to search for some keywords like success or failure, filename etc.... (3 Replies)