16389 Commits

Author SHA1 Message Date
Ad Schellevis
dd394645ac System: Gateways: Configuration - prevent removal when gateway is bound to an interface, closes https://github.com/opnsense/core/issues/7270 2024-02-25 20:08:07 +01:00
Ad Schellevis
042486e704 System: Trust: Certificates - add initial wireframe for https://github.com/opnsense/core/issues/7248 2024-02-25 19:54:54 +01:00
Ad Schellevis
e516ea7ec8 mvc - extend model implementation to ease legacy migrations.
add migration strategy for LegacyMappers, when data is already available, migration should add uuid's to the records. Missed this in 35b5e0b64b
2024-02-25 19:49:34 +01:00
Franco Fichtner
084abdfb45 src: whitespace sweep 2024-02-25 18:40:47 +01:00
Ad Schellevis
36b2b66a33 Services: Intrusion Detection - set exception-policy to ignore as a precaution as suggested by @kulikov-a in https://github.com/opnsense/core/pull/7271 2024-02-25 18:09:12 +01:00
Ad Schellevis
4cf6870b03 Services: Intrusion Detection - bring suricata.yaml inline with https://github.com/OISF/suricata/blob/suricata-7.0.3/suricata.yaml.in and add our modifications. Most of the changes are changed comments, disabled the log settings that will add a lot of extra noise. 2024-02-25 15:07:13 +01:00
Ad Schellevis
9b82093ed2 Services: Intrusion Detection: Administration - set app-layer.error-policy to it's advertised default. closes https://github.com/opnsense/core/pull/7271 and https://github.com/opnsense/core/issues/7276 2024-02-25 13:47:33 +01:00
Franco Fichtner
fd00972988 unbound: fix missing /lib; closes #7274 2024-02-24 18:34:48 +01:00
Ad Schellevis
292a34d83f Interfaces: Overview - minor improvements.
* show dynamic interface properties when received. To prevent additional call overhead only parse the files ifctl leaves behind in /tmp/
  (merge ipv4 and  ipv6 properties into the same field as the address itself should be clear enough.)

* Since we rather keeo a single link type in the overview, fallback to ipv6 when ipv4 is not offered.

ref: https://forum.opnsense.org/index.php?topic=38223.msg191234
2024-02-24 16:30:38 +01:00
Franco Fichtner
ba4601adeb mvc: style sweep 2024-02-22 21:56:58 +01:00
Ad Schellevis
b34c52f997 Services: Kea DHCP: Kea DHCPv4 - add csv upload funcitonality for reservations. requires 6f87280cd4 + d66502881b + b8f39bf463 2024-02-22 21:36:44 +01:00
Ad Schellevis
b8f39bf463 mvc/jQuery - add onAction handler for SimpleFileUploadDlg() 2024-02-22 21:33:11 +01:00
Ad Schellevis
d66502881b MVC - some minor modifications in importCsv() to deduplicate messages and return fieldnames for easier tracking. Next we offer the import a ui companion as jQuery action named SimpleFileUploadDlg().
To use the upload, create a button offering a dialog title and endpoint like:

                        <button
                            id="upload"
                            type="button"
                            data-title="{{ lang._('Import') }}"
                            data-endpoint='/api/path/to/import_controller'
                            class="btn btn-xs"
                        ><span class="fa fa-fw fa-table"></span></button>

and hook functionality using:

$("#upload").SimpleFileUploadDlg();
2024-02-22 21:09:43 +01:00
Franco Fichtner
6b145065e5 wizard: always set WAN_GW #7263
This is a bit weird as we (re)set the interface if found but not when
we create it.  For consistency's sake this seems to be more appropriate.
2024-02-22 17:02:06 +01:00
Franco Fichtner
6984aefe43 system: ignore legacy invalid gateway structure
Adds a spurious gateway due to presence of <gateways><gateway_item/></gateways>
but it it also begs the question why we go into legacy mode when we only have
automatic gateways so none are stored in the MVC model, which is kind of a standard
case.
2024-02-22 12:44:59 +01:00
Franco Fichtner
bb17672ed8 wizard: further tweaking for #7263 2024-02-22 08:36:58 +01:00
Ad Schellevis
6f87280cd4 MVC - add importCsv() to ApiMutableModelControllerBase and its companion importRecordSet() in ArrayField. combined we should be able to upload csv data, import valid records and return valdation issues. 2024-02-21 19:17:27 +01:00
Franco Fichtner
2f55ed4706 wizard: reorder storage sequence to fix #7263 2024-02-21 16:20:04 +01:00
Franco Fichtner
935f041a8e wireguard: refactor configuration page for #7223
Since @swhite2 was asking to make a generalized pattern I played
with the layout a bit and ended up just moving the form below so
it actually holds more settings if it has.  This way the base_form
could be extended to only show a subset of settings (like enable)
but also show the full set if more settings are coming in.

While here adjust the menu structure and remove the ordering of
the VPN types since they order naturally.
2024-02-21 11:43:29 +01:00
Ad Schellevis
1d229551a5 System: Gateways: Configuration - fix dynamic gateway persisting its address. closes https://github.com/opnsense/core/issues/7261
Use the dynamic flag to clear the current known address on fetch, which is similar to what the legacy code used todo.

847d88416f/src/www/system_gateways_edit.php (L536)
2024-02-21 11:15:55 +01:00
Franco Fichtner
dc130145b9 mvc: style sweep 2024-02-21 10:31:18 +01:00
Ad Schellevis
12187631ff VPN: WireGuard: Settings / Instances - remove duplicate pubkey field in model and remove required tag also validate on base64. https://github.com/opnsense/core/issues/7229 2024-02-21 10:25:49 +01:00
Ad Schellevis
31bf0b0e6d Services: Kea DHCP: Kea DHCPv4 - add export as csv on reservations using a8d1a84fba 2024-02-20 18:10:01 +01:00
Ad Schellevis
a8d1a84fba MVC - add exportCsv() to ApiControllerBase to easily stream recordsets as csv files to the client and add asRecordSet() to ArrayField to be able to use this easily.
Sometimes it's practical to be able to use tools like excel to modify data, in order to do this we need an import and an export option in the model.
The export seems to be quite easy, controllers and forms can easily use this with a construction like:

$this->exportCsv($mymodel->myarray->asRecordSet());

