You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
749 B

  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2015 OpenWrt.org
  3. START=90
  4. STOP=10
  5. USE_PROCD=1
  6. PROG=/usr/bin/snort
  7. validate_snort_section() {
  8. uci_load_validate snort snort "$1" "$2" \
  9. 'config_file:string' \
  10. 'interface:string'
  11. }
  12. start_snort_instance() {
  13. [ "$2" = 0 ] || {
  14. echo "validation failed"
  15. return 1
  16. }
  17. procd_open_instance
  18. procd_set_param command $PROG "-q" "--daq-dir" "/usr/lib/daq/" "-i" "$interface" "-c" "$config_file" "-s" "-N"
  19. procd_set_param file $config_file
  20. procd_set_param respawn
  21. procd_close_instance
  22. }
  23. start_service()
  24. {
  25. validate_snort_section snort start_snort_instance
  26. }
  27. stop_service()
  28. {
  29. service_stop ${PROG}
  30. }
  31. service_triggers()
  32. {
  33. procd_add_reload_trigger "snort"
  34. procd_add_validation validate_snort_section
  35. }