Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions GOTCHAS.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ An OPNsense migration can move a legacy element into an `<OPNsense>` model and d
- **Instance (fixed):** OPNsense 26.1 moved the IPv6, offload and VLAN filter settings from `<system>` into `<OPNsense><Interfaces><settings>` (`Interfaces/Migrations/SET1_0_0.php`), turning `ipv6allow` into the inverted `disableipv6`. On a migrated config all five fields read as off, so FIREWALL-006 passed on firewalls with IPv6 enabled. `applyInterfaceSettings` reads the block now. OPNsense 26.1 and later read only the block, so it wins over anything left in `<system>`. Without the block the converter falls back to `<system>`, which is right for older configs but can disagree with a 26.1.0 config whose migration failed (a `<dhcp6_norelease>yes</dhcp6_norelease>` broke it until 26.1.1); OPNsense then treats IPv6 as allowed and offloading as on.
- **Instance (fixed):** OPNsense 24.1 moved gateways from `<gateways><gateway_item>` into `<OPNsense><Gateways>` (`Routing/Migrations/M1_0_0.php`) and deleted the originals, so a config whose gateways had migrated exported none. `convertGatewayItems` reads the model when it holds a gateway and `<gateways>` otherwise, the rule the vendor's `gatewayIterator` follows; a `<gateway_item>` with no child element does not count (§3.4). Legacy gateways left beside a model that holds one, as after a failed migration or a hand edit, are ignored with a Medium warning naming them, as the converter warns wherever it ignores something the config says (§3.6). Gateway groups stayed under `<gateways>`. The model writes `defaultgw` and `monitor_disable` as `0` where the 23.7 page left the element out, and `common.Gateway` keeps both as text, so `gatewayFlag` reduces them to `1` or empty for either store. Copied as they stand, every gateway that is not the default would export `"defaultGw":"0"`. The stores read an absent `monitor_disable` differently: the model defaults it to `1`, which turns monitoring off, and `gatewayIterator` fills in `0` for a legacy gateway, so `Gateway.MonitorDisable` is a pointer (§3.2). `convertGateways` fills in `weight` and `ipprotocol` when they are empty, as current releases read them: the model defaults them to `1` and `inet`, OPNsense fills in `inet` for a legacy gateway with an absent or empty `ipprotocol` from 20.1.7, and gateway groups read an empty weight as `1` from 19.7. Before those releases such a legacy gateway had no address family and an empty weight stayed empty, and the export shows `inet` and `1` for them too. The exception is an empty `<ipprotocol/>` in the model, which stays empty on the firewall and which opnDossier cannot tell from an absent one; OPNsense never writes one, as the field is required. The model's default `interface` of `wan` is applied to a model item that leaves the element out, and not to a legacy gateway, to which `gatewayIterator` gives none. An empty `<interface/>` in the model stays empty on the firewall and reads as `wan` here, the same approximation as for `ipprotocol`, since the field is required and OPNsense never writes one. `fargw` goes through `modelFlagSet` as well: the firewall tested it with `isset()` up to 24.1.7 and with `!empty()` from 24.1.8, and the two differ only on `0` and an empty element. `disabled` does in the model only: `GatewayModelItem.Disabled` shadows the `BoolFlag` on the type pfSense shares with a `*string`. The firewall reads it with `!empty()`, which a `BoolFlag` reads the reverse of for an empty `<disabled/>`, and the pointer keeps an empty `<disabled/>` apart from an absent one, so that it is written back. Whether an item holding only `<disabled>` is a gateway is decided by `Gateway.HasChildElement` (§3.4), not by this field. Under `<gateways>` it is still the `BoolFlag`, so hand-written text can read the reverse of the firewall's `!empty()`, as `<disabled/>` and `<disabled>no</disabled>` do. The model keeps its items by uuid, so of two with one uuid the firewall holds the later, at the place of the earlier, and `modelGateways` does the same with a warning. An item with no uuid attribute gets a fresh one on every release. An empty uuid or `0` depends on the release: from 25.7 the loader tests `empty()`, which holds for both, and gives the item a fresh uuid, while through 25.1.12 it tests `isset()` and uses the attribute as the key, so two such items collide and the firewall holds the later. The model version is `1.0.0` on both sides, so `modelGateways` keeps both with a warning, which over-reports on the older releases. `GatewayModelItem.UUID` is a pointer to keep absent apart from empty (§3.2). The uuid is on `GatewayModelItem` rather than `Gateway` because `gatewayIterator` ignores one under `<gateways>`, and because an item with a uuid and no child element must stay a placeholder.
- **Detection:** for each OPNsense release, check what its migrations do to the elements the schema reads: a `post()` that unsets a legacy path (`src/opnsense/mvc/app/models/OPNsense/*/Migrations/`), or a model whose `<version>` went up and whose field list lost or renamed a field, since the migration replaces the model's whole node. Test the migrated shape by rewriting a fixture the way the migration does, as `TestConverter_InterfaceSettings_ReadFromMigratedBlock` does, rather than generating XML from the schema.
- **A release can stop reading an element without any migration touching it.** 20.1 dropped the remote server fields from the logging page and forwards only to `<OPNsense><Syslog><destinations>`, but nothing moved or removed `<syslog><remoteserver>`, `<enable>` and the per-category flags, and the pages that still write `<syslog>` write single keys into the existing array. An upgraded config keeps them, so FIREWALL-039, FIREWALL-041, SANS-FW-004 and STIG V-206678 to V-206681 passed on a firewall with no remote target. 19.7 read both stores, so no element marks the change; `convertSyslog` reads the legacy keys only when the config has no Syslog model and warns when it ignores them. Retention moved later and differently: migration M1_0_2 (24.7) copies `<preservelogs>` and `<maxfilesize>` into the model's `general`, which `log_archive` reads from then on. A migration search finds the second move and misses the first, so read the release's own readers too, not only its `Migrations` folder.
- **Pin the model version.** The new block's element names belong to its model version, so the converter warns on a `version` attribute it does not recognize, as it does for Unbound. See §18.1 for the risk.

