Results 1 to 2 of 2

Thread: iptables lockout

  1. #1
    Join Date
    Jan 2009
    Location
    Denmark
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    iptables lockout

    Currently i am working on setting up a Raspberry PI (Raspbian OS / Debian Wheezy) as my new firewall device,
    and lets just say that i have locked myself out more than once so far in the project over the ssh connection.

    So my question is.
    Is their a script / package you can use that prompts or in some other way ask if the user is still present.
    Which you need to respond to in some manner, or it after x amount of minutes execute the command
    Code:
    sudo iptables-restore < /path/to/rules.txt
    So i dont loose the connection to the device and need to move a physical screen connection to it.

    Thanks on advance.

  2. #2
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: iptables lockout

    You could use an at job or iptables-apply to avoid losing the connection. If you want the permissions looser than that, just turn off the firewall.

    Code:
    sudo iptables-save > /tmp/good.iptables.rules
    sudo sh -c "echo '/sbin/iptables-restore < /tmp/good.iptables.rules' | at now + 4min"
    That gives you a few minutes to try things.

    Using iptables-apply is easy too.

    Code:
    sudo iptables-apply /tmp/test.rules
    See the manual page for all the options including adjusting the timeout.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •