12773 Commits

Author SHA1 Message Date
Franco Fichtner
83a2d2feeb interfaces: convert loopback for #5411 2022-05-19 11:06:08 +02:00
Franco Fichtner
4641e84eb2 interfaces: fix two typos here in loopback code 2022-05-19 10:54:36 +02:00
Ad Schellevis
e810712f8b Services: Intrusion Detection: Log File - ACL mismatch, closes https://github.com/opnsense/core/issues/5781 2022-05-19 10:24:29 +02:00
Franco Fichtner
06bb115fce interfaces: add per-device worker to get rid of batch vxlan_prepare #5411 2022-05-18 17:09:00 +02:00
Franco Fichtner
59ae67c55c src: style sweep 2022-05-18 17:08:13 +02:00
Ad Schellevis
cd46d2a0c6 Fireewall : Aliases - bug fix for 49e21188a8 missed an alias name 2022-05-18 16:24:57 +02:00
Stephan
292b701ca8 Unbound: do not compare identity when checking exit code 2022-05-18 13:56:59 +02:00
Franco Fichtner
c5212719c9 system: dpinger support for IPv6 aliases #5777
Since gateways support VIPs we need dpinger to support it too.

The implementation is a little different asking for runtime address
of the interface and trying to match a subnet before falling back
to the standard address.

