15875 Commits

Author SHA1 Message Date
Franco Fichtner
fe0bbadbcf openvpn: tweak validation messages 2023-10-10 10:04:59 +02:00
Franco Fichtner
e2524388c4 system: only call dpinger defaults once
Since we iterate over all and store the result as it is found
we can just use an empty array as a starting point.
2023-10-10 09:21:23 +02:00
Franco Fichtner
abb24e1c86 system: rewrite trust integration for certctl use
Since OPNsense 22.1 we are using FreeBSD 13 and it comes with a
base trust store which is also maintained there.  In order to be
user-configurable there is also a tool called certctl which will
manage blocking and filling the OpenSSL trust store location
/etc/ssl/certs.  The idea is to make this implicit and faster.

This, however, pseudo-obsoletes the trust bundle handling which
we mainly operate through /etc/ssl/cert.pem.  By pseudo I mean
that ports will still want the real bundles and/or know/guess
this location at complile time.  curl has such overrides for
example.

ca_root_nss's bundle is also pulled in thorough certctl so we
are going to have to jump through a few hoops now in order to
add our certificates cleanly and "prevent" breakage of the
resulting trust store.

Therefore now we write our CA content into separate files because
certctl only hashes the first certificate found in the file.
This is already a bit problematic for ca_root_nss having a
larage number of files in it...  And against all odds the
first certificate I wrote for our bundle is blacklisted by
FreeBSD which made certctl discard all OPNsense authorities
added from the GUI.

To avoid further issues with certclt as a broker here I have
added it in passthru() mode to see eventual errors clearly.

Now when certcl is done all the files are linked in the
/etc/ssl/certs directory but we actually have to build the
full bundle for compatibility with old ports requiring one
of the locations that ca_root_nss ETCSYMLINK option provides.

A shortcoming of certctl is the lack of a bundle mode for
compatibility's sake which is causing a number of problems in
the ports tree at the moment (which is why we do this work now
and take a closer look before this is rolled out in full in
FreeBSD ports).

The bundle is created by iterating over all files in /etc/ssl/certs
and putting them in the expected locations.  One caveat is that
this bloats the bundles to 1.5MB from previously 750KB.  The whole
process is a lot slower, especially certctl doing the rehash.

Long story short: this is going to cause issues in the long run,
but for now we know how it is supposed to work and are ready
for FreeBSD ports to drop support for bundles in individual ports.
But that being said we will probably drag the bundles on for
a few years anyway.
2023-10-10 08:53:46 +02:00
Franco Fichtner
f4a37d9455 interfaces: prevent sleep on pending development release
This can slow down reconfiguration of a system with many
VLAN children on a single interface down/up.  We likely
have to refactor rc.linkup to coalesce the interface
reload into a safer reload facility.
2023-10-09 19:16:39 +02:00
Ad Schellevis
8d71ea0f64 ervices: Unbound DNS: Overrides - Make selected row "sticky" when there are items available, always make sure one is selected and reload the aliases grid when hosts are loaded. closes https://github.com/opnsense/core/issues/6920 2023-10-09 17:43:46 +02:00
Ad Schellevis
5003ce8f05 System: High Availability: Settings - move services to sync in its own pane and add [de]select all buttons. closes https://github.com/opnsense/core/issues/6890 2023-10-09 17:27:10 +02:00
Franco Fichtner
6657404d93 interfaces: prevent array data from being passed 2023-10-09 12:12:03 +02:00
Franco Fichtner
4fff50b4aa interfaces: fix warning, variable not assigned 2023-10-09 11:55:11 +02:00
Franco Fichtner
fb336e334a interfaces: DAD sleep on $reload; closes #6913
This is called through rc.linkup exhibiting the issue.
Sidestep the complexity of the situation by fixing the
issue first making it testable and easy to ship in a
stable relese.

For anyone not liking this net.inet6.ip6.dad_count can
be set to "0" to disable the sleep behaviour.  This
needs to be extended one way or another.  More soon.
2023-10-09 11:47:53 +02:00
Franco Fichtner
703b071b5d src: style sweep 2023-10-09 10:01:21 +02:00
Ad Schellevis
972a7d60bf Reporting / Health - refactor rrd data retrieval and simplify usage
Most of this code is quite old and originates from the beginning of our project. At the time it seemed to be problematic to render the full rrd stats in a d3 graph, which required the "resolution" option for faster page loading. It looks like we can safely remove this toggle and ditch quite some code in the process. There's still room for improvements in the html/javascript part, but that's probably for another day.

