salve ragazzi io ho un file che contiene questo:
codice:
#!/bin/bash
#
# Firewall personale a linea di comando by Mizar
################################################
#########################
# Definizione Variabili #
#########################
IPTABLES="/sbin/iptables"
IFLO="lo"
IFEXT="eth0" # Da sostituire con la propria interfaccia: eth0, eth1, ppp0, etc
case "$1" in
start)
########################
# Attivazione Firewall #
########################
echo -n "Attivazione Firewall: "
#################################
# Caricamento Moduli del Kernel #
#################################
modprobe ip_tables
modprobe iptable_nat
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_nat_ftp
modprobe ipt_LOG
modprobe ipt_MARK
modprobe ipt_MASQUERADE
modprobe ipt_REDIRECT
modprobe ipt_REJECT
modprobe ipt_TOS
modprobe ipt_limit
modprobe ipt_mac
modprobe ipt_mark
modprobe ipt_multiport
modprobe ipt_state
modprobe ipt_tos
modprobe iptable_mangle
############################
# Reset delle impostazioni #
############################
$IPTABLES -F
$IPTABLES -F -t nat
$IPTABLES -F -t mangle
$IPTABLES -X
$IPTABLES -X -t nat
$IPTABLES -X -t mangle
################################
# Impostazione Policy standard #
################################
$IPTABLES -P INPUT DROP
$IPTABLES -P FORWARD DROP
$IPTABLES -P OUTPUT ACCEPT
#################################
# Abilitazione traffico interno #
#################################
$IPTABLES -A INPUT -i $IFLO -j ACCEPT
$IPTABLES -A OUTPUT -o $IFLO -j ACCEPT
#############################################################################
# Abilitazione traffico in entrata solo se relativo a pacchetti in risposta #
#############################################################################
$IPTABLES -A INPUT -p tcp -i $IFEXT -m state -s 0/0 --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A INPUT -p icmp -i $IFEXT -m state -s 0/0 --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A INPUT -p udp -i $IFEXT -m state -s 0/0 --state ESTABLISHED,RELATED -j ACCEPT
echo "ok"
;;
stop)
###########################
# Disattivazione Firewall #
###########################
echo -n "Disattivazione Firewall: "
$IPTABLES -F
$IPTABLES -F -t nat
$IPTABLES -F -t mangle
$IPTABLES -X
$IPTABLES -X -t nat
$IPTABLES -X -t mangle
$IPTABLES -P INPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT
$IPTABLES -P OUTPUT ACCEPT
echo "ok"
;;
status)
##############################
# Display stato del Firewall #
##############################
echo -n "Regole attuali nel Firewall: "
$IPTABLES -L
;;
restart|reload)
$0 stop
$0 start
;;
*)
echo "Utilizzo: firewall {start|stop|restart|reload|status}" >&2
exit 1
;;
esac
exit 0
il mio problema è molto semplice essendo questo uno script che agisce con processo di start & stop io volevo metterlo sul desktop della macchina e poterlo lanciare o arrestare in qualche modo.. c'è la possibilità di lanciarlo e se è inattvo lui parte automaticamente (fase di start) mentre se è già attivo lui si arresti (fase di stop).
mi potrebbe andare bene anche un modo in cui lui mi chieda se attivarlo o stopparlo, ma l'importante e che concettualmente sul desktop vi sia il link al file.
A dimenticavo altro problema io uso ubuntu e quindi mi chiede sempre di agire come superutente
grazie a tutti per l'aiuto