5
0
mirror of git://git.proxmox.com/git/pve-firewall.git synced 2025-01-06 17:17:59 +03:00
Commit Graph

855 Commits

Author SHA1 Message Date
Leo Nunner
1f0303f82a parser: fix scoped alias resolution
We tried to resolve aliases in some places where the cluster
configuration didn't get set. It's probably better to handle these cases
directly in the function at hand, instead of at every place where this
issues might arise.

This seemingly fixes the issues reported on pve-user and the forum:
  * https://forum.proxmox.com/threads/pve-8-pve-firewall-status-no-such-alias.130202/
  * https://forum.proxmox.com/threads/ipset-not-working-for-accepting-cluster-traffic.129599/

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
2023-07-17 10:35:51 +02:00
Thomas Lamprecht
0d28aa2abc bump version to 5.0.2
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-21 19:17:27 +02:00
Leo Nunner
b06a8c2d03 fix #4556: api: return scoped IPSets and aliases
Introduce a new 'scope' field in the return values for the /ref
endpoints. Also add the 'ref' field in the VM endpoint, since it has
been missing up until now.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
2023-06-15 09:22:45 +02:00
Leo Nunner
aaa87fbb83 api: fix scoping for ipset endpoint
in the cluster class, we save the cluster config into the 'fw_conf'
variable, and not into 'cluster_conf', which in turns is set to 'undef'
instead.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
2023-06-15 09:21:47 +02:00
Wolfgang Bumiller
355420892e bump version to 5.0.1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-06-07 16:06:17 +02:00
Wolfgang Bumiller
5bf304b587 change vm/ prefix to guest/ prefix
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-06-07 16:04:25 +02:00
Wolfgang Bumiller
9405f42be8 d/control: add missing anyevent dependency
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-06-07 15:13:38 +02:00
Leo Nunner
eeed0d90c9 fix #4556: introduce 'dc' and 'vm' prefix for aliases
since they had the same issue as IPSets, detailed in #4556. The format
works the same as for IPSets:

    dc/alias
	Looks for the alias on the Datacenter level.
    vm/alias
	Looks for the alias on the VM level.
    alias
	Uses the previous method of scoping, where it first looks at the
	VM level and then at the Datacenter level.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
2023-06-07 15:13:01 +02:00
Leo Nunner
856de23adb fix #4556: introduce 'dc' and 'vm' prefix for IPSets
to differentiate whether they should be taken from the datacenter config
or from the local config. The parser now accepts IPSets in the following
format:

    +dc/ipset
	Looks for the IPSet on the Datacenter level.
    +vm/ipset
	Looks for the IPSet on the VM level.
    +ipset
	Uses the previous method of scoping, where it first looks at the
	VM level and then at the Datacenter level.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
2023-06-07 15:12:56 +02:00
Thomas Lamprecht
97f2bc6c68 bump version to 5.0.0
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-22 14:48:12 +02:00
Thomas Lamprecht
ed35a17793 d/control: raise standards version compliance to 4.6.2
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-22 14:48:09 +02:00
Thomas Lamprecht
c3d811ce84 d/control: define compat level via build-depends and raise to 13
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-22 14:47:51 +02:00
Thomas Lamprecht
68a0d9585e buildsys: add sbuild convenience target
and only call lintian for the dsc target, as otherwise sbuild already
takes care of that (avoid duplicate work)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-22 14:46:48 +02:00
Thomas Lamprecht
a6d4c650d7 buildsys: derive upload dist automatically
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-22 14:46:36 +02:00
Thomas Lamprecht
22b180a180 buildsys: use full DEB_VERSION and correct DEB_HOST_ARCH
The DEB_BUILD_ARCH is the one from the build host, the DEB_HOST_ARCH
is the one the package is build for, so the latter is the correct one
here.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-22 14:45:24 +02:00
Thomas Lamprecht
8fca2e979a buildsys: cleanup and expand clean target
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-22 14:42:06 +02:00
Thomas Lamprecht
005ab90dad add basic gitignore file
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-22 14:40:55 +02:00
Thomas Lamprecht
a1622d6367 d/control: do not depend on obsolete lsb-base
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-22 14:39:36 +02:00
Thomas Lamprecht
5d223aa31d makefile: convert to use simple parenthesis
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-22 14:39:25 +02:00
Thomas Lamprecht
8be25ddb37 buildsys: rework doc-gen cleanup and makefile inclusion
The NOVIEW variable is useless now anyway, and the cleanup-docgen
target is a bit dangerous (removes _all_ *.adoc files) and it's just
a single line, so avoid complexity.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-22 14:27:12 +02:00
Thomas Lamprecht
d3bf672b4f bump version to 4.3-2
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-16 11:18:09 +02:00
Fabian Grünbichler
4d1ca18ee6 fix #4730: add safeguards to prevent ICMP type misuse
without this additional conditions, it's possible to break the firewall by
setting an ICMP-type value as dport for non-ICMP protocols, e.g. 'any' for
'tcp'.

