1 |
On Mon, Jan 24, 2011 at 11:06 AM, kashani <kashani-list@××××××××.net> wrote: |
2 |
> On 1/24/2011 10:59 AM, Mark Knecht wrote: |
3 |
>> |
4 |
>> On Mon, Jan 24, 2011 at 10:47 AM, Jarry<mr.jarry@×××××.com> wrote: |
5 |
>>> |
6 |
>>> Hi, |
7 |
>>> |
8 |
>>> I have to change rather complex iptables rules on server |
9 |
>>> and I do not want to lock me out as this server is about |
10 |
>>> 50 miles away. So how should I do it? |
11 |
>>> |
12 |
>>> I can back up the old rules by running: |
13 |
>>> /etc/init.d/iptables save |
14 |
>>> and it will be saved to /var/lib/iptables/rules-save |
15 |
>>> (some strange format starting with number like [536:119208]) |
16 |
>>> |
17 |
>>> I prepared a script with new (modified) iptables-rules, |
18 |
>>> which I will run in bash. But in case I screw something, |
19 |
>>> how could I force netfilter to load old saved rules, |
20 |
>>> if I for whatever reason do not connect to server (ssh)? |
21 |
>>> |
22 |
>>> Or can I load new iptables-rules for certain time, and |
23 |
>>> then force netfilter to load back the old rules again? |
24 |
>>> |
25 |
>>> Jarry |
26 |
>>> |
27 |
>> |
28 |
>> Maybe a cron job that no matter what reloads the old rules 1 hour later? |
29 |
>> |
30 |
>> - Mark |
31 |
>> |
32 |
> |
33 |
> Yep, that's the way I do it. I'd test that the cron works correctly |
34 |
> beforehand. Nothing worse than locking yourself out *and* realizing your |
35 |
> cron has a path issue. |
36 |
> |
37 |
> kashani |
38 |
|
39 |
Maybe first add a rule that won't lock yourself out. Install the new |
40 |
file, make sure the rule is there, then wait an hour. Make sure the |
41 |
rule is gone. Make sure the cron logs show the work was done. Go |
42 |
through a could of reboots and make sure the old rules (or new rules) |
43 |
come up. |
44 |
|
45 |
Once all that works going to the new, scary file should be lass scary. |
46 |
|
47 |
- Mark |