5
0
mirror of git://git.proxmox.com/git/pve-firewall.git synced 2025-01-21 22:03:52 +03:00

841 Commits

Author SHA1 Message Date
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
Thomas Lamprecht
bd63a4390f bump version to 4.2-4
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-12 10:39:12 +02:00
Thomas Lamprecht
2a2b81b414 bump version to 4.2-3
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-09-10 13:00:11 +02:00
Lorenz Stechauner
d9e7522b56 fix #2721: remove reject tcp 43 from default drop and reject actions
first, '43' is a typo, it should say '113' (if it really is like
legacy shorewall [0]). this tcp port corresponds to the ident or
authentication service protocol.

second, nowdays this reject is not included in shorewall anymore.
furthermore it would make no sense to reject specifically this
one port.

[0] https://gitlab.com/shorewall/code/-/blob/4.6.13/Shorewall/action.Drop#L66
    https://gitlab.com/shorewall/code/-/blob/4.6.13/Shorewall/Macros/macro.Auth

Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
2021-08-06 14:03:52 +02:00
Thomas Lamprecht
dcdbb55932 bump version to 4.2-2
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-06-21 11:31:47 +02:00
Stoiko Ivanov
c7e6b30c81 set sysctls on every apply
setting the sysctls needed on every run should not be too costly
(the original implementation used a `system` invocation, which was
far more expensive), and reduce the chances for side-effects.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2021-05-26 17:31:58 +02:00
Thomas Lamprecht
b5787a56be buildsys: change upload/repo dist to bullseye
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-05-24 11:39:09 +02:00
Thomas Lamprecht
3cab23d0eb d/rules: cleanup systemd overrides
both, `override_dh_systemd_enable` and `override_dh_systemd_start`
are ignored with current compat level 12, and will become an error in
level >= 13, so drop them and use `override_dh_installsystemd` for
both of the previous uses.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-05-24 11:16:11 +02:00
Thomas Lamprecht
ce9cfab89a bump version to 4.2-1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-05-12 20:33:13 +02:00
Thomas Lamprecht
6dfe6a22a0 debian: run wrap-and-sort -abt
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-05-12 20:31:52 +02:00
Thomas Lamprecht
1761e70e54 install pvefw-logger.service in multi-user.target
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-05-12 20:31:52 +02:00
Thomas Lamprecht
156178627c d/control: bump debhelper compat to >= 12
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-05-12 20:22:32 +02:00
Thomas Lamprecht
59992ae7be fw logger: cosmetic fixes
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-05-12 19:58:46 +02:00
Aaron Lauterer
12d3b75f1a fix #967: source: dest: limit length
iptables-restore has a buffer limit of 1024 for paramters [0].

If users end up adding a long list of IPs in the source or dest field
they might reach this limit. The result is that the rule will not be
applied and pve-firewall will show some error in the syslog which will
be "hidden" for most users.

Enforcing a smaller limit ourselves should help to avoid any such
situation. 512 characters should help to not run into any problems that
stem from differences in what counts as character. If people need longer
lists, using IP sets are the better approach anyway.

[0] http://git.netfilter.org/iptables/tree/iptables/xshared.c?h=v1.8.7#n469

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2021-04-22 17:49:44 +02:00
Mira Limbeck
ab9a6ae6fc fix #2358: allow --<opt> in firewall rule config files
The docs mention --<opt> as valid syntax for firewall rules, but the
code that parses the .fw files only accepts -<opt>. To make it
consistent with the docs and the API, also accept --<opt>.

In addition allow 'proto' as option, not only '-p'.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2021-02-22 14:42:23 +01:00