11691 Commits

Author SHA1 Message Date
Ad Schellevis
d7983fd99f whitespace / consistency for https://github.com/opnsense/core/pull/3976 2020-03-12 15:07:53 +01:00
cedric.deconinck@nerim.com
82cdd740ee Allow concurrent add and delete request with alias_util API
Currently the API has a strange behavior when we try to add or delete in parallel several addresses in the same alias
For example, while we want to delete multiple address  (1 request = 1 address) all the request returns a 200 OK {"status": "done »}, but some address stay in the alias content
The same logic apply for the alias_utils/add endpoint

This behavior can be reproduced with this python script
import os
import subprocess

addr_list = ["10.1.0.0", "10.1.0.1", "10.1.0.2", "10.1.0.3", "10.1.0.4",
             "10.1.0.5", "10.1.0.6", "10.1.0.7", "10.1.0.8", "10.1.0.9", "10.1.0.10"]

secret = ""
key = ""
host = ""
existing_alias = ""

for addr in addr_list:
    subprocess.Popen(
        ["curl   --header \"Content-Type: application/json\"   --basic   --user \"" + secret + ":" + key + "\"   --request POST  --data  '{\"address\":\"" + addr + "\"}' http://" + host + "/api/firewall/alias_util/add/" + existing_alias], shell=True, stdin=None, stdout=None, stderr=None, close_fds=True)

With this fix, adding and removing addresses works correctly in parallel
2020-03-12 14:25:45 +01:00
Ad Schellevis
5df590cd13 SSH: optional KexAlgorithms, Ciphers and MACs to harden security. closes https://github.com/opnsense/core/issues/3975 2020-03-12 13:47:56 +01:00
Ad Schellevis
005f7744f4 usermanager: add (i) button to display endpoints, eases debugging 2020-03-11 15:20:04 +01:00
Ad Schellevis
0e2751d2d1 rc.linkup: filter_configure() needs to be called after stop/start devd action to assure default gateway switching actual has the change to do something
04d4f50cca/src/etc/inc/filter.inc (L291-L307)

for https://github.com/opnsense/core/issues/3961
2020-03-10 15:08:43 +01:00
Ad Schellevis
535c85101a MVC, config: fix previous 2020-03-10 10:50:33 +01:00
Ad Schellevis
fc60d04cd6 MVC, config: fix getBackupFilename(), floats aren't really safe to use of we only want to split the number part. 2020-03-10 10:47:14 +01:00
vnxme
faf71c7e70
Fix nsComment inconsistency in OpenSSL config (#3955)
Read more about the Netscape extensions status: 

https://www.openssl.org/docs/man1.0.2/man5/x509v3_config.html
2020-03-10 09:48:53 +01:00
Ad Schellevis
8f3c89642c MVC, config: add method to find backup filename (or false if not found)
needed for  https://github.com/opnsense/plugins/issues/1720
2020-03-09 18:41:26 +01:00
Ad Schellevis
5b7268bb17 MVC, config: expose backupCount() which returns the number of backups to keep.
might be needed for https://github.com/opnsense/plugins/issues/1720
2020-03-09 16:06:30 +01:00
Ad Schellevis
01fb3a4f44 MVC / config: synchronize backup timestamps with revisions.
A minor change, previously we requested microtime() twice which always lead to a small difference in revision and backup. If we sync these two timestamps, it's easier to find the previous sitation updated.time matches /conf/backup/config-[updated.time].xml
2020-03-09 15:16:22 +01:00
Ad Schellevis
211fd8dfb3 firewall: for automatic rules, floatind means either all interfaces (empty) or more than one selected. for https://github.com/opnsense/plugins/issues/1720 2020-03-09 15:13:02 +01:00
Franco Fichtner
2c25b1cffa pkg: accept build-time flavour selection 2020-03-06 12:37:27 +01:00
Ad Schellevis
9562ff80f0 firewall: rule lookup redirector, don't escape internal urls provided by $rule->getRef(), to make suer we can properly support slashes etc in urls. The risk of this change should be rather low, since you need local access to feed '#ref' (which is the origin of getRef())
need to be able to redirect to /ui/firewall/filter/ for https://github.com/opnsense/plugins/issues/1720
2020-03-05 17:10:20 +01:00
Ad Schellevis
9f07049498 filter: flush priority sections to rules.debug, eases traceability
ref: https://github.com/opnsense/plugins/issues/1720

    # Please enter the commit message for your changes. Lines starting
2020-03-05 14:47:24 +01:00
Franco Fichtner
a3cf8cf81b mvc: PSR12 is really picky :) 2020-03-05 07:57:47 +01:00
Ad Schellevis
550bcea155 MVC: In order to extend the separate nodes of an arraytype field, we should be able to control the container creation. This commit adds newContainerField() which is responsible for spawning new container fields and attaching them to the current model.
Internally the object model looks like this:

ArrayField - [
	ContainerField - [
		TextField
		EmailField
		....
	]
	ContainerField - [
		{same types as first row}
	]
]

uuid's are attached to the ContainerField types by the ArrayField (or on load by BaseModel)

ref: https://github.com/opnsense/plugins/issues/1720
2020-03-04 15:09:37 +01:00
Ad Schellevis
a8b2fb5e92 MVC: support inheritance of the ArrayField type, institutionalise the type by adding a method isArrayType() to the basefield, which returns true if the type itself is a ArrayField or one of its descendants.
Conceptually there are two types containers in our model, the standard one (ContainerField), which only acts as a placeholder without logic and the ArrayField type, which understands repetitive structures and comes with its own uuid reference per item and methods supporting addition and removal of entries.

With the application specific field types it can be practical if you could extend this container type as well, so you can add additional methods on a more logical spot in the code tree.

ref https://github.com/opnsense/plugins/issues/1720
2020-03-04 13:48:18 +01:00
Ad Schellevis
41cf191205 pam/squid: work around to skip passing additional auth properties. https://forum.opnsense.org/index.php?topic=16126 2020-03-04 11:44:47 +01:00
Ad Schellevis
665e3db1f6 packet capture, validate interface input. closes https://github.com/opnsense/core/issues/3964 2020-03-04 11:30:36 +01:00
Franco Fichtner
a4a26fa898 src: style sweep 2020-03-03 14:25:20 +01:00
Ad Schellevis
8496073046 MVC: BaseField, also store "" as initial state to prevent empty fields as being marked as changed all the time.
Side affect of this change is that testDependConstraintNok seemed to be missing a back reference, which is being added in this commit as well (TestModel.xml).

Catched while working on https://github.com/opnsense/plugins/issues/1720
2020-03-03 14:12:08 +01:00
Franco Fichtner
67bbb8e342 dhcp: parenthesis are bad style, either important without or discard 2020-03-03 12:39:05 +01:00
Franco Fichtner
582adc9ef2 dnsmasq/unbound: return strings to their original form
This is too much valid translation bounce noise and will not help.
This is better explained in detail in a documentation page if
users really read it, that is.
2020-03-03 12:32:40 +01:00
Ad Schellevis
6d2d6a7ad7 firewall: carp, miss a bit of visibility on internal rules, refer to setting page for allow rule and make sure redirector understands links without page reference 2020-03-02 21:31:37 +01:00
Ad Schellevis
9aac0415ef fix plist 2020-03-02 20:13:04 +01:00
Ad Schellevis
5ed7f4a54e MVC: add NetworkAliasField type for https://github.com/opnsense/plugins/issues/1720
Validate if input is either a valid network, host or alias including specialnetworks (any, self, or attached interface net/address)
2020-03-02 20:55:46 +01:00
Ad Schellevis
6da8a2f558 MVC: BaseListField + PortField, use getValidationMessage() to bootstrap defaults. found while working on https://github.com/opnsense/plugins/issues/1720, needed for the new NetworkAliasField type 2020-03-02 18:37:34 +01:00
Ad Schellevis
7bd1dab314 MVC: fix typo in unit test naming. (https://github.com/opnsense/plugins/issues/1720) 2020-03-02 17:52:13 +01:00
Franco Fichtner
c6314e20d1 pkg: fix plist 2020-03-02 14:19:49 +01:00
Ad Schellevis
1bdb252f96 MVC: ProtocolField missing gettext (https://github.com/opnsense/plugins/issues/1720) 2020-03-02 13:55:51 +01:00
Ad Schellevis
6d5301a7b3 MVC: CountryField, static options should take settings into account. 2020-03-02 12:09:16 +01:00
Ad Schellevis
e057fce06d MVC: add unittest for ProtocolField (https://github.com/opnsense/plugins/issues/1720) 2020-03-02 10:42:39 +01:00
Ad Schellevis
dddbe2f1ec MVC: protocol field, init bug (https://github.com/opnsense/plugins/issues/1720) 2020-03-02 10:36:16 +01:00
Franco Fichtner
43f320342a pkg: fix plist 2020-03-02 09:38:09 +01:00
Ad Schellevis
c104582ed7 logging: leap-year issue. without a year, strptime() doesn't seem to assume it's this year. 2020-02-29 17:23:10 +01:00
Ad Schellevis
212e9527c3 MVC: add ProtocolField type, needed for https://github.com/opnsense/plugins/issues/1720 2020-02-28 16:49:46 +01:00
Ad Schellevis
0a112eaec4 MVC: simplify IDS actions, for https://github.com/opnsense/core/issues/3951 2020-02-27 12:05:39 +01:00
Ad Schellevis
0ae805a54c MVC: SimpleActionButton trim result before comparison 2020-02-27 11:45:21 +01:00
Ad Schellevis
1d9307a019 fix previous 2020-02-27 11:29:34 +01:00
Ad Schellevis
cf6c04b5c4 MVC: simplify alias reload, for https://github.com/opnsense/core/issues/3951 2020-02-27 11:28:40 +01:00
Ad Schellevis
c64b8147d0 MVC: add onPreAction to SimpleActionButton, to support two step actions (save form data --> apply) 2020-02-27 11:19:58 +01:00
Ad Schellevis
300c41818f MVC: simplify proxy actions, for https://github.com/opnsense/core/issues/3951 2020-02-27 11:07:33 +01:00
Ad Schellevis
1ae92924c9 MVC: simplify traffic shaper reload, for https://github.com/opnsense/core/issues/3951 2020-02-27 10:42:18 +01:00
Ad Schellevis
9199995cd3 MVC: simplify cron reload, for https://github.com/opnsense/core/issues/3951 2020-02-27 10:36:28 +01:00
Ad Schellevis
481018404f MVC: simplify captive portal reload, for https://github.com/opnsense/core/issues/3951 2020-02-27 10:33:39 +01:00
Ad Schellevis
385c55f4e5 MVC: simplify loopback reload, for https://github.com/opnsense/core/issues/3951 2020-02-27 10:26:47 +01:00
Ad Schellevis
ca9000455d MVC: simplify vlxan reload, for https://github.com/opnsense/core/issues/3951 2020-02-27 10:24:30 +01:00
Ad Schellevis
a12cdd5534 MVC: simplify static routing, for https://github.com/opnsense/core/issues/3951 2020-02-27 10:20:07 +01:00
Ad Schellevis
40e2d25ddc MVC: simplify Monit reload, for https://github.com/opnsense/core/issues/3951 2020-02-27 10:09:05 +01:00