### 3.8 OPNsense Keeps Firewall Rules in Two Stores
Expand Down
50 changes: 25 additions & 25 deletions docs/compliance-standards.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,25 @@ STIGs are cybersecurity methodologies for standardizing security configuration w
| V-206674 | Firewall must use packet headers and attributes for filtering | High | Packet Filtering | Implemented |
| V-206690 | Firewall must disable unnecessary network services | Medium | Service Hardening | Implemented |
| V-206682 | Firewall must generate comprehensive traffic logs | Medium | Logging | Implemented |
| V-206678 | Firewall must log event type information | Medium | Logging | Implemented |
| V-206679 | Firewall must log event timestamps | Medium | Logging | Implemented |
| V-206680 | Firewall must log network location information | Medium | Logging | Implemented |
| V-206681 | Firewall must log source information for events | Medium | Logging | Implemented |

### SANS Firewall Checklist

The [SANS SCORE Firewall Checklist](https://www.sans.org/media/score/checklists/FirewallChecklist.pdf) (prepared by Krishni Naidu) is a practical security audit checklist containing 24 numbered security elements for firewall configuration and management. It covers ruleset management, application-layer controls, logging, patching, DMZ architecture, anti-spoofing, port security, remote access, traffic filtering, and availability.

The current SANS plugin defines 4 controls with placeholder check logic. The checklist has been fully analyzed and 16 additional controls are planned for implementation, covering the complete SANS checklist.
The SANS plugin defines SANS-FW-001 to SANS-FW-025. The four controls in the table below were implemented first; the sections after it map the rest of the checklist. Some controls, such as SANS-FW-010 and SANS-FW-011, cannot be decided from config.xml and report Unknown.

#### Implemented SANS Controls

| Control ID | SANS # | Category | Title | Severity | Status |
| ----------- | ------ | ---------------------- | --------------------------- | -------- | ----------- |
| SANS-FW-001 | 1, 9 | Access Control | Default Deny Policy | High | Placeholder |
| SANS-FW-002 | 1 | Rule Management | Explicit Rule Configuration | Medium | Placeholder |
| SANS-FW-003 | 6 | Network Segmentation | Network Zone Separation | High | Placeholder |
| SANS-FW-004 | 4 | Logging and Monitoring | Comprehensive Logging | Medium | Placeholder |
| SANS-FW-001 | 1, 9 | Access Control | Default Deny Policy | High | Implemented |
| SANS-FW-002 | 1 | Rule Management | Explicit Rule Configuration | Medium | Implemented |
| SANS-FW-003 | 6 | Network Segmentation | Network Zone Separation | High | Implemented |
| SANS-FW-004 | 4 | Logging and Monitoring | Comprehensive Logging | Medium | Implemented |

#### Planned SANS Controls

Expand Down Expand Up @@ -137,7 +141,6 @@ See the [Firewall Security Controls Reference](firewall-security-controls-refere

- **Implemented** - Check logic evaluates config.xml data and produces compliant/non-compliant results
- **Unknown** - Control is defined but the required data is not available in config.xml (OS-level or model gap); the check always returns Unknown and no finding is emitted
- **Placeholder** - Control is defined with placeholder check logic that always returns compliant; real analysis will be added in a future release

#### Planned Firewall Security Controls

Expand Down Expand Up @@ -205,12 +208,12 @@ The following controls are organized by security domain and represent the full p

##### Logging and Monitoring

| Control ID | Title | Severity | Implementability | Description |
| ------------ | ---------------------------- | -------- | ---------------- | ------------------------------------------------------------------------------------------ |
| FIREWALL-039 | Remote Syslog Configured | High | Full | Logs forwarded to remote syslog/SIEM server (`Syslog.RemoteServer` non-empty) |
| FIREWALL-040 | Authentication Event Logging | Medium | Full | Auth logging enabled (`Syslog.AuthLogging`) |
| FIREWALL-041 | Firewall Filter Logging | Medium | Full | Firewall filter logging enabled (`Syslog.FilterLogging`) |
| FIREWALL-042 | Log Retention Configuration | Low | Full | Local log rotation and size limits configured (`Syslog.LogFileSize`, `Syslog.RotateCount`) |
| Control ID | Title | Severity | Implementability | Description |
| ------------ | ---------------------------- | -------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| FIREWALL-039 | Remote Syslog Configured | High | Full | Logs forwarded to remote syslog/SIEM server (`Syslog.RemoteServer` non-empty) |
| FIREWALL-040 | Authentication Event Logging | Medium | Full | Auth logging enabled (`Syslog.AuthLogging`) |
| FIREWALL-041 | Firewall Filter Logging | Medium | Full | Firewall filter logging enabled (`Syslog.FilterLogging`) |
| FIREWALL-042 | Log Retention Configuration | Info | Full | A local log size or archive limit is in effect, configured or the release default; fails while local logging is off (`Syslog.LogFileSize`, `Syslog.RotateCount`) |

##### Time Synchronization

Expand Down Expand Up @@ -310,14 +313,16 @@ The audit engine performs the following checks per plugin:

4. **Logging Configuration (V-206682)** - Analyzes syslog configuration for system and auth logging. Returns comprehensive, partial, not-configured, or unable-to-determine status. Finds non-compliant when syslog is disabled, logging is only partial, or logging status cannot be determined (e.g., rules exist but syslog is not configured).

5. **Logging Detail (V-206678 to V-206681)** - Requires firewall traffic logs to be forwarded: a remote destination that forwards and carries filter logging (`Syslog.FilterLogging`). A destination whose program, level or facility filter drops filterlog's entries does not satisfy them.

#### SANS Compliance Checks

All four SANS checks currently use placeholder logic:
The SANS checks look at the following:

1. **Default Deny Policy (SANS-FW-001)** - Placeholder: always returns compliant
2. **Explicit Rule Configuration (SANS-FW-002)** - Placeholder: always returns compliant
3. **Network Zone Separation (SANS-FW-003)** - Placeholder: always returns compliant
4. **Comprehensive Logging (SANS-FW-004)** - Placeholder: always returns compliant
1. **Default Deny Policy (SANS-FW-001)** - Looks for an enabled any-to-any pass rule with no enabled block or reject rule.
2. **Explicit Rule Configuration (SANS-FW-002)** - Looks for enabled pass rules without a description.
3. **Network Zone Separation (SANS-FW-003)** - Counts enabled network interfaces; at least two are required.
4. **Comprehensive Logging (SANS-FW-004)** - Looks for remote syslog that carries filter or authentication logging.

#### Firewall Security Compliance Checks

Expand Down Expand Up @@ -446,10 +451,6 @@ SANS-FW-008 (firmware version comparison), FIREWALL-034-035 (DoS protection tuna
Additional DISA Firewall SRG controls under consideration:

- V-206701: DoS attack prevention filters
- V-206680: Network location information logging
- V-206679: Event timestamp logging
- V-206678: Event type logging
- V-206681: Source information logging
- V-206711: DoS incident alerting

### Additional Standards
Expand All @@ -462,10 +463,9 @@ Additional DISA Firewall SRG controls under consideration:

### Planned Features

1. **Real SANS Check Logic**: Replace placeholder stubs with actual analysis
2. **Automated Remediation**: Generate configuration fixes
3. **Compliance Monitoring**: Track compliance over time
4. **Integration**: SIEM and ticketing system integration
1. **Automated Remediation**: Generate configuration fixes
2. **Compliance Monitoring**: Track compliance over time
3. **Integration**: SIEM and ticketing system integration

## References

Expand Down
Loading
Loading