16002 Commits

Author SHA1 Message Date
Ad Schellevis
4333c81e65 Gateways: Single: Migrate to MVC - rework datastorage layer. regression in ebc8e34b15 2023-11-06 10:37:26 +01:00
Franco Fichtner
b739cd605e mvc: style sweep 2023-11-06 10:02:21 +01:00
Franco Fichtner
cb05c53e0b system: make trust store reload conditional
PR: https://forum.opnsense.org/index.php?topic=36824.0
2023-11-06 10:01:42 +01:00
Ad Schellevis
8e63fbb302 Kea / Dhcp - DHCPv4 replacement [https://github.com/opnsense/core/issues/6971], add "Auto collect option data" checkbox on the subnet.
Our current default (legacy) scenario is to use the configured interface addresss as gateway and primary dns, but since we don't want to complicate the templates and make the choice explicit, we're adding an option to auto-collect and persist on configuration save/apply.

This commit auto updates selected option data fields on request with the first matching address for the requested subnet found in ifconfig.
2023-11-05 19:26:48 +01:00
doktornotor
62bf0f5779
Remove localhost from automatically created Unbound ACL (#6986) (#6987)
Fixes https://github.com/opnsense/core/issues/6986
2023-11-05 14:58:44 +01:00
Ad Schellevis
ebc8e34b15 Gateways: Single: Migrate to MVC - rework datastorage layer.
This commit moves the default logic into the model so we can reflect current values into virtual fields.
For all relevant "dpinger" fields, we reflect the current value in a field named current_$field, which means we can always query the active value without touching the stored one. Determination of current is as easy as `!empty(model_value) ? model_value : default`.

Refactor the dpinger process to use the current_ fields, since "dpinger_status()" retrieves all instances including the ones not stored, safeguard the config properties to exclude status determination (as loss and latency fields don't exist).

Previously the validation messages seemed to miss some gettext(), re-add these as well and cleanup validation. By calling isFieldChanged() on the array type, we know the gateway object has changed, but not exactly which field, this might lead to some noise, but if we implement a fix for https://github.com/opnsense/core/issues/6978 , we should be able to avoid real issues with the bonus of needing less code.

The calculateCurrent() on the GatewayField ensures we can insert/update the current values after an update as these are nog aware of modifications automatically.

Finally, respect the 120 character screen limit.
2023-11-04 17:47:58 +01:00
Franco Fichtner
5ddb2292f2 firmware: lint 2023-11-03 14:16:11 +01:00
Franco Fichtner
6ef5a48772 firmware: add root file system to health audit
So we can see if UFS or ZFS is installed.

Loosely related to: https://forum.opnsense.org/index.php?topic=36745.0
2023-11-03 14:12:23 +01:00
Franco Fichtner
455e9d6e86 unbound: use tls-system-cert
According to the documentation that should work since 23.7.7.
2023-11-03 13:34:24 +01:00
Franco Fichtner
e547af2410 mvc: style sweep 2023-11-03 08:47:06 +01:00
Ad Schellevis
7be65661f7 System: Gateways: Configuration - Improve migration and fix minor validation issue causing the validation failing. (https://github.com/opnsense/core/pull/6808)
When there are invalid gateway items, it's likely better to skip the ones that we can not migrate in this case. Executing the validation on every record might be expensive, but likely leads to a more consistent end-result. After migration, make sure to remove the old cruft when we end up with at least one gateway.

Without "AllowDynamic" on the intreface selector, we will miss dynamic interfaces like ipsec vti's.
2023-11-02 21:26:12 +01:00
Stephan de Wit
c211858a08 MVC: config should be locked before calling checkAndThrowSafeDelete() 2023-11-02 13:57:31 +01:00
Stephan de Wit
46eb2c0194 Gateways: virtualize dpinger defaults during migration 2023-11-02 12:04:32 +01:00
Stephan de Wit
2fb2ae85fd Gateways: Single: Migrate to MVC - part 2: Do not persist dpinger defaults 2023-11-02 11:29:25 +01:00
Franco Fichtner
a55b4c8b22 firmware: invalidate caches earlier since certctl blocks this longer now 2023-11-02 09:39:20 +01:00
Franco Fichtner
4154cfcead src: style sweep 2023-11-02 09:37:03 +01:00
Stephan de Wit
f213bf2833
Gateways: Single: Migrate to MVC - part 2 (#6808)
Where the first stage primarily aims to keep the legacy handling of gateways intact, this stage does the conversion to MVC.

As part of the migration strategy, configured gateways will not be touched if the migration fails. This allows users to repair the gateways in the new situation.
2023-11-02 09:32:27 +01:00
Franco Fichtner
0a6dcfce03 service: style sweep 2023-11-02 07:30:10 +01:00
Franco Fichtner
a93d72629a firmware: c0urier.net mirror moved a while ago 2023-11-02 07:26:05 +01:00
Ad Schellevis
f90f16fc09 Kea / Dhcp - DHCPv4 replacement, initial minimal for https://github.com/opnsense/core/issues/6971
This commit contains the basic features of our new DHCPv4 server, it certainly needs additional testing as currently we only validated the configuration format is valid. The aim is to keep the json templates as simple as possible.

For now we keep the kea-control-agent disabled, we probably need it later, but we don't want to expose a listener without using it.
2023-11-01 21:24:34 +01:00
Franco Fichtner
fc5536732b firmware: record packages state for update reboot check for #6940
This way we can see if something changed and reboot if "always
reboot" is required.  We do the first hash unconditionally because
it's fast and maybe we can use this for other purposes as well.
2023-11-01 15:00:58 +01:00
Franco Fichtner
5c7a8fc4fd firmware: implement "always reboot" for #6940
The way this works is a little funky...

1. For console calling update script it will ALWAYS reboot,
   but at least it says so.  We simply do not know how much
   will be updated / is available but that is by design
   leaving this as a capable fallback option that will work
   even if the GUI has issues.  That's also true for no
   updates being installed... it reboots by virtue of
   calling the update script into active duty.

2. The GUI and API will have the reboot flag set and know
   this beforehand, but will prevent calling the script
   when it isn't going to do anything.  This makes the reboot
   behaviour better, but ideally we also need to know if we
   need to abort the reboot based on package install progress
   which we currently do not check.

That being said the feature is fine to use when updating the
box via GUI/API/OPNcentral on a regular basis without messing
with the box too much in between.  It's not tailored for micro-
mangement so it should only be used where the behavior fits
the requirement of a consistent system state after firmware
updates (and not hammering the update server every hour for
hotfixes which will make it reboot also).

I guess we need to make further changes, but this is a good
step nonetheless.
2023-11-01 13:11:46 +01:00
Franco Fichtner
c1a4584638 firmware: config glue related to "always reboot" flag for #6940 2023-11-01 12:26:37 +01:00
Alexander Münch
cfeed08432
IDS: Fixed old documentation URL of ruleset "ET open" (#6965) 2023-11-01 11:32:26 +01:00
0nnyx
75bfe5c951
Update et-open.xml (#6974) 2023-11-01 11:00:22 +01:00
Franco Fichtner
6946f27708 interfaces: use ifconfig -v xxx0_wlanX list chan for #6967
No change in behaviour yet, but funnily enough the channel list
build got easier and the previous code makes sense now...

Since we are dealing with a lot of duplicated channels now it
further points to restructuring this into a merged select for
mode, channel and width as this is how the driver operates.
2023-11-01 10:17:09 +01:00
Ad Schellevis
c0cbbcc8e5 Gateways: Single: Migrate to MVC - Minor regression in first part of https://github.com/opnsense/core/pull/6808
if the gateway structure contains a <gateway_item/> as first element, technically speaking $config->gateways->gateway_item is empty. Better to check for children when gateway isn't empty to prevent none of the gateways being rendered in these cases.
2023-11-01 09:58:19 +01:00
Franco Fichtner
f02a17a4e6 interfaces: adding wireguard instance to peer fix
The previous could would handle '' like a distinct entry leading
to the following:

-            <peers/>
+            <peers>,189f14be-ae63-4c3a-ac91-edb114115d43</peers>
2023-11-01 07:59:18 +01:00
Franco Fichtner
4ec04b146b mvc: style update 2023-10-31 22:43:29 +01:00
Ad Schellevis
0b339ba8ee VPN: WireGuard: Settings - cross reference Instances in Peers so you don't have to go back when adding new peers. The usual workflow is to add an instance, then add peers and attach them to the instance it belongs to. With this commit you can update the instance from the peer to include or exclude the peer from the instance. Ideally the relation should have been the other way around, but be referencing from both ends we can overcome that discrepancy. 2023-10-31 18:31:42 +01:00
Ad Schellevis
8c2aa5d6bd util.inc - get_single_sysctl : only return '' when value not found. for https://github.com/opnsense/core/issues/6969 2023-10-31 14:28:38 +01:00
Franco Fichtner
11e76b6373 wireguard: closelog() for good measure 2023-10-31 11:31:38 +01:00
Franco Fichtner
07545a94d5 wireguard: use syncconf in newwanip event
setconf can fail for DNS resolution reasons.  It is being considered
a configuration parsing error so nothing gets set on the instance.
However, our code remembers that the instance was fully set up although
that is not the case.  The newwanip event was handling DNS renew but
does not understand that the configuration is not complete.

Replacing reresolve-dns.py by doing syncconf works, but this is used
as a cron-based script and likely does the job it is intended for.

Instead rehook the newwanip event into a simple syncconf invoke which
takes "more" time (according to the man page) but won't touch existing
peers being connected while still fixing any configuration mismatch
in the (possibly stale) instance.
2023-10-31 11:27:45 +01:00
Franco Fichtner
6f6284f32e interfaces: improve wireless channel parsing; closes #5765
Channels for "list chan" and "list txpower" may be in a side by side
2 column layout which makes the current parsing fail and miss half
the channels.  Replace the parsing with "sturdy" regex to collect all
the results and also make sure that all modes and fallback modes have
the actual channel information.  Also clean the templating in the
static PHP file a little in related areas.
2023-10-31 08:59:36 +01:00
Franco Fichtner
92648fe995 web proxy: roll back some of these changes 2023-10-30 20:50:51 +01:00
Ad Schellevis
b966ab652f VPN: WireGuard - Some improvements in carp event handing for https://github.com/opnsense/plugins/issues/3579
This commit addresses a couple of possible issues.

1. When a sequence of carp events is being processed and these processes lock eachother, its possible that collected interface state via legacy_interfaces_details() doesn't match the active one anymore. To prevent this from happening, only fetch the wireguard interface we're interested in inside the lock.

2. To limit the number of events being handled in wg-service-control.php it's likely cleaner to push the vhid as well when we're handling carp events. This means that we should switch between server id (current parameter) and vhid by looking at its format.

3. In case the target (wg) interface doesn't exist, make sure to create it. Although in practice this shouldn't happen (as the stat file is being removed on boot), dropping an interface manually should preferably lead to a funcitonal setup anyway (otherwise it will crash trying to pull it up)

4. When a vhid is passed and affects the interface in question, log relevant information to syslog.
2023-10-30 18:48:01 +01:00
Franco Fichtner
a108d600bc web proxy: sync the templates with squid 6.4
For next time it would be better to write an import script
as all the files exist without .html in squid and and
errorpage.css is somewhere else.
2023-10-30 16:01:18 +01:00
Franco Fichtner
2495fb0dc4 web proxy: move squid native language directory to new language pack
There is a problem with mapping, but same as before.
2023-10-30 15:46:48 +01:00
Ad Schellevis
84a099c72b MVC/ Form dialogs - minor addition to draggable dialogs introduced in https://github.com/opnsense/core/issues/6947 , calculate an upper boundary so we can't hide our dialog under the header. 2023-10-30 15:04:51 +01:00
Stephan de Wit
f2ce004a92 OpenVPN: Instances: IPv6 isn't as picky as IPv4 2023-10-30 14:45:12 +01:00
Stephan de Wit
2304bdbd3e OpenVPN: Instances: host bits must not be set for --server directive
The instance will not start if host bits are set
2023-10-30 12:05:32 +01:00
Franco Fichtner
b2b2c4133b firmware: clear more pkg garbage
While here serialize the background script into one as that
may be less straining on the system since we need to clean up
more now.
2023-10-30 11:37:38 +01:00
Franco Fichtner
1785cd3935 pkg: also add squid language pack, no longer in main package 2023-10-30 09:53:28 +01:00
Ad Schellevis
5c69267d46 model dialog padding (2), it seems the left spacing (advanced mode) doesn't match the right one (full help), lets change both to 10px to fix symmetry and make the buttons icons less sticky on the left. (https://github.com/opnsense/core/issues/6957) 2023-10-30 08:59:35 +01:00
Franco Fichtner
63354e8726 firewall: actually fix placement by moving into alias migration
When migrating Category this fails with an error:

 Fatal error: Uncaught Error: Call to undefined method OPNsense\Firewall\Category::flushCache() in /usr/local/opnsense/mvc/app/library/OPNsense/Firewall/Util.php:176
 Stack trace:
 #0 /usr/local/opnsense/mvc/app/models/OPNsense/Firewall/Migrations/M1_0_0.php(103): OPNsense\Firewall\Util::attachAliasObject(Object(OPNsense\Firewall\Category))
 #1 /usr/local/opnsense/mvc/app/models/OPNsense/Base/BaseModel.php(711): OPNsense\Firewall\Migrations\M1_0_0->run(Object(OPNsense\Firewall\Category))
 #2 /usr/core/src/opnsense/mvc/script/run_migrations.php(54): OPNsense\Base\BaseModel->runMigrations()
 #3 {main}
   thrown in /usr/local/opnsense/mvc/app/library/OPNsense/Firewall/Util.php on line 176
2023-10-29 16:37:42 +01:00
Franco Fichtner
28df2b8fb6 firewall: when migrating aliases make sure that nesting does not fail 2023-10-29 11:56:57 +01:00
Franco Fichtner
e74cce9305 system: update gateways model 2023-10-29 07:44:06 +01:00
Stephan de Wit
d560e84934 dpinger: bring in remainder from gateways model conversion 2023-10-27 10:09:44 +02:00
Franco Fichtner
ea6272e3a8 ui: style sweep 2023-10-26 16:03:11 +02:00
Ad Schellevis
cde83b0a0c VPN: IPsec: Connections - re-add hashing options to GCM ciphers, but at the bottom of the list. In theory these are only valid for IKE (https://users.strongswan.narkive.com/0YfEZ2CS/question-about-ike-aes256gcm16-aesxcbc-modp2048-in-ipsec-conf), but as there seems to be some confusion and having them doesn't really hurt, we are going to re-add them anyway for ESP and IKE.
We might want to reassess this at some point, but there's not rush.

ref: https://forum.opnsense.org/index.php?topic=36638.0
2023-10-26 15:09:32 +02:00