The import is likely a bit more challenging.
2024-02-20 18:08:43 +01:00
Frank Wall
edf756eba9 rc: fix wrong order in service startup 2024-02-20 17:23:16 +01:00
Ad Schellevis
efb9162e69 Config: fix missing space in audit messages. closes https://github.com/opnsense/core/issues/7258 2024-02-20 16:09:20 +01:00
Ad Schellevis
e7d18bfedc Interfaces: Diagnostics: ARP/NDP Table - add missing ACL entries, closes https://github.com/opnsense/core/issues/7256 2024-02-19 13:00:53 +01:00
Franco Fichtner
637208acdb mvc: style sweep 2024-02-19 11:51:37 +01:00
Ad Schellevis
1ec272ad65 Interfaces: Other Types: VXLAN - wrong reference used in performValidation() (missing uuid), closes https://github.com/opnsense/core/issues/7255
While here, also cleanup trigger criteria (when the array type is changed, execute additional validations).
2024-02-19 08:43:09 +01:00
Ad Schellevis
5fc54cf66b mvc: Phalcon framework dependency (https://github.com/opnsense/core/issues/6389)
Fix regression in c2ea9aa303, performValidation() should return an object which is able to add new messages (using appendMessage()) as the previous Messages class did.
2024-02-18 19:32:45 +01:00
Ad Schellevis
35b5e0b64b mvc - extend model implementation to ease legacy migrations.
The complexity of some legacy modules such as the gateways indicate that it would be practical to offer something in between legacy and mvc. Normal modals require a single container to account for versions and easy access, where some legacy objects miss the container level in which case overlaying is not possible.

Without the singular container level, it's not possible to track versions and offfer migrations, but does prevent data being moved to different spots in the config.xml and break existing users of the same data.

This commit adds the isLegacyMapper() method, which is controlled by the model mountpoint using an additional plus (+) sign at the end of the mount. e.g. /cert+ would collect all items the xpath /opnsense/cert would offer and hooks them on items with the same array key.

For example, the model below would offer access to all cert items (and thus add's an uuid to them):
<model>
    <mount>/cert+</mount>
    <version>1.0.0</version>
    <items>
        <cert type="ArrayField">
            <refid type="TextField"/>
            <descr type="DescriptionField"/>
            <caref type="TextField"/>
            <crt type="TextField"/>
            <prv type="TextField"/>
        </cert>
    </items>
</model>

In the long run this would help migrate these kind of objects with minimal risk of breakage, making a full model migration at a later moment in time easier (which requires data to be moved into a single container).

Requirement for https://github.com/opnsense/core/issues/7248
2024-02-18 16:51:27 +01:00
Franco Fichtner
0ceefdb841 pkg: fix plist 2024-02-16 13:38:45 +01:00
Ad Schellevis
32d19ccc30 mvc : Phalcon framework dependency, replace Phalcon\Messages\Message for backwards compatible OPNsense\Base\Messages\Message class. for https://github.com/opnsense/core/issues/6389 2024-02-15 20:32:07 +01:00
Ad Schellevis
fa4e200fb4 phpdoc stylefix 2024-02-15 20:12:32 +01:00
Ad Schellevis
913fa71d88 mvc / CallbackValidator - remove Phalcon dependency for https://github.com/opnsense/core/issues/6389 2024-02-15 19:58:04 +01:00
Ad Schellevis
440b675ee6 mvc: refactor HostnameField, remove HostValidator dependency and add unit test. Fix a small issue where setIpAllowed() was set to 'N' and an ipv4 address was provided. 2024-02-15 19:54:09 +01:00
Ad Schellevis
b8734ae852 Services: Unbound DNS - dnsbl_module.py - prevent os.write() on None when another thread closed the pipe (self._pipe_fd) 2024-02-15 13:34:06 +01:00
Franco Fichtner
3cb2f3d794 system: style sweep 2024-02-15 11:49:07 +01:00
kulikov-a
1bd6823838 alias_util.volt: make select width more consistent 2024-02-15 11:10:14 +01:00
Stephan de Wit
fdc8a8fd2c gateways: fix migration issue causing gateways to be skipped
Properties should be copied 1-to-1 before we apply the required
defaults if necessary. In the previous situation this caused
required properties to be set to an empty value after the default
value had already been written to it. In the failure case we
attempt to be a bit more explicit and refer to the crash reporter.

While here, the master branch has dropped the Phalcon Messages class,
so switch to count() since this seems to inherit array type
and is therefore backwards compatible:

$msgs = new \Phalcon\Messages\Messages();
$count = count($msgs);
// $count == 0

See https://github.com/opnsense/core/issues/6389
2024-02-14 14:26:50 +01:00
Franco Fichtner
0873d89f3c src: style sweep 2024-02-13 21:18:20 +01:00
Ad Schellevis
8278fbe944 Services: Kea DHCP: Kea DHCPv4 - add domain-name to client, set to firewall's hostname when not offered. closes https://github.com/opnsense/core/pull/7234 2024-02-13 20:51:06 +01:00
Ad Schellevis
75bb361e24 mvc: Phalcon framework dependency (https://github.com/opnsense/core/issues/6389)
fix regression in c2ea9aa3039eb4d24ba53a7aa2190642150f20eb and amend unit tests.
2024-02-13 20:20:45 +01:00
Ad Schellevis
098a89b965 Services: Kea DHCP: Kea DHCPv4 - loosen constraints for tftp boot. closes https://github.com/opnsense/core/issues/7235 2024-02-13 19:43:45 +01:00
Ad Schellevis
7d56aafaf2 mvc - cleanup used import 2024-02-13 19:19:14 +01:00
Ad Schellevis
fa6d093b04 mvc: phalcon - drop unused "use Phalcon\Messages\Messages" (https://github.com/opnsense/core/issues/6389) 2024-02-13 18:27:15 +01:00
Ad Schellevis
c2ea9aa303 mvc: Phalcon framework dependency (https://github.com/opnsense/core/issues/6389)
Add simple Message class and remove "Messages" dependancy in Validation.php, which should be backwards compatible with all existing validations.
By moving  \Phalcon\Filter\Validation() into validate() we're making the validation paths more explicit, if an objects implements ValidatorInterface, it uses phalcon, otherwise it's a simple BaseValidator passing messages back to $this->appendMessage().

The original phalcon Message class has additional fields we don't use, we only use fieldname for tracking purposes and the message itself.
2024-02-13 18:21:30 +01:00
Franco Fichtner
203a034e93 wireguard: remove duplicate ID column 2024-02-13 14:21:38 +01:00
Ad Schellevis
c79bf84642 MVC - fix Validation.php:44 - Creation of dynamic property OPNsense\Base\Validation::$data is deprecated 2024-02-13 14:00:20 +01:00
Ad Schellevis
cdba294227 MVC - fix /usr/local/opnsense/mvc/app/models/OPNsense/Base/Validation.php:40 - Creation of dynamic property OPNsense\Base\Validation::$phalcon_validation is deprecated 2024-02-13 13:51:13 +01:00