5718 Commits

Author SHA1 Message Date
Ad Schellevis
002b450c40 cleanup - fix some php notices, closes https://github.com/opnsense/core/issues/8125 2024-12-11 16:15:31 +01:00
Ad Schellevis
be8841d9af util:legacy - ignore plugins_interfaces() errors in write_config() when called without sufficient imports (missing libraries in registered plugins).
Scripts like https://github.com/opnsense/core/blob/master/src/etc/rc.expireaccounts will die horribly at the moment when there's actual work to be done (although this example should likely be rmeoved for 25.1 anyway)
2024-12-11 15:54:02 +01:00
Franco Fichtner
f4b9017cd9 unbound: make this workaround permanent
This bundle file is here for general consumption and the time it
has already taken to debug this issue is not justifiable for
pursuing the matter any further.  Other approaches regarding
chroot and directory sharing are likely going to be much more
code which would make another solution more fragile as well.

While here remove a strange directory in the chroot that is not
even used.
2024-12-04 14:44:58 +01:00
Franco Fichtner
9c0b50aa63 system: kill this comment annotating code that does not reall exist anymore 2024-11-25 13:38:52 +01:00
Franco Fichtner
0f5c35940d firewall: remove faulty exclusion
'if' is a device name and can never match.  Possibly defunct since
2008 when 'ip' was used but 'ipaddr' would have been the right key.

The code is long gone on the other end too.

See: https://github.com/pfsense/pfsense/commit/ce24005a17
Also see: https://github.com/pfsense/pfsense/commit/40aa6f207
2024-11-25 13:33:51 +01:00
Franco Fichtner
a0b86b43e2 interfaces: remove PPP edit in interfaces settings #7446
Time to ditch this.  Leave a thin dialog for the ports display
and where to access the actual PPP settings.

