4748 Commits

Author SHA1 Message Date
Ad Schellevis
09bd2d96cc Interfaces: Devices: Bridge - refactor bridge (re)configuration, as with most new components, we should check what we have first before applying to prevent a lot of unuseful calls and possible service disruptions. pre work for https://github.com/opnsense/core/issues/8353
In order to plan->do->act we need the current settings of the existing bridge, which is where legacy_interfaces_details() comes into play, which needs some additional parsing.
Next we can diff per type of setting and apply when changed.
2025-04-09 11:16:42 +02:00
Ad Schellevis
5629911558 System: Trust: Authorities - prevent recusrion loop when ca's are cross referencing eachother.
Although this is highly uncommon, it's very annoying when the certificate path leads to an "Fatat error: Allowed memory size exhausted...".
If we do end in a loop (e.g. same ca already in the path), exit the calculation and return what we found sofar.
2025-04-08 11:45:21 +02:00
Franco Fichtner
0a33697a90 interfaces: allow literal comma by escape sequence '\,'; closes #8503 2025-04-07 12:09:23 +02:00
Franco Fichtner
d3c5aa22a0 system: refactor vip access 2025-04-04 11:52:39 +02:00
Franco Fichtner
e6a4bde0bf system: cleanup unused since 945bd66a3dc8 2025-04-04 11:49:55 +02:00
Franco Fichtner
868a74e058 interfaces: cleanup spurious functions regarding VIP access
We do this for different reasons, but mainly for code maintenance
and simplicity.  It also fixes a few aquire/display bugs with
overlapping linl-local VIPs across interfaces, but not all.
2025-04-04 11:29:51 +02:00
Franco Fichtner
63b9f2e1aa system: allow multiple manual DNS search domains; closes #8522
The length and input isn't bound but when writing resolv.conf
we will adhere to the requirement mentioned in the man page:

    The search list is currently limited to six domains
    with a total of 256 characters.