IPv4 slightly adjusted to follow the same pattern, but without the
pin to an explict VIP address.
2022-05-18 07:53:54 +02:00
Franco Fichtner
7b1f3d7045 system: support 1500000 baudrate selection for ARM
Sticky 115200 when no value was set since it is still the most
common setting.
2022-05-18 07:53:54 +02:00
Ad Schellevis
25f2a8cb73 gateway monitoring - prevent dpinger event from getting into a "reload filter" loop. while here, also make sure we only pass skip_alias as parameter as gateway has no functional meaning. (and reloading aliases shouldn't be neccesary when a gateway drops). 2022-05-17 15:55:04 +02:00
Ad Schellevis
49e21188a8 Firewall: Aliases - performance improvement for large numbers of port type aliases.
o add caching in alias model for aliasIterator() to prevent duplicate parsing.
o since 'content' is exploded multiple times, we do have an opportunity here to move that operation inside the class method for consistency
o pass list of known aliases into filter_core_get_port_alias() to prevent excessive is_alias() calls
2022-05-16 19:03:55 +02:00
Franco Fichtner
d3ea41d1a4 system: adjust gateway validation to "new" reality #5766 2022-05-16 09:50:03 +02:00
Ad Schellevis
dd7d21a3db Interfaces: Assignments - add technical interface ID as these are critical when synchronising content (either hasync or OPNcentral) 2022-05-13 19:14:49 +02:00
Franco Fichtner
4173fbca0e mvc: clean up previous 2022-05-11 12:43:03 +02:00
Stephan de Wit
b25d3e30ad Phalcon compat layer: add Url validator 2022-05-11 12:34:48 +02:00
Franco Fichtner
b7bbc690f7 ipsec: squelch spurious errors on stderr for ipsec status 2022-05-11 10:45:56 +02:00
Stephan de Wit
317e7755ae
Unit tests: remove Monit tests as these cannot be performed in a vacuum (#5762) 2022-05-09 16:47:06 +02:00
Franco Fichtner
c0cd729060 src: style sweep 2022-05-09 16:35:22 +02:00
Stephan de Wit
1f1502acf4
Unbound blocklists / OPNsense UI: strengthen error handling (#5761)
* Unbound blocklists / OPNsense UI: strengthen error handling

Also changes the OPNsense UI error handling routine to display a 'status_msg' if provided. Otherwise just display 'status' to preserve backwards compatibility.
2022-05-09 16:27:20 +02:00
Stephan de Wit
73a062c6cb
unbound: make blocklist additions/removals dynamic to prevent a restart (#5747)
* unbound: make blocklist additions/removals dynamic to prevent a restart

This commit contains an optimization for the way unbound can be updated in its' configuration
without the need for restarting Unbound and by extension a loss of internet connectivity.

Hopefully this will pave the way for optimizations on other aspects of Unbounds' configuration as well.
We could for example look into making the provided wrapper function more generic.

The GUI has also been modified slightly to inform the user of the amount of RRs added/removed.

* Services: Unbound DNS: Blocklist, review comments for https://github.com/opnsense/core/pull/5747

Changed the following minor items:

o gettext() for human readable reponse message
o simplify comparison loop (only new or diff are actually the same operation)
o replace one-liner split into a loop with validation in case an empty record exists (or something that doesn't fit the pattern)
o remove optional (but always) set -f option

* unbound: blocklists: minor style fix and strip more agressively

Co-authored-by: Ad Schellevis <ad@opnsense.org>
2022-05-09 11:23:15 +02:00
Franco Fichtner
8e989d4069 system: whitespace issue 2022-05-09 10:47:23 +02:00
Ad Schellevis
416687de49 VPN / IPsec - mobile property (boolean) duplication in phase 2, closes https://github.com/opnsense/core/issues/5598
do not store "mobile" flag on phase 2 entries, as phase 1 is responsible here.
2022-05-07 20:35:15 +02:00
csbyte
1adae6e9c2
Config::save : call microtime(true) once (#5740)
* Config::save : call microtime(true) once

Co-authored-by: corentin <corentin.smigiel@agoracalyce.com>
2022-05-08 11:02:17 +02:00
Franco Fichtner
f59b133b01 dhcp: fix plist and add .php suffix for clarity
(it's easier to syntax check scripts with a file suffix)
2022-05-06 08:50:19 +02:00
Ad Schellevis
a4c482f66c Config: prevent config crashes when an attribute already exists, while here also make sure we report the error as it will now silently fail. SimpleXMLElement's addAttribute() is only valida when the it doesn't already exist.
Strangly enough, this doesn't seem to happen very often, but during ha sync we are able to crash without notice.
2022-05-02 16:38:30 +02:00
Ad Schellevis
00bd62fbdd Services / Unbound - change grid label when no results are returned (https://github.com/opnsense/core/issues/5752). Should make master/detail more explicit without complicating the world. 2022-05-01 19:16:30 +02:00
Franco Fichtner
ba2da34854 system: only restore missign or zero size ACL files #5746 2022-04-29 10:04:38 +02:00
Ad Schellevis
ba413ce7c5 MVC - API usage : destinct between 401 (Unauthorized) and 403 (Forbidden) when authorisation (or authentication) fails. closes https://github.com/opnsense/core/issues/5749 2022-04-28 20:28:06 +02:00
Ad Schellevis
14e210815b Services: Unbound DNS: Overrides - Restore duplicate domain behaviour to how it was before refactoring to MVC. Sort overrides per domain, suppress "forward-zone:" sections when the previous entry is the same. closes https://github.com/opnsense/core/issues/5748 2022-04-28 18:54:03 +02:00
Ad Schellevis
eb0eb519db Services: DHCPv4 : leases - Move delete action to separate script in configd and offer the ability there to cleanse leases file for duplicate static leases. Since remove a single address or a list of (mac) addresses are two sides of the same coin it seems to make sense to add a script responsible for dhcpdv4 lease cleanup.
Hooking this into dhcpd_dhcp_configure before startup also closes https://github.com/opnsense/core/issues/5724
2022-04-28 14:30:46 +02:00
Franco Fichtner
0cbb2514b6 interfaces: plug vxlan into device population mechanism #5411
Adds pluginctl -d mode to list device types supported, their device
names and finally allows calling a device reconfiguration by name.

This is only the beginning of vlxan refactor.
2022-04-28 10:45:22 +02:00
Franco Fichtner
6e69e7e5db mvc: style sweep 2022-04-28 10:42:15 +02:00
Franco Fichtner
4080345a59 interfaces: include VIPS for primary IPv4 detection #5742
This was surfaced in 22.1.1 when CARP was treated as an alias as well
leaving setups with "none" IPv4 configuration stranded when calling
get_interface_ip() if the service does not support any explicit listening
on a CARP address (which the function actually does support).  Caveats
apply as to which VIP will win as with the code before.  Best used with
just one CARP address.  IP alias doesn't as much sense since that would
be a static IPv4 configuration.

The latter is the reason why we cannot make a similar change to IPv6
where the primary concept is not equal to "first address in ifconfig"
for (sad) reasons.
2022-04-27 14:13:49 +02:00
Franco Fichtner
ab71380a07 interfaces: not sure why interface_ppps_configure()... #5637
... would be called a number of times during bootup.  Since it's
a WAN interface that is attached there seems little risk of it
having to be reconfigured multiple times during boot unless the
link is flapping but rc.linkup doesn't react to boot as well so
again not sure what the problem might have been.

Code was commented out in pfSense in 2014 shortly after forking
and eventually removed in 2019.
2022-04-27 10:14:16 +02:00
Franco Fichtner
656801803a interfaces: remove two /var/run/booting uses #5637
Going back to #2394 flipflop more of the reload stack to get to the
point of understanding the 6rd/6to4/slaac WAN situation and killing
two uses of /var/run/booting in the process.
2022-04-27 10:04:25 +02:00
Franco Fichtner
249afc5877 interfaces: revert futile parts of b34ba9a61f655 #5630 2022-04-27 08:38:06 +02:00
Ad Schellevis
9ff04d14b4 firewall: make rule parsing more consistent as x:any and any:y are valid options, accepting literal "any" seems to make sense. closes https://github.com/opnsense/plugins/issues/2957 2022-04-25 18:08:00 +02:00
Ad Schellevis
43958b00cc Services / Unbound DNS / Blocklist - add custom "Destination Address" as advanced option, closes https://github.com/opnsense/core/pull/5736 2022-04-22 21:25:11 +02:00
Stephan de Wit
fc8890851a MVC: fix two regressions and deprecate __items
Before the phalcon5 compatibility layer, the unit tests were broken due to __isset()
being triggered by an isset call on an __items attribute in getConstraintValidators().
Since __items is only used in BaseField itself, we choose to remove it for further use. Instead,
we rely on __isset() to verify if elements exist in internalChildNodes when a subnode is accessed directly.

The second regression lived in validate() in the custom Validation implementation. Instead
of relying on the incoming data as a key, we iterate through all validators active during the objects' lifetime since
these are set prior to validation. This regression affected all constraints.
2022-04-22 16:44:59 +02:00
Franco Fichtner
2606c471c5 importer: missing loop exit 2022-04-22 08:38:45 +02:00
Franco Fichtner
a507738bbd importer: add verbose mode 2022-04-22 08:30:40 +02:00
Franco Fichtner
206f0d2f12 importer: support cd9660 type for #5733 2022-04-22 08:23:39 +02:00
Ad Schellevis
7740f241a5 VPN: IPsec: Tunnel Settings - mark unsortable columns. 2022-04-21 19:13:12 +02:00
Ad Schellevis
4ec9ea3d1a MVC - ApiControllerBase : safeguard multi_sort in searchRecordsetBase() when non-existing column is passed
ref : https://forum.opnsense.org/index.php?topic=28043.msg136169#msg136169
2022-04-21 19:06:58 +02:00
Ad Schellevis
26f72adaf6 Reporting: NetFlow - fix validation, closes https://github.com/opnsense/core/issues/5729 2022-04-20 18:15:17 +02:00
Franco Fichtner
02781756f0 system: tunables without hierarchy are just "environment" variables; closes #5719
They may do something or they don't, but it's wrong to label them
as "unsupported".
2022-04-20 14:55:56 +02:00
Franco Fichtner
918ef316df firewall: add missing range validation to alias host type #5723 2022-04-20 12:40:11 +02:00
Franco Fichtner
948235bc1d mvc: style sweep et al 2022-04-20 10:13:46 +02:00
Stephan de Wit
cfd4b7635f
Phalcon5 migration: provide compatibility layer between v4 and v5 (#5711)
* phalcon5: update namespaces

* phalcon5 Autoload: rename registerDirs() to setDirectories()

* phalcon5: remove trailing slash

* phalcon5: default to php74-phalcon

* phalcon5: provide 4/5 compatibility layer except for AbstractValidator

* MVC - Phalcon 5 migration and options to lose dependency of phalcon validation classes.

Since Validation() in 5 moves to Filter\Validation (https://docs.phalcon.io/5.0/en/upgrade#general-notes) and the class is used in strict parameter passing,
it will be difficult to import a situation which works both on 4 and 5.

To prevent future issues, but keep the current situation functional with minimal changes, we wrapped Validation() into a class of our own. When validators inherit from BaseValidator, these are assumed to
be less strict and bound to our own handling. Phalcon validations will follow the old path for now.

Migrating existing validations on our end, should be as simple as changing the following lines:

-use Phalcon\Validation\AbstractValidator;
-use Phalcon\Validation\ValidatorInterface;
-use Phalcon\Validation;
+use OPNsense\Base\BaseValidator;

-class CallbackValidator extends AbstractValidator implements ValidatorInterface
+class CallbackValidator extends BaseValidator

-    public function validate(Validation $validator, $attribute): bool
+    public function validate($validator, $attribute): bool

Todo: choose the "correct" Validation() based on phalcon version.

* phalcon5: complete migration to compatibility layer.

uses bc881b9c11 to remove the need
for AbstractValidator and Validator(Interface).

This commit changes the relevant includes and provides some changes to make the unit tests
run correctly.

* MVC - Phalcon 5 migration and options to lose dependency of phalcon validation classes. part duex

Although our previous strategy should work according to how bind() and validation() are being implemented (https://github.com/phalcon/cphalcon/blob/4.2.x/phalcon/Validation.zep),
in reality it seems they aren't the same. Our previous attempt failed some validations (such as booleans) for no valid reasons.

Long term we should remove the phalcon dependency as these effects are highly unpredictable.

phalcon5: update Validation class to now pick the right Phalcon Validation based on version

* MVC - Phalcon 5 migration and options to lose dependency of phalcon validation classes.

Minor regression in previous commit, performValidation()'s return type didn't match. Ideally we would rather switch to plain array's, but since performValidation()
is used in multiple areas (including plugins) we better opt for compatiblity now.

ref  https://github.com/opnsense/core/pull/5711

* phalcon5: switch back to using count() on Messages object, adjust unit tests as needed

See 6814f32755 as to why
this is the case.

* phalcon5: remove PhalconGenerator and references, use checked-in files instead

* Update Makefile

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

Co-authored-by: Ad Schellevis <ad@opnsense.org>
Co-authored-by: Franco Fichtner <franco@opnsense.org>
2022-04-20 10:05:26 +02:00
Franco Fichtner
d236c7a1b9 mvc: style sweep 2022-04-19 08:27:22 +02:00