by rejecting the invalid rule/parameter, the rest of the ruleset is still
applied properly, and the error messages are a lot more informative as well.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-05-16 11:15:15 +02:00
Fabian Grünbichler
42a7fbe0a4 icmp: factor out check for relevant protocols
this were not entirely consistent and sometimes the checks were repeated.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-05-16 11:15:15 +02:00
Thomas Lamprecht
4fffdd36f0 d/changelog: fixup released
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-04-26 12:24:28 +02:00
Thomas Lamprecht
521148df13 fix variables declared in conditional statement
as that can trigger hard to reproduce/debug bugs; as with such
statements the variable won't be necessarily undef if the post-if
evaluates to false, but rather will hold the (now bogus) value from
the last time it evaluated to true.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-04-11 16:23:42 +02:00
Thomas Lamprecht
e3d08ca1a6 d/changelog: fix typo
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-03-17 15:30:49 +01:00
Thomas Lamprecht
23b3e816dd bump version to 4.3-1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-03-17 15:28:37 +01:00
Alexandre Derumier
e3047e3f0c Fix #4550 : host options: add nf_conntrack_helpers
kernel 6.1 have removed auto helpers loading.
This was deprecaded since multiple years.

We simply need to add rules in PREROUTING to load theses helpers.

supported protocols :
- amanda
- ftp
- irc (ipv4 only)
- netbios-ns (ipv4 only)
- pptp (ipv4 only)
- sane
- sip
- snmp (ipv4 only)
- tftp

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2023-03-13 10:41:09 +01:00
Wolfgang Bumiller
43dfdf3bac d/control: depend on pve-common 7.3-2 for new dump-log variant
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-01-27 10:51:37 +01:00
Christian Ebner
8bd9b3e479 api: Add optional parameters since and until for timestamp filter
The optional unix epoch timestamps parameters `since` and `until` are introduced
in order to filter firewall logs files. If one of these flags is set, also
rotated logfiles are included. This is handled in the `dump_fw_logfile` helper
function. Filtering is now performed based on a callback function passed to
`dump_fw_logfile`.

This patch depends on the corresponding patch in the pve-common repository.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
[w.bumiller@proxmox.com: fixup 'continue' -> 'next']
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-01-27 10:49:55 +01:00
Stefan Hrdlicka
c9536959ab cleanup: don't capture "/xx" of CIDR
Signed-off-by: Stefan Hrdlicka <s.hrdlicka@proxmox.com>
2022-12-14 14:40:41 +01:00
Stefan Hrdlicka
1218eee930 allow non zero ip address host bits to be entered
They can already be set directly via the cluster.fw file. Net::IP is just a
bit more picky with what it allows:
For example:
  error:   192.168.1.155/24
  correct: 192.168.1.0/24

This cleans the entered IP and removes the non zero host bits.