We simply don't always know how many the system was being provided
with from the ISP so it is what it is.
2025-04-03 11:18:25 +02:00
Ad Schellevis
b55023315c Services: Kea DHCP: Kea DHCPv4 - allow manual configuration for advanced scenarios, closes https://github.com/opnsense/core/issues/7822
This commit adds a toggle which skips config file generation for kea-dhcp4.conf and lets the user handle it manuallt, service startup and control stays in place while manually configured.
When manual mode is selected, all other options will be hidden in the form, which should help people understand (and read) what the purpose of this toggle is (advanced mode).
2025-04-01 21:22:02 +02:00
Monviech
8d6ca1fa98
dnsmasq: Add full dhcp-host support for IPv4 and IPv6 (#8497)
* dnsmasq: Add full dhcp-host support for IPv4 and IPv6

* dnsmasq: Cleanup previous in dnsmasq.inc

* dnsmasq: Change comma placement in template to reduce one condition

* dnsmasq: Add validation to client_id

* dnsmasq: There can be multiple hardware addresses so change label accordingly

* dnsmasq: Change hostname validation so that client_id is also a valid choice without hostname defined.

* dnsmasq: Add validation that prevents duplicate IP addresses in dhcp-host set

* remove one stray newline

* Services: Dnsmasq DNS & DHCP - minor cleanups in https://github.com/opnsense/core/pull/8497

o fix possible race condition in validations
o simplify jinja template

---------

Co-authored-by: Ad Schellevis <ad@opnsense.org>
2025-03-28 19:48:33 +01:00
Franco Fichtner
7dae89eadf system: small audit of auth.inc 2025-03-26 08:55:41 +01:00
Stephan de Wit
370fdcffcb system: set senderr_demotion_factor to 0, fixes https://github.com/opnsense/core/issues/8437 2025-03-24 15:59:13 +01:00
Ad Schellevis
84f48985bf Services: Unbound DNS: Overrides - add optional TTL field, closes https://github.com/opnsense/core/pull/7616 2025-03-22 10:30:37 +01:00
Franco Fichtner
ec634601fe radvd: move plugin code to its own space #8351 2025-03-20 10:10:18 +01:00
Franco Fichtner
d0825d298e system: typo 2025-03-18 16:37:22 +01:00
Franco Fichtner
f482df7d71 system: remove optional defaults, secure access to sysctl node
The node is now empty by default so code peeking into the items
should check beforehand or use a safe iterator like config_read_array().

This is for 25.7 with the infamous two security sysctls flipping back
to FreeBSD defaults.
2025-03-18 16:33:35 +01:00
Ad Schellevis
ff91932d5d System: Gateways: Configuration - add "Kill states when down" option trigginer a gateway kill for all states with this gateway set, proposal for https://github.com/opnsense/core/issues/6803
* hide monitor options when disabled
* wire configd kill gateway command for 'pfctl -k gateway -k gwip'
* pass required properties in dpinger_status()
2025-03-13 20:23:27 +01:00
Franco Fichtner
d77bd0a8fb system: remove GDrive backup from core
Still needs migration glue, but mechanics are done.

PR: https://github.com/opnsense/core/issues/8343
2025-03-12 08:11:25 +01:00
Franco Fichtner
83723fdb5f system: typo 2025-03-10 09:12:21 +01:00
Franco Fichtner
8591b00bd6 config: adjust a comment 2025-03-10 09:10:43 +01:00
Stephan de Wit
f59c938a58 shaper: move to mwexec and annotate 2025-03-07 16:37:01 +01:00
Stephan de Wit
d52f6ca1f2 shaper: make sure dnctl is started before pf
We cannot guarantee this happens via RC, so skip it there and
unconditionally reload it during the filter reload.
2025-03-07 13:35:16 +01:00
Franco Fichtner
85319e2501 system: migrate 'default' tunable value to empty one #7440
After a bit of back and forth and issues reported with
bootstrapping it's better to get rid of the old keyword
which unifies the default selection under the empty value.
2025-03-05 14:17:58 +01:00
Ad Schellevis
3185ba9cf0 tunables: empty values are defaults in our new mvc model, prevents "sysctl: empty numeric value" messages during boot. 2025-03-05 11:01:31 +01:00
Franco Fichtner
bb37fa89e7 interfaces: kill another "realif" side effect
This inline-assign shouldn't happen anymore (likely a very early version
using the wlan device name implicitly).  Maybe for 25.7, needs a tiny code
audit at one point but since the other cruft changes are in 25.1.3 this
makes sense to push.
2025-03-04 15:46:04 +01:00
Franco Fichtner
3089115076 network time: xmlrpc definition to correct file 2025-03-04 14:10:40 +01:00
Franco Fichtner
c8e8b49db1 config: typo 2025-03-04 11:47:21 +01:00
Franco Fichtner
bf4c93f6b0 system: remove xmlparse.inc now since it's mostly unused
Keep the dreaded listtags() around, but it's already pretty
sparsely used.  A brave new world.
2025-03-04 11:40:12 +01:00
Ad Schellevis
a0fca2cc2f Services: Dnsmasq DNS & DHCP - reorganize general dhcp settings, add nosync to it and ranges so we can test the new nosync approach. for https://github.com/opnsense/core/issues/8329 2025-03-04 11:32:39 +01:00
Franco Fichtner
bbe8cbb49a src: style sweep 2025-03-04 11:03:10 +01:00
Ad Schellevis
8e64f0dffb xmlrpc: extend nosync support to keep backup items for new cases, closes https://github.com/opnsense/core/issues/8394
We never rely on xml ordering, which means a "nosync" can always be appended or prepended into an existing dataset (as long as uuid's don't overlap, but that's a bit of a corner case).

This commits tracks the nosync items inside the dataset to sync and prepends them to the new target set, so all nosync items on the back remain where they belong.
2025-03-04 10:57:20 +01:00
Franco Fichtner
c864f9f3b0 system: align dnsallowoverride* flags with MVC store approach
Also change the default config.xml to avoid new install side effects.
2025-03-04 10:47:10 +01:00
Ad Schellevis
fc6e169a47 xmlrpc: time for some spring cleaning before working on https://github.com/opnsense/core/issues/8394
The $sync_full  construct always looked a bit weird, certainly as different other comparable config sections don't seem to have the same issue as mentioned in the original commit (1b99e1e53a). Tried the nat rules on an existing setup after this change, which still works like a charm.
2025-03-04 09:57:59 +01:00
Ad Schellevis
592a62b0df
wizard: reimplement system setup (#8378)
* wizard: reimplement system setup, for https://github.com/opnsense/core/issues/8352

This commit implements our replacement for the setup wizard. The questions are roughly the same as in the legacy version.
Some less relevant options have been removed (pppoe ondemand for example) and isc-dhcpd has been replaced with dnsmasq.

Only standard tools have been used, a memory model to validate the data and simple input forms in tabs.

The in memory model acts as a wrapper around a legacy configuration data and a couple of component models to apply the requested settings.

Some legacy settings using isset() have been altered to use their empty() equivalent.

* wizard: as we're changing to dnsmasq as default, we need to make sure the console setup configures the same (https://github.com/opnsense/core/issues/8352)

Fix some small php arnings in the process, but further than that just rewrite the dhcpd console handling to use dnsmasq instead of isc.
Eventually we will need to rewrite the console tools as well, but let's try to keep this compatible with minimal impact.

* wizard: change other occurrences of isset($config['dnsallowoverride']) for https://github.com/opnsense/core/issues/8352

* wizard: sort listtags() and some other minor review comments for https://github.com/opnsense/core/issues/8352
2025-03-03 15:26:16 +01:00
Franco Fichtner
ffc5d4ae65 src: style sweep for cp changes 2025-03-03 12:04:58 +01:00
Stephan de Wit
d08addc25c
Captive Portal: migrate to pf (#8368)
* Captive Portal: WIP for migration to pf (https://github.com/opnsense/core/issues/8326)

Captive Portal: cleanup references to ipfw

Captive Portal: move accounting deletion to get action, update references and descriptions

Captive Portal: remove note

Captive Portal: move accounting to pf match rules

Captive Portal: cleanup and shorten code

Captive Portal: parser issue after refactor

Captive Portal: update logo in default login page

* Captive Portal: internal alias should not be editable

* Captive Portal: move to periodic accounting sync

* Captive Portal: update lighttpd zone config

* Captive Portal: ether rules for accounting

* Captive Portal: safe accounting fetch

* Captive Portal: move counter calculation to bgprocess

* Captive Portal: remove nested anchors, match anchors on interfaces as well

* Captive Portal: move service logic to captiveportal.inc

* Captive Portal: leftover test statement

* Captive Portal: properly initialize accounting result

* Captive Portal: cleanup sql

* Captive Portal: Implement backend requirements for RFC 8908

While here, the zoneid is provided to the client, even though there
there is no need to do so. Instead let lighttpd forward the
request with an added header containing the zoneid of the client

* Captive Portal: review feedback

* Captive Portal: from_not case
2025-03-03 10:48:57 +01:00
Ad Schellevis
03f96eb008 Interfaces: Virtual IPs / xmlrpc - skip nosync processing on vips, for https://github.com/opnsense/core/issues/8387 2025-03-02 17:05:33 +01:00
Ad Schellevis
a893cdc7a5
VPN: IPsec: Mobile Clients - move charon attributes to "Advanced settings" for https://github.com/opnsense/core/issues/8349 (#8380)
Rename previous "advanced settings" to "mobile & advanced settings" to guide people into the right direction, strongswan.conf contains both sets of data.
Keep legacy page for settings that are only relevant for the old components.

Since our pam authenticator hooks into the configuration, refactor to use the model as well.

Cleanup code in the model that was only used in the legacy glue.
2025-02-28 13:53:25 +01:00
Franco Fichtner
a722c36552 plugins: style 2025-02-27 10:11:32 +01:00
Franco Fichtner
3a68aac583 plugins: treat empty string like null on argument map
The backend will turn optional parameters into empty string
arguments which should mean all was selected and not one that
has a blank name.
2025-02-27 09:28:08 +01:00
Ad Schellevis
3e299b29b9 dnsmasq/unbound - mark 'template reload' action as cleanup.
Ideally these spots should not be needed as the frontend generates the configuration and on boot these are flushed as well, ... but, when interfaces change during boot or triggered by the wizard, these parts are not aware of these facts.

as discussed with @fichtner
2025-02-26 16:56:38 +01:00
Franco Fichtner
b94578935f dnsmasq: migrate to rc.d scripting 2025-02-25 00:11:04 +01:00
Ad Schellevis
d1b4277047 filter: add missing "persist" on bogonsv6, closes https://github.com/opnsense/core/issues/8376 2025-02-24 18:20:45 +01:00
Franco Fichtner
1581bcd87c dnsmasq: repair the dns_ports validation 2025-02-20 10:34:27 +01:00
Ad Schellevis
bcf8f9ae75
dnsmasq: Backend migration and add dhcp support for https://github.com/opnsense/core/issues/8329 (#8355)
This rather large commit implements most relevant dhcp options and rewrites dnsmasq's backend.

By default dnsmasq is disabled, eventually we do want dnsmasq enabled for dhcp services by default, but dns itself disabled. For this reason we support port "0" as implemented at dnsmasq (not listening for dns).

For cases where users want to integrate dns and dhcp services, the advise is to make dnsmasq listen on a non standard port and point unbound to the zones where dnsmasq is responsible for. This has the advantage of a direct connection between dhcp registered hosts and the requesting service. In these cases dnsmasq's dns service acts like a "connector".

In the long run we should deprecate `regdhcpstatic` and `regdhcp` as these either belong to legacy isc-dhcp or hook kea entries (which are better served via unbound).

The first mvc migration phase implemented IndexController.php, which we rename to SettingsController.php now as these results in more logical ui endpoints.

Since we don't bind to addresses directly (unless specifically configured and adviced only for static setups), we can skip the newwanip event which means we don't restart the service on interface changes. dnsmasq is able to filter the relevant networks on the fly, which is the advised scenario and can cope more easily with changes.

When different clients need to receive different options, we can use "tags" now. Requests can add tags to filter options which will be offered to the client, in the most simple scenario one would tag on a range or a host reservation, but more advanced choices can also be achieved using match statements (for example architecture [client-arch])
2025-02-19 17:40:55 +01:00
Franco Fichtner
82b36deee3 interfaces: exclude automatic radvd like we do for manual #8295 2025-02-19 07:27:40 +01:00
Franco Fichtner
caf8d65b28 system: straighten out syslog-ng rc.d scripting
Make sure that 'pluginctl -s xxx stop' isn't used here as it
does not stop a disabled instance.  The point is moot for
syslog-ng since you cannot disable it but that only leaves
a tiny amount of daemons that still use it in core (nothing
in plugins uses it).

Also consolidate away from service(8) since we expect and
call the rc.d script directly.
2025-02-18 13:50:08 +01:00
Franco Fichtner
6d444663a2 plugins: move a comment 2025-02-17 12:26:14 +01:00
Ad Schellevis
0063b16b3e dnsmasq: migrate to MVC/API, make sure service is reachable when still running and disabled so we can kill it, although not a new issue, better fix it for https://github.com/opnsense/core/issues/7905 2025-02-15 16:47:31 +01:00
Ad Schellevis
d620298cbe dnsmasq: migrate to MVC/API, forgot an isset() --> !empty() in https://github.com/opnsense/core/issues/7905 2025-02-15 16:37:21 +01:00
Franco Fichtner
cde5b0d685 system: unused default since 5bb73b120ba
It's optional so only enforced when we had to employ that
particular workaround.  Eventually we will jus tremove it.
2025-02-14 09:11:12 +01:00