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.

40 lines
695 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_validate_section snort snort "${1}" \
  9. 'config_file:string' \
  10. 'interface:string'
  11. }
  12. start_service() {
  13. local config_file interface
  14. validate_snort_section snort || {
  15. echo "validation failed"
  16. return 1
  17. }
  18. procd_open_instance
  19. procd_set_param command $PROG "-q" "--daq-dir" "/usr/lib/daq/" "-i" "$interface" "-s" "-N"
  20. procd_set_param file $CONFIGFILE
  21. procd_set_param respawn
  22. procd_close_instance
  23. }
  24. stop_service()
  25. {
  26. service_stop ${PROG}
  27. }
  28. service_triggers()
  29. {
  30. procd_add_reload_trigger "snort"
  31. procd_add_validation validate_snort_section
  32. }