Skip to content

Removal

This guide explains how to completely remove the NetDefense plugin and its repository configuration from your OPNsense firewall.

Before You Begin

Remove the Plugin

Via Web Interface

  1. Navigate to System > Firmware > Plugins

  2. Find os-netdefense in the list of installed plugins

  3. Click the trash icon next to the plugin to uninstall

  4. Confirm the removal when prompted

Via Command Line

  1. Connect to your OPNsense device

    Terminal window
    ssh root@your-opnsense-ip
  2. Stop the NetDefense service

    Terminal window
    service ndagent stop
  3. Remove the package

    Terminal window
    pkg remove os-netdefense
  4. Confirm the removal when prompted (type y)

Remove Repository Configuration

If you no longer want to receive NetDefense updates or want to completely remove all traces of the repository:

  1. Remove the repository configuration file

    Terminal window
    rm /usr/local/etc/pkg/repos/netdefense.conf
  2. Remove the fingerprints directory

    Terminal window
    rm -rf /usr/local/etc/pkg/fingerprints/netdefense
  3. Update the package database

    Terminal window
    pkg update -f

Complete Removal Script

For a complete removal of the plugin and repository configuration, run this script:

#!/bin/sh
echo "Stopping NetDefense Agent..."
service ndagent stop 2>/dev/null
echo "Removing NetDefense package..."
pkg remove -y os-netdefense
echo "Removing repository configuration..."
rm -f /usr/local/etc/pkg/repos/netdefense.conf
echo "Removing fingerprints..."
rm -rf /usr/local/etc/pkg/fingerprints/netdefense
echo "Updating package database..."
pkg update -f
echo "NetDefense removal complete."

Verify Removal

After removal, verify all components are gone:

Terminal window
pkg info os-netdefense
service ndagent status
ls /usr/local/etc/pkg/repos/netdefense.conf
ls /usr/local/etc/pkg/fingerprints/netdefense

What Gets Removed

Removed

  • πŸ—‘οΈ NetDefense Agent binary (/usr/local/bin/ndagent)
  • βš™οΈ Service configuration
  • πŸ–₯️ Web interface plugin files
  • πŸ“„ Log configuration templates
  • πŸ“ Action configuration files

Preserved

  • πŸ“‹ System logs (in /var/log/)
  • πŸ“ NetDefense account registration
  • πŸ’Ύ OPNsense system configuration (config.xml)

Clean Up Configuration Data

The removal process does not delete the NetDefense configuration stored in OPNsense’s config.xml. This allows for easy reinstallation with existing settings. To completely remove the configuration data:

  1. Navigate to System > Configuration > Backups

  2. Click Download to create a backup of your current configuration

  3. Edit the downloaded XML file and remove the <netdefense> section under <OPNsense>

  4. Navigate to System > Configuration > Backups

  5. Upload the modified configuration file

Cleanup Logs

If you want to remove NetDefense-related logs:

Terminal window
rm -f /var/log/ndagent.log

Reinstallation

If you need to reinstall NetDefense in the future:

  • πŸ“¦ Follow the Installation guide to set up the repository again
  • βš™οΈ Your previous configuration will be preserved if you didn’t clean up config.xml
  • πŸ”„ The device will automatically reconnect with its existing Device ID

NetDefense Account Cleanup

Removing the plugin from your device does not remove the device from your NetDefense account. To fully remove the device, use NDCLI:

Terminal window
# List devices to find the exact name
ndcli device list
# Remove the device from your organization
ndcli device remove <device-name>

This frees up the device slot in your NetDefense account.