15976 Commits

Author SHA1 Message Date
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
Ad Schellevis
8439eeb90c Reporting/Health - new rrd fetchData.py can't cope with rrd files containing a single measurement very well. https://forum.opnsense.org/index.php?topic=36634.0 2023-10-26 14:41:41 +02:00
Monviech
837de4771e wg - fix error when empty tunnel address in instance (#3638) 2023-10-26 13:50:27 +02:00
Franco Fichtner
96b47255be firmware: fix slowness in applying firmware settings
We don't even need the full rc.configure_firmware script as that
is for after a core package was updated.  Rather we just want the
actual firmware settings to reload so we add a different path for
it.  Now it is faster than it ever was.
2023-10-26 08:56:56 +02:00
Ad Schellevis
d0a40796a7 Wireguard - startup missing import (bug) 2023-10-25 14:53:28 +02:00
Ad Schellevis
1452683b65 MVC / templates - prevent form submit for MVC pages, closes https://github.com/opnsense/core/issues/6958 2023-10-25 12:12:44 +02:00
Franco Fichtner
56fdab4e0d system: make a note about rcons integration 2023-10-25 08:50:19 +02:00
Ad Schellevis
5715d82a7f MVC / model - loosen constraints a bit when cloning Array field types.
When children are not of ArrayField type we're only cloning an empty structure which should be relativly safe and can be practical to offer grouping inside the model.
Add iterateRecursiveItems() as easy to use "dig" function to crawl through the model from any given point.
2023-10-24 21:01:00 +02:00
Ad Schellevis
d085f4ef36 themes/opnsense - remove default modal padding, add padding inside bootstrap-dialog-message instead (the BootstrapDialog needs padding). closes https://github.com/opnsense/core/issues/6957 2023-10-24 19:42:05 +02:00
Ad Schellevis
2f1996cc05 MVC/ Form dialogs - make dialogs draggable. closes https://github.com/opnsense/core/issues/6947
It's a bit of an experiment, but being able to drag the modal is practical sometimes. This commit attaches mouse events to drag on the header of the model so we can move the modal offset, when reopening the same it resets back to its starting position.
2023-10-24 18:21:46 +02:00
Franco Fichtner
c225e122eb interfaces: more consistent naming in wireguard 2023-10-24 14:34:43 +02:00
Franco Fichtner
676e9581dd interfaces: match validation and mask in LAGG 2023-10-24 14:24:52 +02:00
Franco Fichtner
dccf9143c2 interfaces: improve neighbor form 2023-10-24 14:24:32 +02:00
Franco Fichtner
16d0a071ad interfaces: fix the intricate cleanup of link-local VIPs
The VIPs are bound to the scope so we need to add it to the
address lookup.  From the controller emit the same "@" usage
which is used to indicatge a scope, but not no a network
device.  If encountered translate the scope back to a network
device and use the proper "%" syntax.
2023-10-24 10:37:38 +02:00
Ad Schellevis
ad2e5e7515 Interfaces: Virtual IPs: Settings - fix config locking when deleting a node.
This is a bit of a tricky one, delBase() always locks, which enforces the proper sequence in concurrent operations, but when reading the config first with getModel(), we are locking the wrong state (memory doesn't equal disk anymore).
2023-10-24 10:11:47 +02:00
Ad Schellevis
b0f3e131f5 mvc/OptionField type - fix regression in bc195308be , can't make choices static, unless we would serialize $data's payload first. to avoid further issues, just go back to always setting the values. 2023-10-23 16:59:13 +02:00
Franco Fichtner
8228f5de5f system: need to detect a password shift from off <=> on
This doesn't check a shifting password for other technical
reasons but is more correct and fixes toggling disabled
authentication on my end.

PR: https://forum.opnsense.org/index.php?topic=36528.0
2023-10-23 11:25:45 +02:00
Ad Schellevis
a99f2600a5 backend: template helpers. Add physical_interface and physical_interfaces as helper functions to remove the need for a separate macro to map interface names. Eventually we might consider removing the macro as well, but since the plugins use it heavily, we can't do that right now.
The new physical_interfaces() helper simplifies the constructions where we just need a list of configured device names, skipping the ones that don't exist.
Refactor existing core templates to remove the use of the interface.macro file.
2023-10-22 17:46:34 +02:00
Ad Schellevis
71e8201e5a Firewall/Aliases - fix regression in BaseContentParser, throwing an error due to not being hooked to an alias anymore. Since we don't know its origins, the plain address is likely the best next best thing to log here. 2023-10-21 10:03:54 +02:00
Ad Schellevis
d09fdd53c1 VPN: WireGuard: Settings - fix some small cosmetic issues in the volt template 2023-10-20 18:28:52 +02:00
Ad Schellevis
4bef809bd0 VPN: WireGuard - fix wireguard group registration, as our reconfigureAction() is custom, we can not use invokeInterfaceRegistration() here. 2023-10-20 17:54:58 +02:00
Stephan de Wit
c2d07aeef6 wireguard: move route reconfigure to wg_start
we shouldn't attempt to reconfigure the system routes if wireguard
isn't enabled.
2023-10-20 16:23:27 +02:00
Franco Fichtner
845ba727c8 firmware: fix forward compat with pkg 1.20 being backwards incompatible
Ok, so now we work with 1.20 but cannot use it because we can't render
the repo file before pkg updates itself and causes it to malfunction.
That means we cannot add 1.20 before 24.1.1.

Even if we fixed our mirror to be SRV compatible two facts remain:

1. We cannot control third party mirrors which will likely all be
   plain HTTP(S).

2. pkg 1.20.x from FreeBSD will still break firewall operation and
   upgrades if left on the system so we make the situation better now
   to bite the user later on.
2023-10-20 11:59:06 +02:00
Ad Schellevis
41b8feec94 Interfaces/neighbor - although camel case works in endpoints, better to underscore the actions as phalcon's routing expects camelcase to underscore (https://docs.phalcon.io/3.4/en/routing#defining-routes) 2023-10-19 21:35:03 +02:00
Franco Fichtner
edeff46f3f system: ok it's an Error then 2023-10-19 13:14:20 +02:00
Franco Fichtner
9e9be4351f system: add trad. Chinese
It's already over 30% but needs to be vetted first.  Language
pack that includes this is 23.7.7.
2023-10-19 11:49:10 +02:00
Stephan de Wit
24b5fdc42e interfaces: do not flush states on clear
flushed states are propagated to pfsync, which means a machine
in backup state is still vulnerable to any event that hooks
into the interface_bring_down logic on the primary machine.
2023-10-19 11:34:23 +02:00