Signed-off-by: Stefan Hrdlicka <s.hrdlicka@proxmox.com>
2022-12-14 14:40:39 +01:00
Thomas Lamprecht
b4577a253c bump version to 4.2-7
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-17 19:53:09 +01:00
Leo Nunner
5e3c0cf82d fix #4268: add 'force' parameter to delete IPSet with members
Currently, trying to delete a non-empty IPSet will throw an error.
Manually deleting all members of the set might be a time-consuming
process, which the force parameter allows to bypass.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
2022-11-16 20:26:51 +01:00
Thomas Lamprecht
21d5ba9c34 helpers: move over missing lock_vmfw_conf
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-16 17:03:12 +01:00
Thomas Lamprecht
429b536178 helpers: re-introduce original call site for backward compat
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-16 17:02:54 +01:00
Alexandre Derumier
5bdc31fb91 move clone_vmfw_conf && remove_vmfw_conf to a Helpers
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2022-11-16 16:52:09 +01:00
Wolfgang Bumiller
84f91498b5 whitespace fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-10-04 13:18:05 +02:00
Leo Nunner
6198a78f13 fix #4204: automatically update usages of group when it is renamed
When renaming a group, the usages didn't get updated automatically. To
get around problems with atomicity, the old rule is first cloned with the
new name, the usages are updated and only when updating has finished, the
old rule is deleted.

The subroutines that lock/update host configs had to be changed so that
it's possible to lock any config, not just the one of the current host.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
2022-10-04 13:02:04 +02:00
Thomas Lamprecht
0b8ac6616f macros: s/SPICE/SPICEproxy/
while I'm still a bit on the edge about the usefulness of this macro,
it should better convey for what it is, as SPICE itself doesn't
really have a direct port (in PVE that is), but all runs through our
spiceproxy, so name the macro that way.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-09-12 17:22:40 +02:00
Oguz Bektas
b3b7974f9a fix #4018: add firewall macro for SPICE
uses port 3128 (same as squid)

although it's enabled by default for the "management" ipset, it doesn't
hurt to add it in there.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2022-09-12 17:15:57 +02:00
Thomas Lamprecht
dd559e8af8 bump version to 4.2-6
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-08-29 09:43:59 +02:00
Fabian Grünbichler
a1f5aa007a fix #4175: ignore non-filter ebtables tables
we only ever add rules to the filter table, without this we'd add all
rules from other tables (which might have been manually filled by the
admin) to the filter table as well - adding another copy on every
iteration of the firewall update cycle!

note that ebtables-restore seems to flush tables contained in its input,
but leave those alone which are not referenced at all.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-08-29 09:38:55 +02:00
Mira Limbeck
60ab67f52d fix invalid vmfw config being interpreted as enabled
MAC filter was enabled as long as the VM firewall config existed even
with an invalid config.

With this change the check now matches the one for CTs.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2022-08-25 16:36:43 +02:00
Thomas Lamprecht
7761d1a1a8 daemon: code cleanup/shortify
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-08-25 15:56:29 +02:00
Thomas Lamprecht
4a626429c2 whitespace/indentation/line-length cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-08-25 15:54:05 +02:00
Thomas Lamprecht
2038e26b8b config defaults: macfilter defaults to on
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-05-15 08:47:03 +02:00
Thomas Lamprecht
fba392f24c bump version to 4.2-5
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-11-04 16:37:17 +01:00
Thomas Lamprecht
1bf4d1d69b fix #3677: follow up: actually handle bucket size and ignore initval
The former is simply new and we can control it, so do so instead of
ignoring it, if it seems worth while we can also expose that as
option or do some fancier auto calculation, maybe depending on ipset
size.

The u32 `initval` is a bit different, its not a config in the exact
traditional sense but would allow to recreate an bit to bit
indentical save/restore - but we do not really do that and we cannot
pre-calculate that our self (or at least I'd rather like to avoid
doing that from perl).. So, ignore it actively for now to avoid
false-postivie detection in pending changes.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-29 18:27:04 +02:00
Mark Yardley
8f62e951aa fix #3677 ipset_get_chains fixed to work with new ipset output
Signed-off-by: Mark Yardley <mgit@fragmentedpackets.net>
2021-10-28 11:01:32 +02:00