bsmithio / OPNsense-Dashboard

A functional and useful dashboard for OPNsense that utilizes InfluxDB, Grafana, Graylog, and Telegraf.
523 stars 66 forks source link

Command to add `Defaults!PFIFGW !log_allowed` to sudoers returns an error #63

Open alexwmaustin opened 5 months ago

alexwmaustin commented 5 months ago

In the config it asks that you run the command printf 'Defaults!PFIFGW !log_allowed\n' | sudo tee -a /usr/local/etc/sudoers > /dev/null. This however, always returned an error for me PFIFGW: Event not found.

I found that the only way to rectify it was to manually add Defaults!PFIFGW !log_allowed To the sudoers file.

The following needs some extra care, messing with the sudoers file can potentially not go well. Fixing this will just prevent the sudo logs from appearing in the opnsense logging at System > Log Files > General. The solution is as follows.

  1. open a root ssh terminal to your opnsense instance
  2. Using the command visudo open the sudoers file
    • Its critical you only use visudo to prevent messing with the sudoers file incorrectly
  3. Scroll to the bottom using the arrow keys, if you ran the previous commands from the configuration instructions you should see telegraf ALL=(root) NOPASSWD: /usr/local/bin/telegraf_pfifgw.php and Cmnd_Alias PFIFGW = /usr/local/bin/telegraf_pfifgw.php at the bottom
  4. Press the I key to enter Insert mode
  5. Carefully type out the Defaults!PFIFGW !log_allowed line, copy paste will not work don't try
  6. Press Esc Key to enter command mode
  7. Type :wq to save and quit the file
  8. you can run sudo visudo -c after to ensure it will work

Hope this helps