page-getserviceproviders now folds into page-interfaces-ppps-edit
and remove only once use functions to edit page as well.
2024-11-25 11:11:11 +01:00
Ad Schellevis
cb6ec88a16 Interfaces: Wireless: Devices - try to remove mac trickery for hostapd for https://github.com/opnsense/core/issues/8079
All of this stuff looks really old, it seems to originate from 864bf77420, which might be an issue that doesn't actually exist anymore..
2024-11-22 08:50:09 +01:00
Ad Schellevis
78cf96c579
System: Access: migrate Users and Groups to MVC/API (#8046)
* System: Access: Groups - in preperation for https://github.com/opnsense/core/issues/7904, add support for comma separated member lists.

If we convert groups to a model, we will switch the nested <member> tags into comma separated fields, e.g.

	<member>1</member>
	<member>12</member>

will convert to:

	<member>1,12</member>

using this commit we support both for areas where these are being read.

* System: Access: Users - refactor to MVC (https://github.com/opnsense/core/issues/7904)

* add initial boilerplate
* unpack `<priv/>` field on first access
* unpack '<apikeys/>' field on first access and implement key actions into ApiKeyField
* add apikey grid in user management view
* change isset() to !empty() for users disabled flag in backend code
* move user atributes into dialog
* hook PrivField type to \OPNsense\Core\ACL()
* refactor Auth/API to use new User class
* otp seed logic  with simple api call to generate new seeds and some JS glue for the frontend
* uid autonumber field
* language selector using get_locale_list() via configd (cached)
* add StoreB64Field field for authorizedkeys so we can keep the field contents backwards compatible.
* ExpiresField for custom date parsing, supporting previous input formats as well.
* group membership using a volatile custom field type, controller is responisble for persisting the configuration data to avoid entanglement between models
* add button which links to most likely user certs (based on commonname), to avoid all sorts of magic to reflect certs back into the usermanager.
* add getUserPrivs() to model so we can fetch a full list of privs for a user
* show user icons, long this might be less relevant
* add addApiKeyAction() to create a new api key for a user (by name)
* download new api key from user view
* implement hashing when setting a new (or scrabled) password
* use new "auth sync user" event to trigger local user db changes
* in API authenticator keep createKey and dropKey as stubs to the new model implementation
* prevent removal of "system" users (root)
* hook ACL and Menu
* add Group administration using the same logic as users
* cleanup unused
* add System: Access: Privileges to manage and change user and group privileges

* System: Access: Users - refactor to MVC (https://github.com/opnsense/core/issues/7904)

review comments from @Monviech

* "Create and Download API Key for this user" refresh apikeys bootgrid
* "Users" bootgrid, add some columns
* rename "Username" to "Group Name" in group edit
* Disable sorting the bootgrid by "Users" and "Groups" as these are aggregated/formatted columns

* System: Access: Privileges - fix updating groups dropping privileges for https://github.com/opnsense/core/pull/8046

* System: Access: Users - hook group model for https://github.com/opnsense/core/issues/7904

* System: Access: Users - add some safety fences to prevent accidental removal of rights https://github.com/opnsense/core/issues/7904

* Update src/opnsense/service/conf/actions.d/actions_auth.conf

* Update src/opnsense/service/conf/actions.d/actions_auth.conf

* System: Access: Users - remove userDNmap support as it belonged to the import https://github.com/opnsense/core/issues/7904

* System: Access: migrate Users and Groups to MVC/API (https://github.com/opnsense/core/pull/8046), review comments

* System: Access: migrate Users and Groups to MVC/API (https://github.com/opnsense/core/pull/8046)

o align "policy change for %s unlink group" with master (unlink when duplicates exists)

* System: Access: migrate Users and Groups to MVC/API (https://github.com/opnsense/core/pull/8046)

refactor add user event so it utilizes our new model instead of direct config access, while performing the operation, also make sure we lock/unlock the config.xml

* System: Access: migrate Users and Groups to MVC/API (https://github.com/opnsense/core/pull/8046)

replace page-system-groupmanager-addprivs with page-system-usermanager-addprivs

* plist

---------

Co-authored-by: Franco Fichtner <franco@opnsense.org>
2024-11-21 08:50:01 +01:00
Franco Fichtner
db8005b186 system: ignore monitor status on boot 2024-11-18 16:42:52 +01:00
Franco Fichtner
41d8cf30c9 src: small audit regarding "pkg" use
Running the grep below lights up a few spots still:

    # git grep 'pkg[^/\[\.a-z'"'"',()_+"]'

Make a few decisions for the future:

* Use "pkg-static" outside the firmware code consistently
  with a full path
* Modify ambiguous code or comments to not be found by the
  grep above
* Firmware uses PKG now if we ever have to pivot to pkg-static
  or when we need to overwise modify the call.

The goal of this excerise was to find all stray package manager
spots that may run their own embedded pkg-update without the
proper environment which should be gone for now.
2024-11-13 11:59:47 +01:00
Franco Fichtner
c30b46bd27 wireguard: captain obvious left the building 2024-11-11 12:24:31 +01:00
Franco Fichtner
f405b6211a interfaces: refactor a bit more, add a separate log message #7027 2024-11-09 09:56:14 +01:00
Franco Fichtner
b9b98f12ae interfaces: use Autoconf class to avoid raw ifctl file access 2024-11-08 09:47:47 +01:00
Franco Fichtner
270aac573d interfaces: need the gateway for proper route-to flush #7027 2024-11-07 21:13:37 +01:00
Franco Fichtner
913a5caae3 system: kill the SSL bundles in default locations
Neither OpenSSL base (/etc/ssl) nor ports (/usr/local/openssl) need
the bundle file now that we use the directory trust store.  The downside
is that as soon as the bundle exists OpenSSL library will read both the
directory and the bundle by default defeating the purpose of a single
location and the directory being faster.

Keep the fringe ca_root_nss location /usr/local/etc/ssl since that is
still seeded by the package but controlled and topped up by the user
configured authorities.
2024-11-07 19:38:49 +01:00
Franco Fichtner
a08931c718 system: revert CRLs in bundles, bundles need to die 2024-11-07 19:31:41 +01:00
Franco Fichtner
73e837d7d3 interfaces: state experiment for #7027
PR: https://github.com/opnsense/core/issues/7635#issuecomment-2462066123
2024-11-07 13:20:21 +01:00
Ad Schellevis
0788dde6d2 System: Access: Groups - in preperation for https://github.com/opnsense/core/issues/7904, add support for comma separated member lists.
If we convert groups to a model, we will switch the nested <member> tags into comma separated fields, e.g.

	<member>1</member>
	<member>12</member>

will convert to:

	<member>1,12</member>

using this commit we support both for areas where these are being read.
2024-11-06 21:47:17 +01:00
Ad Schellevis
b817853383 Authentication: kill some "isset()" conditions in preperation for https://github.com/opnsense/core/issues/7904 2024-11-04 13:27:31 +01:00
Franco Fichtner
160d7c2f50 system: touchup on SSL directories, /usr/local/etc/ssl should be deprecated 2024-11-04 12:23:30 +01:00
Franco Fichtner
f5d6a3a329 system: small issue with previous
It's rebatable how careful we should be reading files from /etc/ssl/certs
but in practice garbage-in-garbage-out is the best approach and just match
a wider variety of files included in the directory.
2024-11-04 12:09:48 +01:00
Franco Fichtner
799909a23a system: bring CRLs into bundles as well 2024-11-04 12:00:11 +01:00
Franco Fichtner
5b6d347c57 system: improve a comment 2024-11-04 11:59:10 +01:00
Franco Fichtner
d67f9b4ab8 system: better sort for previous 2024-10-31 11:49:43 +01:00
Patrick M. Hausen
e02e5410e0
Default checksum offloading for the vtnet(4) driver to disabled (#8007) 2024-10-31 11:51:14 +01:00
Franco Fichtner
33fcdabdbb src: style sweep 2024-10-29 20:34:37 +01:00
Ad Schellevis
fed2a35269
Firewall - adhere to best practices (#8010)
* Firewall - adhere to best practices (https://www.openbsd.org/faq/pf/filter.html) and skip lo0 from processing. closes https://github.com/opnsense/core/issues/8009
2024-10-29 20:13:46 +01:00
Ad Schellevis
57a7b5d89f Firewall: cleanup automatic rules. (merge part of https://github.com/opnsense/core/pull/8010)
* When ipv6 is disabled, disable all IPv6 rules as well for clarity
* Only add carp rule when at least one carp virtual ip exists.
2024-10-29 20:09:39 +01:00
Franco Fichtner
528a634930 reporting: isset vs empty on RRD enable
The config.xml.sample also has a <enable/> node and saving RRD by
disabling it produces an empty <rrd/> node in the code so isset()
is still the right thing to do.

PR: https://forum.opnsense.org/index.php?topic=43641.0
2024-10-27 21:06:40 +01:00
Ad Schellevis
85bde6565c System: Access: Users - change isset() to !empty() for disabled status in preperation for https://github.com/opnsense/core/issues/7904 2024-10-24 19:41:01 +02:00
Ad Schellevis
9e01cc3191 Firewall: Settings: Advanced / syncookies - make lo0 state uncondition again as discussed with @fichtner (https://github.com/opnsense/core/issues/8008) 2024-10-24 11:32:43 +02:00
Ad Schellevis
e7e7e57dc1 Firewall: Settings: Advanced / syncookies - make stateless loopback rule conditional as a temporary solution and add a clear note about the state requirement. closes https://github.com/opnsense/core/issues/8008 2024-10-23 20:19:25 +02:00
Franco Fichtner
3d34e7e54e firmware: restart cron on updates
Specifically to deal with new RRD situation but it looks like an
old oversight not to reload here anyway.
2024-10-21 09:50:52 +02:00
Ad Schellevis
ab0fc39a40 interfaces - parse part of sfp module information in legacy_interfaces_details(), adds 'module temperature' and 'lane X' information as well.
`ifconfig` passes the information from `sfp.c` [1], which is has a fixed structure we can parse on our end.

[1] 6fbe7e4dd1/sbin/ifconfig/sfp.c (L75-L76)
2024-10-20 17:29:32 +02:00
Ad Schellevis
cca972c05b interfaces - parse part of sfp module information in legacy_interfaces_details(), closes https://github.com/opnsense/core/pull/7986
`ifconfig` passes the information from `sfp.c` [1], which is has a fixed structure we can parse on our end.

[1] 6fbe7e4dd1/sbin/ifconfig/sfp.c (L75-L76)
2024-10-19 10:02:01 +02:00
Ad Schellevis
2fb7965934
System: Settings: Administration - add RekeyLimit with a limited set of choices. In some regulated environments the openssh defaults are not acceptable, in which case we might need to offer some choices. (#7970)
Since RekeyLimit specifies both data and time and we don't want to overcomplicate things, it might be best to just offer some (pre validated) options.
2024-10-14 14:22:29 +02:00
Ad Schellevis
7e60e9f014 System: Access - Restructure ACL privilege handling so we can simplify storage for https://github.com/opnsense/core/issues/7904
Currently both users and groups store multiple <priv/> tags within the same container, but if we want to use MVC structures, we need to move to a single container to hold the access roles for them.
Our common seperator is a comma (,) which is not used in acl tags as these are not valid within xml tags anyway, by supporting both the future storage privA,privB and the current one we can feed this change easily in a future minor release without having to move all new mvc code already.

After this change, a config.xml may contain (combinations of):

   <priv>page-X</priv>
   <priv>page-Y</priv>

   <priv>page-X,page-Y</priv>
2024-10-13 16:19:27 +02:00
Stephan de Wit
b9b2a10ba2 plugins: invert volatile check 2024-10-02 15:26:15 +02:00
Franco Fichtner
ce1fae3913 interfaces: go full circle on newwanip even handler
The use of plugins_argument_map() makes it fully backwards
compatible now although external callers need to cope with
the new reality of handling arrays (maps) going forward with
25.1 to avoid having two events one of which slows down the
processing.
2024-10-01 08:15:27 +02:00
Franco Fichtner
f4e13c2a6a interfaces: refactor previous slightly 2024-10-01 07:41:15 +02:00
Monviech
f8d0ca5e1c
vxlan: fix interface being busy when vxlanlocal or vxlanremote is changed (#7872)
* vxlan: fix interface being busy when vxlanlocal or vxlanremote is changed.
2024-09-30 17:19:52 +02:00
Franco Fichtner
b563c223bf system: closelog() has timing issues
Not sure where this comes from but the concensus is that
closelog() is relatively useless and testing verifies that
it works as expected without it.

Now we just have to make sure that each component using
openlog() will reopen the actual GUI log so that it can
keep logging correctly.
2024-09-30 13:19:26 +02:00
Franco Fichtner
1d8e5fec36 plugins: improve the pattern handling in devices
Always bootstrap (an impossible) pattern to match devices.  On the
console end try the implied method now.
2024-09-30 07:46:21 +02:00
Ad Schellevis
b709232e44 System: Trust: Authorities - finish crl fetch script for installed certificates and hook into form and cron updates.
According to rfc5280 an CRL update should be issued before "next update", but does not seem to define a validity. Various sources seem to indicate updates should be fetched at least every couple of hours, in which case an hourly update sounds reasonable.

To avoid excessive writes, we compare each CRL offered with the last one received before flushing it to disk and keep track of actual changes. When nothing changes, no rehash is neede, which the configd action takes care of.

Distribution points could either be HTTP or LDAP, LDAPS and HTTPS may not be used according to the RFC (CAs SHOULD NOT include URIs that specify https, ldaps, or similar schemes in extensions.)
2024-09-24 20:58:04 +02:00
Franco Fichtner
8684443b65 plugins: enforce defaults on devices 2024-09-24 12:40:11 +02:00
Franco Fichtner
123eed8963 openvpn: squelch a PHP warning 2024-09-24 08:38:34 +02:00
Franco Fichtner
23bf1ee05d interfaces: update the style of the newwanip calls 2024-09-24 07:43:00 +02:00
Ad Schellevis
bd037cc655 logging: remove closelog() from auth_log(), in some cases this seems to silence successive lines from the feed for some reason and closelog() doesn't seem needed anyway 2024-09-23 10:57:41 +02:00
Franco Fichtner
89f84780ff interfaces: full-cirle on vpn_map vs. vpn event
We actually only want the vpn_map event in the stable branch
and move to a backwards compatible format for 25.1 but as a
new coalesced (mapped) caller.
2024-09-18 12:10:46 +02:00
Franco Fichtner
5fe06a19ba unbound: port to plugins_interface_map() 2024-09-18 11:57:05 +02:00