Merge branch 'master' of ssh://git.qubes-os.org/var/lib/qubes/git/joanna/core

This commit is contained in:
Marek Marczykowski 2011-08-31 18:22:00 +02:00
commit 84ff7b802a
2 changed files with 13 additions and 4 deletions

View File

@ -19,6 +19,7 @@ if [ x$ip != x ]; then
echo "NS1=$gateway" > /var/run/qubes/qubes_ns
echo "NS2=$secondary_dns" >> /var/run/qubes/qubes_ns
/usr/lib/qubes/qubes_setup_dnat_to_ns
[ -x /rw/config/qubes_ip_change_hook ] && /rw/config/qubes_ip_change_hook
fi
fi

View File

@ -13,11 +13,20 @@ echo $$ >$PIDFILE
trap 'exit 0' SIGTERM
while true; do
echo "1" > /proc/sys/net/ipv4/ip_forward
# Wait for changes in xenstore file
/usr/bin/xenstore-watch-qubes $XENSTORE_IPTABLES
TRIGGER=$(/usr/bin/xenstore-read $XENSTORE_IPTABLES)
if ! [ "$TRIGGER" = "reload" ]; then continue ; fi
# Disable forarding to prevent potential "leaks" that might
# be bypassing the firewall or some proxy service (e.g. tor)
# during the time when the rules are being (re)applied
echo "0" > /proc/sys/net/ipv4/ip_forward
RULES=$(/usr/bin/xenstore-read $XENSTORE_IPTABLES_HEADER)
IPTABLES_SAVE=$(/sbin/iptables-save | sed '/^\*filter/,/^COMMIT/d')
OUT=`echo -e "$RULES\n$IPTABLES_SAVE" | /sbin/iptables-restore 2>&1 || :`
@ -31,8 +40,7 @@ while true; do
if [ "$OUT" ]; then
DISPLAY=:0 /usr/bin/notify-send -t 3000 "Firewall loading error ($HOSTNAME)" "$OUT" || :
fi
if [[ -z "$OUT" ]]; then
# If OK save it for later
/sbin/service iptables save >/dev/null
fi
# Check if user didn't define some custom rules to be applied as well...
[ -x /rw/config/qubes_firewall_user_script ] && /rw/config/qubes_firewall_user_script
done