This commit also simplifies the api usage as unused parameters are being removed from the callers (from, to, ..)
2023-10-06 19:09:16 +02:00
Cedrik Pischem
e5e8d003bd
Update ipsec.widget.php - Count user in "Overview" Tab and improve "Mobile Users" Tab (#6912)
* Update ipsec.widget.php

This change solves the problem of users having multiple IP addresses as leases and being counted per leased IP.
- Only "user" are counted now
- Each "user" can have several "lease"
- Each "lease" can have an individual online or offline status
- A user is online when at least one "lease" is "online = true"

* Update ipsec.widget.php

- Replaced multiple "array()" with "[]"
- Access keys "user", "address" and "online" directly from the $lease array without storping them first
- Merged two seperate foreach loops into one
2023-10-05 11:05:45 +02:00
Ad Schellevis
2bac4f10a5 Services: Intrusion Detection: Administration - Improve locking during sqlite db creation a bit.
If we remove the file, others will keep bashing the inode. Truncating should prevent that from happening.
2023-10-05 10:14:01 +02:00
Ad Schellevis
70df688a9b VPN: WireGuard - hook wireguard empty devices during bootup, using wireguard_devices() plugin system. This should make sure services and components, such as the firewall, are able to use the device before being setup. closes https://github.com/opnsense/core/issues/6909
A minor modification was needed in wg-service-control.php to make sure a configure would be executed if wgX exists without configuration
2023-10-04 18:13:15 +02:00
Ad Schellevis
a114d6df96 Gateways: Single: Migrate to MVC - Import first part of https://github.com/opnsense/core/pull/6808
o fix merge issue, as system_gateways_edit.php is not used in the new version, we do need to make sure it's hooked to the new code in master first. At a first glance dpinger_defaults() is the only missing part now.
2023-10-04 11:30:07 +02:00
Stephan de Wit
8a532bebba Gateways: exclusions is a no-op 2023-10-04 09:13:45 +02:00
Franco Fichtner
316f1c16b4 openvpn: deprecate servers/clients for 24.1 2023-10-04 07:36:07 +02:00
Franco Fichtner
78815fc096 openvpn: message style in new validation 2023-10-04 07:35:51 +02:00
Franco Fichtner
0942687097 system: fix monitor services disappearing after 1c890b8cce666 2023-10-04 07:26:02 +02:00
Franco Fichtner
1fe5395d6a system: refactor dpinger_status() 2023-10-03 21:46:51 +02:00
Ad Schellevis
9117277c60 VPN: OpenVPN: Instances - change verify-client-cert to a server only setting and fix validation. When no client certificate is provided and a CA is missing, make sure to raise an issue as well as this will not generate a usable configuration. Move "ca" inclusion as well so we also add it when no cert is provided.
might fix https://github.com/opnsense/core/issues/6886
2023-10-03 18:29:44 +02:00
Franco Fichtner
c7320df459 system: fix former mishap, better to copy required values for later 2023-10-03 16:29:26 +02:00
Franco Fichtner
d1fb944170 system: style sweep 2023-10-03 16:15:39 +02:00
Ad Schellevis
1c890b8cce Gateways: Single: Migrate to MVC - Import first part of https://github.com/opnsense/core/pull/6808
This commit imports part of the changes from @swhite2 which will keep the legacy handling intact for the first stage of the migration. It should be backwards compatible with the previous (23.7.x) code.

Changes new in this commit which where not in the original PR:

1) dpinger_status() missed $gwitem which rendered gateways statusses down
2) Model version number set to 0.0.1 so we can use the migration later to step into 1.0.0
3) Gateways->gatewayIterator() do not yield MVC records ensuring we are still using legacy config data when being called.
2023-10-03 15:06:22 +02:00
Franco Fichtner
9c15cf7157 mvc: style sweep 2023-10-03 09:07:09 +02:00
Ad Schellevis
33e497f808 Firewall: Aliases - fix help button in dialog for categories, closes https://github.com/opnsense/core/issues/6906 2023-10-03 08:50:50 +02:00
Ad Schellevis
997b4d6e00 VPN: OpenVPN: Instances - add role to proto for tcp sessions as required for tap type tunnels. While here, also validate if server[_ipv6] is provided for tun type tunnels. closes https://github.com/opnsense/core/issues/6904 2023-10-02 21:06:31 +02:00
Ad Schellevis
163a0796f7 MVC/Model/ArrayField - propagate isFieldChanged() from connected children, as this would ease validations when multiple fields in the record influence each other and we want to know if any of them changed. 2023-10-02 18:32:29 +02:00
Stephan de Wit
7249d0a57a ui: trigger change message on toggle and delete
also prevent excessive queueing of animations by preventing the slide
from triggering if it's already animated
2023-10-02 15:39:37 +02:00
Stephan de Wit
15757711a6
unbound: add support for wildcard domain lists (#6905)
Closes https://github.com/opnsense/core/issues/6888
2023-10-02 14:52:25 +02:00
Ad Schellevis
be0b18930f Firewall: Rules: Floating - add "Interface / Invert" to the list, which will invert the "on" clause of the rule. To prevent future tickets when selecting multiple interfaces and invert, we'll add a validation to only allow single inverts.
When multiple interfaces are selected, these will render into separate rules in which case it might not be clear what the outcome would be, specifically when choosing something else than "pass" (pass lan,wan would lead to two rules which match either lan or wan, block lan, wan would lead to random behavior for example).

For https://github.com/opnsense/core/issues/6902
2023-10-02 14:36:28 +02:00
Ad Schellevis
a10cf1c402 fix copyright in VxLan.php 2023-10-02 13:35:11 +02:00
Monviech
ef9c2b4df7
Update VxLan.php - Add input validations to model (#6899)
* Update VxLan.php - Add multiple input validations to model

* Update VxLan.php - add isFieldChanged and gettext function
2023-10-02 13:14:20 +02:00
Franco Fichtner
21bd623835 mvc: model <mask/> to <Mask/> for consistency 2023-09-30 19:44:59 +02:00
Franco Fichtner
a67dc2976f make: model style/lint for Mask/MaskPerItem 2023-09-30 19:44:43 +02:00
Franco Fichtner
3eeb1193ab wireguard: copyright header consolidation 2023-09-30 14:04:04 +02:00
Franco Fichtner
947543c7c6 interfaces: why is this called "alias" IP? 2023-09-30 13:40:00 +02:00
Csaba Kos
1f3311f5dd interfaces: allow multiple IP addresses in dhcp reject from; closes #6683 2023-09-30 13:34:28 +02:00
Franco Fichtner
b7c4631179 wireguard: add dependency for now #6827
Not pretty.  Need to hook wireguard-kmod on life support for
the initial 24.1 at least because we don't know at build time
if the kernel to be installed will have its own kernel module
or not.  Having both works, but the kernel one breaks wireguard-go.

Also implementations for kernel and port kmod seem to be "slightly"
different.
2023-09-29 09:46:17 +02:00
Franco Fichtner
af34db7077 wireguard: tweak 3 more labels #6827 2023-09-29 09:39:03 +02:00
Franco Fichtner
11f65055b3 wireguard: adjust the naming as per #6827
Before: server, client, local, endpoint, peer, interface, instance and
tunnel adapter were being used some times meaning the right thing but
often also displaced.

Now we try to stick to instance (a wireguard interface in its config),
device (pertaining to the actual network device in the system), peer
(a wireguard peer in its config) and endpoint (the actual "endpoint"
setting in a wireguard peer config).

But we can only rename the user facing GUI parts.  The API and config
structure will not change.

While here also update the model and tweak a few form labels and help
texts.
2023-09-29 09:26:39 +02:00
Franco Fichtner
871182c4f2 wireguard: merge net/wireguard as of version 2.2 #6827
Omit the dependency on wireguard-kmod as we will be targeting the kernel
module with 24.1.  Some people may run into this but it's safer than
trying to rely on a package that won't be available going from 23.7 to
24.1.
2023-09-29 08:32:12 +02:00
Ad Schellevis
a91bc81aaf DHCPv6 Leases - fix "ends never" parsing for https://github.com/opnsense/core/issues/6891 2023-09-28 22:30:29 +02:00
Franco Fichtner
40955ddaee dhcp: looks like a refactor gone wrong #6853 2023-09-28 17:42:24 +02:00
Franco Fichtner
77caf21778 openvpn: nitpicking on wording 2023-09-28 17:05:49 +02:00
Franco Fichtner
b66e24c755 interfaces: purge unused parts of the dhclient-script #6869
Once upon a time we tried to treat this script as an external one
since it's still maintained somewhat in FreeBSD but the approach
of integration is much different so the script ends up with half
of its code not doing anything and perhaps more than it should.
Upstream fixes are also not full applicable anymore.

* Clear the writing of the host name.  The system does that.  Simply
  keep the logging aspect of it (if given).
* Remove the $ARP flush on TIMEOUT/EXPIRE as it seems misplaced.
* Remove exit_with_hooks() and is_default_interface() as these are
  tools that are not needed in our integration approach.
* While trailing TIMEOUT/EXPIRE failure case make sure to run
  newwanip in optional mode in order to pick up missing configuration.
* Copyright the changes from 2021 onwards that offer substantial
  changes to the way the script integration works or cooperates with
  the rest of the system.
* Inline the one-time use of functions.
* Remove tip-toeing around $resolvconf_enable.
* Ignore dhclient-enter-hooks.
* Remove commented-out code.
2023-09-28 16:49:30 +02:00
Ad Schellevis
2e90f1cb5b VPN: OpenVPN: Instances - missing selectpicker on vhid selector 2023-09-28 15:45:18 +02:00
Franco Fichtner
ca2609efbd mvc: add "make validate" target and script 2023-09-27 16:29:35 +02:00
Franco Fichtner
10e726113b mvc: introduce isVolatile() for BaseModel
Needed for running batch validation as memory models have
do data so their validation fails.
2023-09-27 16:29:35 +02:00
Stephan de Wit
7a2f3f62d9 interfaces: drop PPP default route handling
the relevant route is configured later in the chain using getDefaultGW(),
no need to instruct mpd5 to set it for us.
2023-09-27 15:59:17 +02:00