OPNsense Core

repository·master·Indexed 26 days ago

https://github.com/opnsense/core

Core GUI and system management logic for OPNsense, an open-source firewall and system management platform. This documentation covers repository management using Makefile targets (update, upgrade, lint, style, sweep), package creation via 'make package', and the implementation of dynamic alias generators. It also provides configuration guidance for integrated services including Dnsmasq, lighttpd, SSH, strongSwan, Suricata, and Unbound, as well as usage instructions for the configctl utility to dispatch backend commands to configd.

Tokens
6.7K
Snippets
11
Records
52
Agent score
88%

What's inside opnsense-core

  1. Upgrade from jakub-onderka/php-parallel-lint

    master

    If you are using the unmaintained jakub-onderka/php-parallel-lint package, switch to the officially supported php-parallel-lint/php-parallel-lint using the following commands:

    composer remove --dev jakub-onderka/php-parallel-lint
    composer require --dev php-parallel-lint/php-parallel-lint
    composer remove --dev jakub-onderka/php-parallel-lint
    composer require --dev php-parallel-lint/php-parallel-lint
  2. Install PHP Parallel Lint

    master

    You can install PHP Parallel Lint as a development dependency using Composer, as a standalone project, or by using a PHAR file.

    To install as a development dependency in your existing project:

    composer require --dev php-parallel-lint/php-parallel-lint

    To install as a standalone Composer project:

    composer create-project php-parallel-lint/php-parallel-lint /path/to/folder/php-parallel-lint
    /path/to/folder/php-parallel-lint/parallel-lint

    To enable colored output, install the highligher package:

    composer require --dev php-parallel-lint/php-console-highlighter

    Alternatively, you can download the PHAR file from the Releases page.

    composer require --dev php-parallel-lint/php-parallel-lint
  3. Implement a Dynamic Alias generator

    master

    To create a new dynamic alias that is automatically merged into Firewall/Aliases, implement a class within the OPNsense\Firewall\DynamicAliases namespace.

    Each class must implement a collect() method. This method must return a named array containing the alias registration information. The structure of this array should follow the format defined in ../static_aliases/core.json.

    Important Performance Note: Ensure that the logic within the collect() method is 'light weight' to avoid increasing API execution times excessively.

  4. Exclude files based on PHP version

    master

    To prevent syntax errors when running lint on older PHP versions, you can specify a minimum PHP version requirement directly in your PHP files. PHP Parallel Lint will automatically skip files that require a higher version than the one currently running the tool.

    Place the requirement comment on the first line of the file, immediately following the PHP open tag:

    <?php // lint >= 7.4
    
    // Code which contains PHP 7.4 syntax.
    <?php // lint >= 7.4
    
    // Code which contains PHP 7.4 syntax.
  5. Overview of strongswan.conf automatic configuration in OPNsense

    master
    OPNsense automatically manages and includes configuration files for strongswan.conf. These files are located in src/etc/strongswan.opnsense.d/ and are designed to be automatically included by the main strongSwan configuration to allow OPNsense to manage specific settings without overwriting the primary configuration file.
  6. Access the OPNsense Web Application Entrypoint

    master

    The src/www/index.php file serves as the primary entrypoint for the OPNsense web application. Under normal operating conditions, it automatically redirects users to the dashboard at /ui/core/dashboard.

    However, if the system detects that an initial configuration wizard is required (via the trigger_initial_wizard configuration key) or if the wizard_done GET parameter is present, it renders a specialized landing page that guides the user through the setup process or confirms the completion of the initial configuration.

  7. Use the opnsense-shell utility

    master

    The opnsense-shell utility provides administrators with access to core system functionality via an interactive console menu or by executing specific commands. This utility is restricted to the root user for direct command execution, though the -c flag allows all users to execute scripts via csh for compatibility with the rc system.

    To use the utility, run it without arguments to enter the interactive menu, or use the -c flag to run a specific script.