1226 Commits

Author SHA1 Message Date
Franco Fichtner
eec0fbb96b firmware: improve previous a little more 2022-08-18 08:12:07 +02:00
Franco Fichtner
cf25dd91cb firmware: pkgs was still unknown 2022-08-17 15:37:49 +02:00
Franco Fichtner
76278022f8 interfaces: wait for DAD to complete #5933 2022-08-16 10:40:20 +02:00
Ad Schellevis
fcbdc44f63 Unbound - dhcp watcher : when the same fqdn is being reinjected on a different address, it would be removed previously. This commit aims to keep a consistent state when fqdn's move from one host to the other.
for https://github.com/opnsense/core/issues/5952

Test data:

lease 172.23.128.214 {
  starts 5 2022/08/12 18:17:31;
  ends 5 2022/12/12 18:27:31;
  tstp 5 2022/08/12 18:52:31;
  tsfp 5 2022/08/12 18:52:31;
  atsfp 5 2022/08/12 18:52:31;
  cltt 5 2022/08/12 18:17:31;
  binding state active;
  next binding state expired;
  hardware ethernet xx:xx:xx:xx:xx:xx;
  uid "\001h\327\232\206,\361";
  set vendor-class-identifier = "ubnt";
  client-hostname "MyDHCPClient";
}
lease 172.23.128.215 {
  starts 5 2022/08/12 18:17:31;
  ends 5 2022/08/12 18:47:31;
  tstp 5 2022/08/12 18:52:31;
  tsfp 5 2022/08/12 19:02:31;
  atsfp 5 2022/08/12 19:02:31;
  cltt 5 2022/08/12 18:17:31;
  binding state active;
  next binding state expired;
  hardware ethernet xx:xx:xx:xx:xx:xx;
  uid "\001h\327\232\206,\361";
  set vendor-class-identifier = "ubnt";
  client-hostname "MyDHCPClient";
}

When 172.23.128.215's end date surpasses "now", a removal after "end" will remove both 172.23.128.215 and 172.23.128.214
2022-08-15 14:48:00 +02:00
Franco Fichtner
489ae2f3c6 interfaces: DHCP is our problem child #5933 2022-08-15 13:20:41 +02:00
Franco Fichtner
e6ef454fa8 interfaces: signal address flush through rc.newwanip #5933 2022-08-15 12:14:48 +02:00
Franco Fichtner
72b04f0904 interfaces: fix interface name split for ifctl; closes #5929
Weird stuff such as "wififoo_wlan0" is now properly handled.
2022-08-12 12:07:42 +02:00
Franco Fichtner
85b223d00c interfaces: improve banner address return
primary will move to tracking interfaces or pick up any
SLAAC related address even though that is not being
actively configured.  Similar to the dashboard only print
the scoped address without the need to do the logic in
the caller.

