qubes_firewall 913 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/sh
  2. #
  3. # chkconfig: 345 91 91
  4. # description: Starts Qubes Firewall monitor
  5. #
  6. # Source function library.
  7. . /etc/rc.d/init.d/functions
  8. PIDFILE=/var/run/qubes/qubes_firewall.pid
  9. start()
  10. {
  11. type=$(/usr/bin/xenstore-read qubes_vm_type)
  12. start_firewall=$(/usr/bin/xenstore-read qubes-service/qubes-firewall 2> /dev/null)
  13. if [ -z "$start_firewall" ] && [ "$type" == "ProxyVM" ] || [ "$start_firewall" == "1" ]; then
  14. echo -n $"Starting Qubes Firewall monitor:"
  15. /sbin/ethtool -K eth0 sg off
  16. /usr/sbin/qubes_firewall &
  17. success
  18. echo ""
  19. fi
  20. return 0
  21. }
  22. stop()
  23. {
  24. if [ -r $PIDFILE ]; then
  25. echo -n "Stopping Qubes Firewall monitor:"
  26. kill -9 $(cat $PIDFILE) 2>/dev/null && success || failure
  27. echo ""
  28. fi
  29. return 0
  30. }
  31. case "$1" in
  32. start)
  33. start
  34. ;;
  35. stop)
  36. stop
  37. ;;
  38. *)
  39. echo $"Usage: $0 {start|stop}"
  40. exit 3
  41. ;;
  42. esac
  43. exit $RETVAL