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.

41 lines
765 B

  1. #!/bin/sh /etc/rc.common
  2. START=99
  3. STOP=10
  4. USE_PROCD=1
  5. PROG=/usr/bin/snort
  6. validate_snort_section() {
  7. uci_validate_section snort snort "${1}" \
  8. 'config_dir:string' \
  9. 'alert_module: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" -c "$config_dir/snort.lua" -A "$alert_module"
  20. procd_set_param env SNORT_LUA_PATH="$config_dir"
  21. procd_set_param file $CONFIGFILE
  22. procd_set_param respawn
  23. procd_close_instance
  24. }
  25. stop_service()
  26. {
  27. service_stop ${PROG}
  28. }
  29. service_triggers()
  30. {
  31. procd_add_reload_trigger "snort"
  32. procd_add_validation validate_snort_section
  33. }