Maybe we could even return the assigned prefix here for
clarity, but then the prefix isn't a reachable address.
2022-08-12 10:07:14 +02:00
Franco Fichtner
6043b5b125 interfaces: make rc.newwanip the same as "dns reload"... #5933
... a.k.a. rc.resolv_conf_generate.  While here protect more
code with the IP change guard and clear the IP address if the
address lookup came up empty.
2022-08-11 13:53:04 +02:00
Stephan de Wit
966e54011e
unbound: do not start DHCP watcher immediately after daemonizing unbound (#5920) 2022-08-02 10:33:59 +02:00
Franco Fichtner
bb4743a732 interfaces: stop DHCP from calling rc.newwanip when no changes are being done
This is a partial revert of 797c1864194 which has good intentions but rc.newwanip(v6)
isn't equipped with being called a lot of times yet.  We want to improve this for 23.1.
2022-08-02 09:04:12 +02:00
Franco Fichtner
f9ea49ae31 interfaces: manual cache invalidate for previous
Purge the file on all known dynamic spots that run a deconfigure
of some sort.  We probably need something for a forced reload as
well but for now let's see if this works in general.
2022-08-01 13:45:18 +02:00
Franco Fichtner
eebc1674a2 firewall: fix permission of script 2022-08-01 09:55:08 +02:00
Ad Schellevis
b6f95cdea4 Firewall: Aliases - add BGP ASN type. https://github.com/opnsense/core/issues/5913 2022-07-30 02:26:38 +02:00
Ad Schellevis
c21cafa924 config events, fix side affect of 3b7453ca2b. 2022-07-29 16:11:04 +02:00
Franco Fichtner
ef0d238ba1 interfaces: typo in script invoke 2022-07-28 21:09:04 +02:00
Stephan de Wit
f8650c76aa
System Status: replace old notices system with a global one (#5875)
* MVC / System status: first draft for backend implementation

* fix copyright

* fix permissions

* MVC / System Status: modify backend implementation and setup front-end

* MVC / System Status: minor cleanup, ACL check and fix reporting in production mode

* MVC / System Status: copy status sytem to legacy as well, remove the notices system, finish up front-end work

* MVC / System Status: remove useless constructor

* fix plist

* System Status: shorten previous

* System Status: add ACL check

* System Status: also remove legacy part

* System Status: also clean up on legacy page

* System Status: ACL check on dismiss action as well

* System Status: add readonly privilege check to dismiss action

* System Status: do not trust input

* System Status: address security concerns

* add default return

* System Status: move js code to separate script and make sure a logLocation is always provided

* System Status: clean up callout in both legacy page and volt template

After dismissing a message and closing the dialog, the old message was still bound to the dialog instance. re-registering the onclick callback solves this.

* System Status: adjust log location and kick off status system on alias errors

* System Status: let's hold off on throwing notifications for aliases for now

* System Status: add ACL entry for the dismiss API call, adjust to new deployment situation

Without the ACL entry, /api/core/system/dismissStatus calls are rejected for non-root users even when they should have rights to dismiss.

Also do a minor consistency improvement and also adjust to the new situation of production & development deployment types. We need to account for the possibility of 'deployment' being empty in the configuration, therefore a direct check of the 'development' type seems most fitting as this is unlikely to change or be subjected to any additions.

* System Status: also error out when unable to write new rules

* System Status: account for users without permissions

* System Status: name collision in FirmwareController

* System Status: replace old notices system with a global one (https://github.com/opnsense/core/pull/5875)

Review feedback / modifications in this commit:

o filter.inc

-- remove wedged message, when locked during parallel reloads it likely doesn't help to disable/enable
-- flush message to error trigger file

o SystemStatus.php
-- str_contains --> strpos; eases testing on OPNsense 22.1.x as str_contains is php 8 only

o Status collectors
-- simplify logic and propagate messages received from status file

o CrashReporterStatus
- the existence of a /tmp/PHP_errors.log  file should be enough to know some process signaled the crash reporter
- remove shell exec

o FirewallStatus
-- as only /tmp/rules.error remains, remove loop to read for non existing files

o opnsense_status.js
-- add opn-status-group class to container and point css modifications in that single direction to prevent other objects from being affected by our status popup modifications
-- windows file endings replaced (^M)

o css:
keep menu_messages container to ease migration for theme developers

NOTE : ** get_crash_report() could likely be simplified as well

* filter: change to mwexec, redirection is implied

* System Status: handle potential undefined array key

seems to be a one-off error: Exception: Error at /usr/local/opnsense/mvc/app/controllers/OPNsense/Core/Api/SystemController.php:90 - Undefined array key 0 (errno=2) in /usr/local/opnsense/mvc/app/controllers/OPNsense/Base/ApiControllerBase.php:159

Co-authored-by: Ad Schellevis <ad@opnsense.org>
2022-07-28 09:50:06 +02:00
Franco Fichtner
e12b4ab36e interfaces: same issue when -i not given
This is only for command line use but we never know how that
might change in the future.
2022-07-27 09:22:56 +02:00
Franco Fichtner
c4be95a387 interfaces: implement ifctl -l awareness for :slaac magic
The default listing had an issue bringing in both the dhcp6c
and the slaac files.  Now act according to what we implemented
as a fallback approach for reading data files.
2022-07-27 08:59:15 +02:00
Franco Fichtner
39283ebf7c interfaces: ifctl experiment is complete #5862
Since "nameserver.sh" was a working title for when we just wanted
to make sense of the nameserver registration mess going on this
no longer fully applies for good reasons.

Change the name to ifctl.sh for leaving syntax parsing in place
and leave the symlink in sbin/ directory.  The same works nicely
for configctl.
2022-07-26 19:57:25 +02:00
Franco Fichtner
a5c02d8ade interfaces: migrate cleanup from interface_bring_down() #5862
Since we already kill routes in nameserver registrations we can
also take on the arp/pfctl magic moving the "router" file check
to its native utility.

It's debatable if we even need the pfctl or arp flush here.

To be continued...
2022-07-26 19:53:56 +02:00
Franco Fichtner
e9298024c1 interfaces: DHCP router to ifctl #5862 2022-07-25 12:03:23 +02:00
Franco Fichtner
a13849b3db Revert "reporting: legacy log no longer exists"
This reverts commit 48e5f9f2ab8e51dcfe9bbccbf1a5f67d05bafd48.
Keep support for reading text files in this location.

PR: https://github.com/opnsense/core/issues/5892
2022-07-25 11:34:03 +02:00
Franco Fichtner
2e2e59c1d8 interfaces: move to :slaac suffix use, fixing in ifctl #5862
This breaks the new feature in the interim since the router file
read is not yet supposed to read :slaac counterpart since the router
file is still read manually.  Refactor to follow.
2022-07-25 09:57:41 +02:00
Franco Fichtner
90db8f4d0f interfaces: widen and improve ifctl use
We do want to eventually lean on exclusive ifctl use in order to
be able to improve logic in ifctl or make adjustments really easy in
the future without missing a spot (e.g. adding scope to link-local
routers).
2022-07-22 10:54:55 +02:00
Maurice Walker
d582435b4b interfaces: add support for SLAAC WAN interfaces w/o DHCPv6 #5862; closes #5883
New script to be invoked by rtsold when Router Advertisements with
RDNSS / DNSSL information are received. Uses ifctl to create the
/tmp/$if_routerv6 file and creates the /tmp/$if_defaultgwv6 file
directly. Fixes the issue that these files don't get created when
the M and O flags in RAs are not set. Also, passes RDNSS / DNSSL
info from RAs to ifctl.
2022-07-22 09:20:12 +02:00
Stephan de Wit
30f499e89e
Firewall: add general firewall log for alias and filter syslog messages (#5894) 2022-07-21 16:11:32 +02:00
Ad Schellevis
7fe76b2239 Firewall: Diagnostics: Sessions - ignore age/expire when not provided / empty 2022-07-20 15:57:41 +02:00
Franco Fichtner
483048b9e6 dhcp: upgrade the prefix watcher to production level #5876
Just make a MD5 sum of the file and change polling to 20 seconds.
Call backend on first run as well without waiting.  Interval could
be lower still, but as said earlier it doesn't matter much all
things considered.
2022-07-20 14:24:26 +02:00
Franco Fichtner
643328486b dhcp: tabs are okay 2022-07-20 13:19:56 +02:00
Franco Fichtner
856574bbef dhcp: use a simple periodic update for now; closes #5876
Gets rid of package dependency which for dhcpleases6 simply
listens on the DHCPD lease file and runs the prefix.php command
unconditionally.

For now emulate this by issuing the command every 60 seconds
which can be adjusted later if someone complains, but seeing
how many bugs this script has had vs. how many people noticed
it (basically none) I doult this will have much impact overall.
2022-07-20 11:37:18 +02:00
Franco Fichtner
5ce587cee8 dhcp: we seem to keep repairing this script... #5876
'prefix' was never a key so this got never executed for whatever reason.
It remains broken in other projects and the question is if this script
really has any useful value.
2022-07-20 11:15:07 +02:00
Ad Schellevis
868c9531cd system: remove last bits of clog (circular logging) support, closes https://github.com/opnsense/core/issues/5892 2022-07-19 20:13:00 +02:00
Josh Soref
efb4eb3f8f firewall: fix "statistics" spelling in function and file name 2022-07-18 17:03:54 +02:00
Josh Soref
3b7453ca2b system: fix spelling in key name 2022-07-18 15:54:44 +02:00
Josh Soref
20a3c3da38
Spelling (#5885) 2022-07-18 13:59:03 +02:00
Franco Fichtner
48e5f9f2ab reporting: legacy log no longer exists 2022-07-18 13:51:29 +02:00
Franco Fichtner
8edb37042c interfaces: remove inconsistencies regarding ping utility 2022-07-18 09:16:11 +02:00
Franco Fichtner
31f3e82c6b unbound: ignore CalledProcessError and make a note about it 2022-07-15 13:48:10 +02:00
Franco Fichtner
b7de99e08b dnsmasq: add dnsmasq watcher; closes #5119 2022-07-15 12:16:36 +02:00
Franco Fichtner
d7ade48769 system: move script to proper location 2022-07-15 10:29:13 +02:00
Franco Fichtner
f44dbecd79 dnsmasq: roll this back a bit #5119 2022-07-15 10:26:54 +02:00
Franco Fichtner
b1c7f44102 dnsmasq: make room for dhcpleases obsoletion #5119 2022-07-15 10:08:38 +02:00
Franco Fichtner
8d56b78153 firmware: provide upgrade log "audit" for #5855 2022-07-14 15:18:06 +02:00
Franco Fichtner
bad28afe70 system: render interfaces in convert_config() #5768
This brings it in line with migrations although both hinge on
the idea that rc.configure_firmware is called to execute this
code.  Both need a better integration but bringing them to the
same level seems to make the most sense.

After reboot the config is in a consistent state now too...

Remove previous plugins_interfaces() call and always use full
path to pluginctl like most spots already do.
2022-07-12 20:41:52 +02:00
Ad Schellevis
3726f67882 VPN: IPsec: Security Association Database - refactor to MVC and extend functionality.
o provide option to delete entries
o show Ikeid and Reqid including optional phase[1|2] description when provided
o extend fields with data provided from setkey -D
2022-07-07 18:47:29 +02:00
Ad Schellevis
023d8e4a35 VPN: IPsec: Security Policy Database - refactor to MVC and extend functionality.
missed a spot in the previous commit, make sure we're not omitting host entries as they skip a subnet definition
2022-07-07 11:40:58 +02:00
Ad Schellevis
434a0a80e8 VPN: IPsec: Security Policy Database - refactor to MVC and extend functionality.
o add a remove button hooking spddelete to remove entries when not cleanedup correctly for some reason to ease maintenance
o add reqid to IPsec phase 2 tunnel view for clarity so we can easily inspect if traffic is trying to pass the right policy
o show Ikeid and Reqid including optional phase[1|2] description when provided
o extend fields with data provided from setkey -DP, but keep them  deselected in the default view (e.g. Upperspec, Mode, Type, ..)
2022-07-06 17:36:07 +02:00
Ad Schellevis
becf4e9342 VPN: IPsec: Status Overview - cleanup, remove vici library in favour of port package 2022-07-05 11:11:53 +02:00
Franco Fichtner
b6167bfd90 system: move add_user script out of shell scripts
Shell scripts are for opnsense-shell.
2022-07-05 08:54:45 +02:00