13471 Commits

Author SHA1 Message Date
Ad Schellevis
5752bd6eb3
VPN/IPsec add new MVC module (#6187)
Add new component to manage IPsec connections in a similar format as `swanctl.conf` is defined (https://docs.strongswan.org/docs/5.9/swanctl/swanctlConf.html).  As this needs to work in conjunction with the legacy IPsec module, some minor changes are needed to the current state. 

o VPN/IPsec/Pre-Shared Keys - add optional remote identifier (merges in `ipsec.inc`)
o VPN/IPsec/Virtual Tunnel Interfaces - new component to show existing VTI's and add new ones (as these are separate entities)
o VPN/IPsec/Connections [new] - configuration tool to build `swanctl.conf` 
o Integrate MVC generated `swanctl.conf` into `ipsec.inc` (legacy overlays)
o Integrate manually configured VTI's into `ipsec.inc` (`array_merge(ipsec_get_configured_vtis(), (new \OPNsense\IPsec\Swanctl())->getVtiDevices())`)
o fix minor php warning when changing reqid's (`$local|remote_configured` initialisation when `$configured_intf[$intf]` not found)
2022-12-12 10:37:43 +01:00
Ad Schellevis
d25318a483 MVC/Firewall/Util - import functionality of find_smallest_cidr() into MVC so IPsec VTI code can use it as well. 2022-12-11 17:08:43 +01:00
Ad Schellevis
63eeaffe21 Firewall: Diagnostics: States - Performance improvements and better address parsing in search.
As the output of pfctl -vvss can grow quite rapidly, it seemed like a good idea to run this code through a profiler. Some of the hotspots (like parsing addresses) are now cached in memory to prevent over enthusiastic computation, which can save quite some processing time. Pushing down the string join on which the pattern search should match does help prevent to prevent compiling a search string which turns out to be irrelevant later (no filter or ip[+port] filter).

The network (address) search handles (optional) ports as well now, which allows for patterns like `10.0.0.1:80` and `10.0.0.0/24:80`.
2022-12-07 09:40:48 +01:00
kulikov-a
a4b5a815c1 unbound: always use python first 2022-12-05 21:14:51 +01:00
Ad Schellevis
f5cd86b61d Filter / Diagnostics - performance improvement when fetching rule labels.
Since rule labels are directly hooked to the modification time of /tmp/rules.debug, we don't have to recalculate the offsets on every request. This patch saves the labels and the last modification time so we can refresh when changed or non-existent.
2022-12-05 18:41:43 +01:00
Ad Schellevis
f55c828e23 MVC / bootgrid - similar issue as 926a4c8e68 for a couple of MVC components, when POST sends an empty array, we should handle that properly. 2022-12-05 17:56:21 +01:00
Ad Schellevis
ae8e0ce4a4 syslog/lockout handler - better trap ssh messages and improve lockout behaviour.
As the client still might have a state when being kicked-out, we should kill any state the client has while adding it to the alias. Apparantly our ssh messages are only catched partially, so add ".*Authentication error for .*" to the list as well. To ease testing, better detect the location of the timestamp so we can use a construction like this to feed amn existing log:

lockout_handler < /var/log/audit/audit_20221205.log
2022-12-05 14:52:16 +01:00
Ad Schellevis
13ea70af04 unbound: change working directory before check. closes https://github.com/opnsense/core/issues/6171 2022-12-05 11:42:53 +01:00
kulikov-a
623b2643e6
unbound: typo (#6168) 2022-12-05 08:42:38 +01:00
Ad Schellevis
c714f08f92 Services: Web Proxy: Administration - fix broken " Google GSuite restricted" 2022-12-03 12:33:13 +01:00
Stephan de Wit
53dd65709a
unbound: add client activity chart (#6161)
* unbound / overview: add client activity chart, include logarithmic scale on both charts

* unbound: remove tooltip from workaround datapoints

* unbound / overview: also end the x axis properly on log scale

* unbound / overview: prevent queries on non-existing database

* unbound / overview: replace cache hits with blocklist size and update icons

* unbound / overview: refactor rolling API call
2022-12-02 10:57:20 +01:00
kulikov-a
47bbab96dc
MVC - match on multivalued (#6152) 2022-12-02 09:09:02 +01:00
kulikov-a
8e5b0a6c76
tokenize2: unicode content (#6166) 2022-12-02 09:01:35 +01:00
Stephan de Wit
842bcd470a unbound / dnsbl_module: log null client values on AttributeError 2022-11-30 09:06:10 +01:00
Ad Schellevis
b584e1375d MVC - HostnameField and ZoneRootAllowed, make sure we allow @.my.sub.domain as valid input. closes https://github.com/opnsense/core/issues/6155 2022-11-26 09:25:53 +01:00
Ad Schellevis
5586e49d86 VPN: OpenVPN - add daemon name "openvpn_%", closes https://github.com/opnsense/core/issues/6156 2022-11-25 20:36:55 +01:00
Stephan de Wit
36c358ea3b unbound: safeguard usage of DNSSEC 2022-11-25 13:50:53 +01:00
Franco Fichtner
a68700be02 src: style sweep 2022-11-25 12:57:45 +01:00
Stephan de Wit
b20ddbe00f
unbound: add overview dashboard (#6101)
Adds a reporting backend for Unbound as well as a dashboard showing an overview of interesting statistics:

    Total DNS queries (over a maximum period of 7 days)
    Blocked queries
    Cache hits
    local-data hits
    A traffic graph with variable intervals
    top N passed/blocked domains (with associated blocklist)

There are a couple of hardcoded values:

    The underlying database is kept up-to-date for the last 7 days.
    The ring buffer used to decouple unbound from the logging backend has a size of 100000 entries.
    In very busy networks, db commits are done for a max of 4000 entries, which according to testing seems to be a good break-even point for DNS throughput vs. insert performance. Everything below this is flushed to the database every 5 seconds.
    To facilitate the variable interval traffic graph, multiple views with varying detail in time slots are created: 1, 5 and 30 minute buckets. These can easily be extended should different intervals be necessary.
2022-11-25 11:42:38 +01:00
Ad Schellevis
d4e6378061 VPN: OpenVPN: Servers - remove unused "pool_enable" attribute, originally introduced as unused setting in d799787e49 2022-11-24 18:13:14 +01:00
kulikov-a
5cd36a1322
typo (#6153)
consider precedence
2022-11-23 19:20:42 +01:00
Ad Schellevis
d55e5d50b6 VPN: IPsec: Tunnel Settings - add Unique selection so people can easily revert to Strongswan's default (no) if they want.
Not going to backport this, but in 22.7.x unique was called uniqueids and forcefully set to "yes", which according to the documentation (https://wiki.strongswan.org/projects/strongswan/wiki/connsection) is not compatible with a closeaction as this might lead to an avalanche of reconnecting children for the same connection. Although swanctl (https://docs.strongswan.org/docs/5.9/swanctl/swanctlConf.html) doesn't explicitly mention an incompatibility, our defaults are different than the ones being configured nowadays. Adding the option does seem to make sense.
2022-11-23 17:31:03 +01:00
Ad Schellevis
7333aa9c40 MVC / ApiMutableModelControllerBase - minor addition to 47eac7dbf8 preventing upsert when non uuid string is provided. 2022-11-23 11:35:38 +01:00
Franco Fichtner
2d93449f88 interfaces: fix ACL and migrate a few registrations #6151 2022-11-23 10:52:56 +01:00
Franco Fichtner
d4db4023e6 interfaces: use get_interface_list() to identify hardware
Media settings probe is suboptimal for hardware detection and
interfaces_hardware() already uses the function to decide where
to enforce hardware settings.

PR: https://forum.opnsense.org/index.php?topic=30923.0
2022-11-22 16:42:43 +01:00
Ad Schellevis
f291908c7b UI - Javascript (setFormData) - prevent "Uncaught DOMException: Failed to set the 'value' property on 'HTMLInputElement': This input element accepts a filename, which may only be programmatically set to the empty string" when a form contains file inputs 2022-11-21 20:40:30 +01:00
Ad Schellevis
a37303a46c MVC / UIBootgrid - add support for title property on custom commands (used in tooltips) 2022-11-21 16:36:56 +01:00
Franco Fichtner
49f63e8082 firewall: whitespace 2022-11-21 12:49:34 +01:00
Ad Schellevis
6ac82416d7 MVC - minor bugfix in ApiControllerBase->parseJsonBodyData() when $jsonRawBody isn't of array type we should skip merging entries. 2022-11-20 20:05:33 +01:00
Ad Schellevis
47eac7dbf8 MVC/Core - setBase() : Convert setBase() to an upsert operation. if we don't know the uuid, it's ok to create it.
this eases scriptable actions where a single unique entry should be pushed atomically to multiple hosts.

e.g. the below would add/set an alias named api_test_001 :

r = requests.post(
    'https://192.168.1.1/api/firewall/alias/setItem/9a8fc804-0000-0001-99cb-283ca2d04e58',
    verify=False,
    auth=(api_key, api_secret),
    json={'alias':
              {
                  'enabled': '1',
                  'name': 'api_test_001',
                  'type': 'external',
                  'counters': '0',
                  'description': 'api_test_001'
              }
    }
)

print(r.text)
2022-11-16 21:35:01 +01:00
Ad Schellevis
da9c21c550 Firewall: Log Files: Live View - lookup hostnames may result in http 431 ( Request Header Fields Too Large ). Split requests in cycles of 50, closes https://github.com/opnsense/core/issues/6139 2022-11-16 18:14:34 +01:00
Ad Schellevis
e85f1d74b2 Firewall: Diagnostics: Aliases - minor cleanup, sequenced array doesn't need to extract values 2022-11-16 11:11:50 +01:00
Ad Schellevis
c929c73a50 core - change default sorting to case-insensitive. 2022-11-16 09:07:44 +01:00
Franco Fichtner
272c231c70 src: fix a few minor coverty reports 2022-11-15 10:19:19 +01:00
Franco Fichtner
c1347533c1 system: typo 2022-11-14 14:45:23 +01:00
Franco Fichtner
68ab55bf98 system: empty() is enough in these checks 2022-11-14 14:43:38 +01:00
Franco Fichtner
a6b2711779 dpinger: second try on previous
There are still unhandled 'gateway' access cases but this
really has been the case forever.  No need to safeguard
these at the moment.
2022-11-14 12:14:33 +01:00
Franco Fichtner
b9badcdb90 Revert "dpinger: php warning raised, not sure if correct this way"
This reverts commit a92960829811115994820b01a256a35c428321a9.
2022-11-14 08:00:23 +01:00
Franco Fichtner
a929608298 dpinger: php warning raised, not sure if correct this way 2022-11-14 07:57:54 +01:00
Franco Fichtner
d463abc80f dpinger: style issue 2022-11-13 11:33:53 +01:00
Franco Fichtner
0e86e27eb9 interfaces: add internal interface name to description 2022-11-13 11:22:44 +01:00
Franco Fichtner
39f8a1b6b1 system: simplify slightly #5989
In theory we should be able to move the host routes for 6rd and 6to4
easily without repercussion, unless some part of the system tries to
reload the interface without calling system_routing_configure().
2022-11-11 15:54:43 +02:00
Franco Fichtner
422b68f6c2 system: add option to skip monitor host route #6002 2022-11-11 12:30:34 +02:00
Franco Fichtner
a61afc7f46 system: inline system_staticroute_configure() #5989
Only used once.
2022-11-11 12:04:32 +02:00
Franco Fichtner
edc42e0e80 plugins: drop empty run result 2022-11-11 11:47:27 +02:00
Franco Fichtner
2c588a4bc0 dpinger: looks like we need this #5989 2022-11-11 11:44:52 +02:00
Franco Fichtner
9c647131eb system: prevent directly-connected host routes last minute #5989
They are not necessary.
2022-11-11 11:41:58 +02:00
Franco Fichtner
20d31f92b0 dpinger: use same exclusion magic here for now #5989 2022-11-11 10:51:21 +02:00
Franco Fichtner
f93c287472 system: collect all host routes in a single run #5989
If this works we can use it to also generate the host routes during
the routing table reconfiguration.
2022-11-11 10:46:21 +02:00
Franco Fichtner
0d3b70f4d3 system: extract monitor instance read #5989
While here simplify the host route creation as we want to split
this out for a clean reset during a full routing table reload so
we can be sure all stale and disabled instances are removed anyway.
2022-11-11 10:25:56 +02:00