Is it possible make a service with start|stop|restart like apache or ssh?
Sorry i mean that i have my script start.fw and i want include it into the service like /etc/init.d/iptables
Thanks![]()
Is it possible make a service with start|stop|restart like apache or ssh?
Sorry i mean that i have my script start.fw and i want include it into the service like /etc/init.d/iptables
Thanks![]()
Last edited by valerio; 20th October 2010 at 09:53 PM.
Why scripts? You need to use ufw - https://help.ubuntu.com/community/UFW
Rocky Jr.
What's wrong? I hope I am not making you uncomfortable...
![]()
Never send a boy to do a mans job.
ok i will lunch manualy my iptables.
Thanks
Based on /etc/init.d/iptables source from RHEL. Try it and let me know. Save your existing firewall rules to /root/.config/fw/firewall.confCode:#!/bin/bash IPT=/sbin/iptables IPT6=/sbin/ip6tables IPTR=/sbin/iptables-restore IPTCONFIG=/root/.config/fw/firewall.conf PROG=iptables _stop(){ ### reset ipv4 iptales ### echo "Stopping iptables..." $IPT -F $IPT -X $IPT -Z for table in $(</proc/net/ip_tables_names) do $IPT -t $table -F $IPT -t $table -X $IPT -t $table -Z done $IPT -P INPUT ACCEPT $IPT -P OUTPUT ACCEPT $IPT -P FORWARD ACCEPT ### reset ipv6 iptales ### $IPT6 -F $IPT6 -X $IPT6 -Z for table in $(</proc/net/ip6_tables_names) do $IPT6 -t $table -F $IPT6 -t $table -X $IPT6 -t $table -Z done $IPT6 -P INPUT ACCEPT $IPT6 -P OUTPUT ACCEPT $IPT6 -P FORWARD ACCEPT } _start(){ ### add your commands here ### echo "Starting iptables..." $IPTR < "$IPTCONFIG" } # See how we were called. case "$1" in start) _start ;; stop) _stop ;; restart) _stop _start ;; *) echo $"Usage: $PROG {start|stop|restart}" exit 1 esac
Code:mkdir -p /root/.config/fw/ iptables-save > /root/.config/fw/firewall.conf
Last edited by rockdalinux; 20th October 2010 at 10:32 PM.
Rocky Jr.
What's wrong? I hope I am not making you uncomfortable...
![]()
Never send a boy to do a mans job.
Wow beautiful.
Seems functional
Thank you a lot......
There are currently 1 users browsing this thread. (0 members and 1 guests)