Commit graph

948 commits

Author SHA1 Message Date
Franco Fichtner
a6da34447c system: style sweep and plist fix 2026-04-13 17:23:43 +02:00
Franco Fichtner
0175c1e1f0 firmware: moved FreeBSD.php duty to opnsense-update
PR: https://github.com/opnsense/update/commit/aeb88a8fb9
2026-04-13 10:39:37 +02:00
Ad Schellevis
1c2405e480 mvc: introduce JSON field type and refactor dashboard to use it, closes https://github.com/opnsense/core/issues/10064
We can use the same fieldtype for the favorites PR (https://github.com/opnsense/core/pull/10033)
2026-04-09 20:34:13 +02:00
Ad Schellevis
1216d603f9 mvc: MenuSystem - add JavaScript wrapper, POC code for https://github.com/opnsense/core/pull/10086
Although this isn't a full implementation yet, it can help callers that need to access the menu system.
In the long run it might be practical if this class would also construct the menu system, so we can add some flexibility there.
2026-04-06 12:37:22 +02:00
Monviech
84ec45409d
VPN: OpenVPN: add tls-crypt-v2 support (#10069)
* VPN: OpenVPN: Add tls-crypt-v2 support, initial implementation

* Unify key generation into a single bash script that handles stdout parsing and always emits base64, consume that in the key generator

* plist fix

* Add comment that explains stuff a bit better

* VPN: OpenVPN: add tls-crypt-v2 support - refactor https://github.com/opnsense/core/pull/10069

---------

Co-authored-by: Ad Schellevis <ad@opnsense.org>
2026-04-02 18:10:12 +02:00
Stephan de Wit
fabdca9ad5 pkg: fix plist 2026-04-02 13:38:44 +02:00
Monviech
9f10ba9d9c
Services: Kea: DHCPv4/6: Add delete lease command, use socket for up to date lease collection (#10019)
Co-authored-by: Stephan de Wit <stephan.de.wit@deciso.com>
2026-04-02 09:15:35 +02:00
Stephan de Wit
8bc595681e pkg: fix plist 2026-04-01 09:42:06 +02:00
Franco Fichtner
292a7889b6 mvc: add SetConstraint for #10029 2026-03-25 11:39:40 +01:00
Monviech
5b4ae2c56e
Services: Kea: DHCPv4/6: Add type system with validation and encoding for supported DHCP options (#9995)
* Services: Kea: DHCPv4/6: Add type system with validation and encoding for supported DHCP options

This adds a type framework using MAPS extracted from data inside the KEA documentation.

Most flat options have a validator and encoder added. Users are guided via validation messages which types are correct choices for each code selection.
Advanced options (structured, nested, encapsulated) do not have an own validator or encoder yet, they fall back to hex.
Unknown options that are valid in the IANA lists, but maybe not inside KEA yet, also fallback to hex.

The user can always bail out of the type system and always use hex instead for any option.

* CodeSource was missing, preventing match_code and code to be evaluated independently upon instantiation of the field type

* Clean up some failguards since if those conditions would be true I don't want to fail silently

* Turn encoding into a map so the code is easier readable, add missing uint length validation

* Do not hide this error silently

* Add missing encodeHex() function and normalize to uppercase to relax validation a bit

* Forgot two spots that still refer uppercase as mandatory

* Change getEncodedValue() to encodeValue() Feedback from @fichtner

* Some light restructuring, reduce amount of public endpoints, turn them private.

* Cull two helpers that are only used once

* An unknown option should only allow hex, otherwise we accidentally allow all encoding types. The IANA list may contain options that are not inside the DHCPv4 or DHCPv6 maps

* Fix int32 validator

* Some minor cleanups to reduce some single use variables

* Update src/opnsense/mvc/app/models/OPNsense/Kea/FieldTypes/KeaOptionDataField.php

Co-authored-by: Franco Fichtner <franco@opnsense.org>

* Update src/opnsense/mvc/app/models/OPNsense/Kea/FieldTypes/KeaOptionDataField.php

Co-authored-by: Franco Fichtner <franco@opnsense.org>

* Add comments to the more complex encoders and fix some missing uint encoders

* I forgot the encodeString() encoder :D

* Add KeaOptionDataFieldTest.php with test cases for each encoder

---------

Co-authored-by: Franco Fichtner <franco@opnsense.org>
2026-03-22 15:14:23 +01:00
Franco Fichtner
5cbaf605f6 pkg: fix plist 2026-03-18 14:09:49 +01:00
Franco Fichtner
1b492c8188 system: add extension to script for completeness 2026-03-17 09:56:06 +01:00
Monviech
b67a8fdc93
Services: Kea: DHCPv6: allow sending any DHCPv6 option as raw hex payload (#9982) 2026-03-17 08:20:32 +01:00
Franco Fichtner
5b07e09174 src: style, plist and syntax fixes 2026-03-16 12:36:32 +01:00
Monviech
8350fcb73b
Services: Kea: DHCPv4: allow sending any DHCP option as raw hex or string payload (#9958)
This uses csv-false to force kea to send option data as hexadecimal value, instead of enforcing types on them.

This means theoretically you can now send any byte coded option out, meaning the user can construct whatever value they need. This also means encapsulated options like 43 can be sent in the format any vendor might require, as binary that is.

There is also another possibility, a very specific format of data can automatically convert strings into hex (bytes), kea handles this conversion internally. "data": "'convert this text to binary'"
2026-03-16 11:47:47 +01:00
Monviech
e5b530a67c
Services: Kea DHCP: Add DDNS feature for subnet4 and subnet6 (#9923)
* kea: WIP add dhcp-ddns daemon with forward zone support, goal is initial feature parity with what ISC had.

* Add a default for ddns_domain_algorithm inside the config generator

* The control socket is not needed right now. It would only be required to directly query the ddns server

* Some updates to ddns model and dialogs

* Update service controls via data_service_widget

* More terminology changes for ddns server ip and port

* It looks like a trailing dot validation is not necessary as the configuration is valid regardless, kea does not crash or log any error here

* Add constraints for key_name and key_secret to be used together, adjust some property names for clarity, extend ddns_domain_key_algorithm with all supported values per documentation

* Use single validation string

* Small tweak on validation message, push default of key_algorithm to model

* key_algorithm is required due to the default

* Fix labels in dialogs

* Validate dependency between forward zone and DNS server

* Now that we tightened validation in the model we can drop some guards in the config generator

* Lets not offer manual config at the beginning

* Add newline to model

* Copyright date

* fix DDNS config generation to place key-name at domain level and deduplicate DNS servers

* Update src/opnsense/mvc/app/models/OPNsense/Kea/KeaDdns.php

Co-authored-by: Franco Fichtner <franco@opnsense.org>

* Review comments, add trailing commas for diff control reasons

* Add a DependConstraint for ddns_domain_key_secret instead of making it a required field, saves on model migrations

* Apply suggestion from @Monviech

* Minor terminology adjustments

* Forgot the ACL name

* This guard is not needed, it's better if the config keys become empty arrays when nothing is configured to prevent old data sticking around

* Simplify ctrl_agent volt page to look like the new ddns agent volt page for consistency

---------

Co-authored-by: Franco Fichtner <franco@opnsense.org>
2026-03-12 09:39:54 +01:00
Franco Fichtner
7e089dab01 backend: remove unused examples throwing errors now
PR: https://forum.opnsense.org/index.php?topic=51166.0
2026-03-05 13:43:36 +01:00
Franco Fichtner
adf02f8359 interfaces: move dhcpd neighbor entry feed to plugin 2026-02-27 14:41:50 +01:00
Monviech
adf462a882
Services: Captive Portal: Move template actions out of the ServiceController into its own TemplateController, so it can use the ApiMutableModelControllerBase methods (#9799)
Please note that this contains a breaking API change for the Captive Portal template controller.
2026-02-24 11:08:49 +01:00
Monviech
6bd26c248b
Firewall: NAT: Merge npt_rule, onat_rule, snat_rule, dnat_rule into a single nat_rule template (#9855)
Most notable differences that are decided by the controller providing an "entrypoint" and "categoryKey" variable:
- controller name (entrypoint)
- category key (category vs categories)

Other subtle differences:
- enabled/disabled key (dnat is disabled)
- DNAT local port cannot do port ranges so the list_port_select_options reflect that

The functionality should be the same as before with less code as the same view template can be shared by all NAT controllers.
2026-02-24 09:58:16 +01:00
Monviech
7738d7e865
mvc: collect uuid field so it can be searched, but only if the searchPhrase contains a valid UUID (#9780)
Add UUID to the fields that can be searched, but only if the searchPhrase contains a valid UUID. That way it won't match on partial strings.

* Create new Type class in core library and add isUUID static, replace individual callers with the new static.

* Add a new static function containsUUID() to the new Type class.

* Move searchPhrase tokenization to ApiMutableControllerBase searchBase()
Determine if search_tokens contain a valid UUID, if yes collect the uuid field so it can be searched. Doing this prevents finding partial strings in UUIDs, but allows to find exact UUIDs.
Inside UIModelGrid fetchBindRequest(), use the search_tokens directly. A compatability case makes this backwards compatible for callers that do not know about search_tokens.
Pass the search_tokens directky into UIModelGrid fetch() instead of the raw searchPhrase.
2026-02-16 09:29:50 +01:00
Franco Fichtner
f55124ab61 firmware: move this to opnsense-update 2026-02-12 09:02:42 +01:00
Franco Fichtner
2a90becd2e firmware: add aux repository for #9275
Not a toggle yet but also only on development for now.
2026-02-12 08:44:06 +01:00
Franco Fichtner
49d573691f tests: one more for protocol replacements; closes #9744
The tests aren't complete but they do cover parseReplaceSimple()
in its latest form so that's good enough.

Just as a note the tests are designed to be render-agnostic so
that we always start with our rule input and produce pf.conf
compatible rulesets with the tests.  There are two purposes here:

1. Catch regressions when parsers are changed and that also includes
   switching the parser implementation completely in the future.

2. Make sure that the files are actually compilable by pf.conf and
   this should be covered later (the conf files are there on the
   disk for that purpose).

This is the right type of testing for the purpose since the pf.conf
syntax is virtually static and will require little maintenance.
Just needs a lot more coverage for the missing features/rule types.
2026-02-09 08:32:46 +01:00
Franco Fichtner
b50350a910 tests: add FilterRule testing for #9744
The test already revealed an issue with the refactor:

replacing "any" with "" and then "" with "in" is not in
the interest of the inventor.  Fix follows.
2026-02-06 21:28:06 +01:00
Franco Fichtner
b25bdee3b4 mvc: Shell: rewrite exec_safe() to avoid vsprintf() complications; closes #9703
Only support %s and %% using preg_replace_callback() and throw
3 distinct TypeError cases making sure the resulting command is
the dummy command then.

We're not overly interested in how well escapeshellarg() works,
but we ensure it's being called always.
2026-02-05 13:16:11 +01:00
Franco Fichtner
e771a800d5 ipsec: same same, switch class name not file name 2026-02-03 08:24:04 +01:00
Franco Fichtner
b95c81d08d interfaces: class name was wrong, fix UI page link 2026-02-03 08:18:31 +01:00
Franco Fichtner
9e70ee7508 mvc: use linter to find two wrong file names; closes #9638 2026-01-30 09:02:05 +01:00
Franco Fichtner
43de1e0e42 interfaces: generalise the dhcp6c_script using the new IFNAME variable #7647
Now that the new dhcp6c code is in 26.1 we can start using it.

The file was conceptually created inline via d36f0f4f62 and before was
a single command line script... so add appropriate copyrights from that
time onward.

Many thanks to Martin for pinoeering this back in the day!
2026-01-28 22:27:07 +01:00
Franco Fichtner
a35dce38e8 firmware: revoke 25.7 fingerprint 2026-01-27 12:57:28 +01:00
Franco Fichtner
b5bcb5f524 firmware: remove training wheels 2026-01-27 11:14:25 +01:00
Franco Fichtner
b787479933 system: provide override banner and inline hint for /etc/resolv.conf(.local) 2026-01-27 07:56:54 +01:00
Franco Fichtner
2b19239c14 rc: hostwatch glitch should be gone in RC2 with latest package
PR: https://github.com/opnsense/hostwatch/issues/7
2026-01-24 14:25:06 +01:00
Franco Fichtner
b439e6484f interfaces: move migration prefix for new settings
Error: Call to a member function applyDefault() on null

(from the Bridge model)
2026-01-21 14:02:10 +01:00
Franco Fichtner
d50fa90438 firmware: add 26.1 fingerprint and revoke 25.1 2026-01-20 17:45:37 +01:00
Ad Schellevis
70ee0f8795
Firewall: Rules: Migration assistant - add export option and guidance for migrations to the new mvc system. (#9606)
* Firewall: Rules:  Migration assistant - add export option and guidance for migrations to the new mvc system.

Add new "Firewall: Rules: Migration assistant" to help people moving to our new mvc based firewall system by offering a couple of simple steps for exporting the old rules into a csv file and importing them into the new system. When all rules are migrated the user may drop all old ones using the ConfigMaintenance module used in "defaults".

There's one small issue remaining in fbegin.inc as it doesn't render the icon correctly due to VisibleName being escaped currently (which isn't the case in our mvc template).

closes https://github.com/opnsense/core/issues/9579

* Update src/opnsense/service/conf/actions.d/actions_filter.conf

---------

Co-authored-by: Franco Fichtner <franco@opnsense.org>
2026-01-20 16:31:13 +01:00
Franco Fichtner
13043f8503 interfaces: generalise the rtsold_script #7647
The bulk of this started in 732e4b3388 but Martin was involved
here too over the years.  To make this work read the daemon
configuration from the respective daemon config file.
2026-01-19 09:52:04 +01:00
Franco Fichtner
b75dccbf59 interfaces: add a workaround for one-time sefgault in hostwatch
Seen this during testing but it's hard to debug in that post-update state
during bootup.  In principle nothin g even changed between "50" and "90".
2026-01-15 15:15:37 +01:00
Franco Fichtner
c0e2db45eb firmware: ok no safety net then
>>> Invoking update script 'isc-dhcp-plugin.sh'
Installing legacy ISC-DHCP plugin for compatibility...
Strict TLS 1.3 and CRL checking is enabled.
Updating OPNsense repository catalogue...
OPNsense repository is up to date.
All repositories are up to date.
process with pid 7698 still holds the lock
process with pid 7698 still holds the lock
process with pid 7698 still holds the lock
process with pid 7698 still holds the lock
process with pid 7698 still holds the lock
process with pid 7698 still holds the lock
pkg: Cannot get an advisory lock on a database, it is locked by another process
process with pid 7698 still holds the lock
process with pid 7698 still holds the lock
process with pid 7698 still holds the lock
process with pid 7698 still holds the lock
process with pid 7698 still holds the lock
process with pid 7698 still holds the lock
pkg: Cannot get an advisory lock on a database, it is locked by another process
2026-01-14 17:06:50 +01:00
Franco Fichtner
d6790ecd9d firmware: on the development side run the isc-dhcp plugin hook too
Since we removed the code make sure the update goes ok since the
imminent reboot can have a bad effect on recovery.
2026-01-14 15:42:14 +01:00
Franco Fichtner
9136078f2f isc-dhcp: syslog definitions and reshuffling 2026-01-14 15:09:59 +01:00
Franco Fichtner
729833cc63 isc-dhcp: more easy files for #9155 2026-01-14 14:22:21 +01:00
Franco Fichtner
fd0c70d62c isc-dhcp: move two scripts to their callers #9155 2026-01-14 14:04:40 +01:00
Franco Fichtner
23589f1643 isc-dhcp: remove main files for #9155
It will probably take more time to remove the loose ends but this
is the working bulk state for the pluginification.
2026-01-14 13:45:55 +01:00
Franco Fichtner
4469cf25a5 isc-dhcp: very simple migration script #9155
We're going to need this for 99% of the cases in existing installs
so instead of checking for something just install it and ask the
user to let it go if unneeded.
2026-01-14 11:11:08 +01:00
Franco Fichtner
e1cc2661b6
router advertisements: migrate to MVC/API (#9603)
Migrate router advertisements to its own space. Although
the data shifts around a bit the end result should be equivalent.

Of note is that we currently do not have visibility for automatic
interface tracking when not disabled, but they can be disabled
manually by adding the interface configuration and unchecking
the service enable.

Co-authored-by: Monviech <gitacc@pischem.com>
2026-01-12 13:10:55 +01:00
Franco Fichtner
737228bd0e system: move the deprecated opnsense from template to package
It's static anyway and it makes removing it easier so eventually
it won't linger in the file system as the package can remove it.
2026-01-07 20:30:34 +01:00
Franco Fichtner
69a62f0162 interfaces: bring DUID flush code closer to interfaces.inc and avoid extra script 2026-01-07 15:04:19 +01:00
Stephan de Wit
6e6369a77b
interfaces: settings: convert to MVC (#9569) 2026-01-07 14:24:49 +01:00