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

855 Commits

Author SHA1 Message Date
Stoiko Ivanov
2549e7ef48 rename ebtables_enable to ebtables
and register ebtables option with the API

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2018-06-06 15:51:43 +02:00
Wolfgang Bumiller
423b86effc bump version to 3.0-10
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-05-29 15:14:43 +02:00
Wolfgang Bumiller
d4a23c880d typo fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-05-29 15:08:25 +02:00
Stoiko Ivanov
84025e9943 Don't change external ebtables rules
* Fixes #1764
  * Introduces ebtables_enable option to cluster config
  * All ebtables chains not created by PVE are left in place
  * get_ruleset_status optionally takes an additional argument
    (a regex indicating which chains should be left intact)

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2018-05-29 15:00:42 +02:00
Wolfgang Bumiller
567e58ce1b bump version to 3.0-9
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-05-17 14:41:40 +02:00
Wolfgang Bumiller
518f67dcda fix PVEFW-FORWARD chain not being used
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-05-17 13:09:23 +02:00
Wolfgang Bumiller
ea0d59edd2 bump version to 3.0-8
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-04-11 14:26:15 +02:00
Wolfgang Bumiller
fc1f1de97e ebtables_get_chains: deal with empty chains
Since we don't have signatures in ebtables we need to also
see empty chains to not think we have to create them.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Tested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-03-29 09:55:10 +02:00
Wolfgang Bumiller
f706def5ce add ebtables dependency
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Tested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-03-28 11:35:06 +02:00
Wolfgang Bumiller
1205831a68 avoid double spaces in ruleset_addrule
ebtables doesn't have comment rules we could store the
digest in, so we need to match the ebtables-save output
instead.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Tested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-03-28 11:35:06 +02:00
Alexandre Derumier
151c209e05 apply ebtables_ruleset
need ebtables-save && ebtables-restore,  ebtables debian package don't include them.

ebtables-restore need to restore the full ruleset (atomicaly),
so we can't update only 1 chain

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Tested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-03-28 11:35:06 +02:00
Alexandre Derumier
c5e8b0088f compile ebtables rules
-A FORWARD -j PVEFW-FORWARD
   -A PVEFW-FORWARD -p IPv4 -j ACCEPT  #filter mac in iptables for ipv4, so we can speedup rules with conntrack established
   -A PVEFW-FORWARD -p IPv6 -j ACCEPT
   -A PVEFW-FORWARD -o fwln+ -j PVEFW-FWBR-OUT
	-A PVEFW-FWBR-OUT -i tap110i0 -j tap110i0-OUT
		-A tap110i0-OUT -s ! 36:97:15:91:19:3c -j DROP
		-A tap110i0-OUT -p ARP -j ACCEPT
		-A tap110i0-OUT -j DROP
		-A tap110i0-OUT -j ACCEPT
	-A PVEFW-FWBR-OUT -i veth130.1 -j veth130.1-OUT
		-A veth130.1-OUT -s ! 36:95:a9:ae:f5:ec -j DROP
		-A veth130.1-OUT -j ACCEPT

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Tested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-03-28 11:35:06 +02:00
Wolfgang Bumiller
d50f24ea6d /etc/services can also define 'sctp' services
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Tested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-03-28 11:35:06 +02:00
Wolfgang Bumiller
b452ea100a add get_etc_ethertypes
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Tested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-03-28 11:35:06 +02:00
Wolfgang Bumiller
d6dd6e96e4 parse_protocol_file: support lines without end comments
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Tested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-03-28 11:35:06 +02:00
Wolfgang Bumiller
58bc569d63 split parser out of get_etc_protocols
Into a reusable parse_protocol_file.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Tested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-03-28 11:35:06 +02:00
Wolfgang Bumiller
9a19ec817c bump version to 3.0-7
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-03-12 14:58:43 +01:00
Fabian Grünbichler
3dffed4c43 multiport: add explaining comment
about ordering single port matches before multiport matches,
and improve readability by adding some blank lines after returns.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2018-03-12 12:48:33 +01:00
Wolfgang Bumiller
f776d6de57 fix and improve multiport handling
The multiport `--ports` parameter is an `OR` match on source
and destination ports, so we should not use it.

We also don't actually use the port count, so let the port
range parser simply return a boolean and use the counter
only for the internal check. This also fixes a regression
caused by the previous multiport check which caused a single
port range to be recognized as a multiport option while it
did not have to be one, causing entries such as the SMB
macro to be added with `--match multiport` mistakenly, which
refused to accept the source port option.

Additionally, we now allow the case with 1 multiport and 1
single port entry: In order for the iptables command to
accept this the single port entry must come first, otherwise
it'll be passed to the multiport matcher (because why
shouldn't it interpret a singular `--Xport` as an alias to
the plural version `--Xports`... *sigh*).

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Fixes: 6a241ca745 ("check multiport limit in port ranges")
2018-03-12 12:24:37 +01:00
Dietmar Maurer
8c41d44438 bump version to 3.0-6 2018-03-08 13:53:54 +01:00
Fabian Grünbichler
4382be0afe build: use git rev-parse for GITVERSION
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2018-03-08 13:51:25 +01:00
Fabian Grünbichler
3309bfc87c debian: remove duplicate dh_systemd_enable code
dh_systemd_enable already includes this snippet via the #DEBHELPER#
stanza, no need to duplicate it manually.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2018-03-08 13:51:05 +01:00
Fabian Grünbichler
44e8ce0d15 debian: drop preinst
the only actual code was for upgrading from PVE 3 to PVE 4..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2018-03-08 13:50:49 +01:00
Fabian Grünbichler
04e57cde93 debian: switch to compat 9
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2018-03-08 13:50:29 +01:00
Fabian Grünbichler
d45e3dc0c6 debian: drop init scripts
and switch to plain dh_systemd_*

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2018-03-08 13:50:18 +01:00
Fabian Grünbichler
2361540014 fix #1319: don't fail postinst with masked service
by using "try-reload-or-restart" instead of "reload-or-restart"

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2018-03-08 13:49:04 +01:00
Wolfgang Bumiller
6a241ca745 check multiport limit in port ranges
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-03-08 12:18:20 +01:00
Wolfgang Bumiller
4299c35fc5 bump version to 3.0-5
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2017-12-07 08:31:53 +01:00
Wolfgang Bumiller
7a5a402b56 honor disabled flag on group rules again
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2017-12-07 08:30:01 +01:00
Wolfgang Bumiller
a19d4127e8 bump version to 3.0-4
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2017-11-16 11:42:37 +01:00
Dominik Csapak
53bbbf31e7 sort ipsets so that the digest is consistent
otherwise, editing an ipset randomly works (or not) due to
a wrong digest

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-11-15 13:13:54 +01:00
Tom Weber
bf2fa11471 remove ruleset_generate_match, ruleset_generate_action
ruleset_generate_match and ruleset_generate_action not used anymore

Signed-off-by: Tom Weber <pve@junkyard.4t2.com>
2017-10-19 08:00:17 +02:00
Tom Weber
61221d8971 remove unused ruleset_generate_rule_insert
Signed-off-by: Tom Weber <pve@junkyard.4t2.com>
2017-10-19 08:00:17 +02:00
Tom Weber
2dc0a26e26 cleanup parameters to ruleset_generate_rule
remove $actions and $goto - not used anymore

Signed-off-by: Tom Weber <pve@junkyard.4t2.com>
2017-10-19 08:00:17 +02:00
Tom Weber
180da76c1e rule_substitude_action, remove ruleset_generate_rule_old
implement rule_substitude_action
eliminate use of ruleset_genereate_rule_old and remove it

Signed-off-by: Tom Weber <pve@junkyard.4t2.com>
2017-10-19 08:00:17 +02:00
Tom Weber
0e0432e2eb remove unused ruleset_generate_cmdstr
Signed-off-by: Tom Weber <pve@junkyard.4t2.com>
2017-10-19 08:00:17 +02:00
Tom Weber
30c390f940 implement ipt_rule_to_cmds, ruleset_add_ipt_cmd
ipt_rule_to_cmds converts a %rule to an array of iptables commands
ruleset_add_ipt_cmd adds such an iptables command to a chain
ruleset_generate_rule uses these now
ruleset_generate_rule_old is an interim workaround

Signed-off-by: Tom Weber <pve@junkyard.4t2.com>
2017-10-19 08:00:17 +02:00
Tom Weber
a44cb745ec iptables address matching in own subroutine
put generation of iptables source/destination address matching
in own subroutine and use this in ruleset_generate_match

Signed-off-by: Tom Weber <pve@junkyard.4t2.com>
2017-10-19 08:00:17 +02:00
Tom Weber
e4882cff46 eliminate unused nbdport in pve_std_chains_conf
Signed-off-by: Tom Weber <pve@junkyard.4t2.com>
2017-10-19 08:00:17 +02:00
Tom Weber
cfd7cd9caa make $pve_std_chains a copy of $pve_std_chains_conf
create a new $pve_std_chains with $pve_std_chains_conf as template on
every compilation of the rules. This avoids persitant changes to the
$pve_std_chains and makes it easier to read the std_chains configuration
from external config files (later to implement).

Signed-off-by: Tom Weber <pve@junkyard.4t2.com>
2017-10-19 08:00:17 +02:00
Tom Weber
044409e5b4 convert string based rule definitions to hashes
also extending %rule with log,logmsg,match,target

Signed-off-by: Tom Weber <pve@junkyard.4t2.com>
2017-10-19 08:00:17 +02:00
Tom Weber
7f7930f8cf integrate logging into ruleset_addrule
Signed-off-by: Tom Weber <pve@junkyard.4t2.com>
2017-10-19 08:00:17 +02:00
Tom Weber
1e9c50707a prepare code for more generic firewall logging
making ruleset generation aware of a match and action
part in iptable rules.
code will generate the same iptables as before! (except for
a few additional spaces between match and action).

Signed-off-by: Tom Weber <pve@junkyard.4t2.com>
2017-10-19 08:00:17 +02:00
Tom Weber
ce0d17dd7d remove unused $rule_format
Signed-off-by: Tom Weber <pve@junkyard.4t2.com>
2017-10-19 08:00:17 +02:00
Philip Abernethy
02ecc1827e Use run_cli_handler instead of deprecated run_cli 2017-10-18 15:21:26 +02:00
Fabian Grünbichler
dc4b58b5c6 pvefw-logger: fix typo 2017-10-17 14:24:27 +02:00
Fabian Grünbichler
9ec74c4432 build: reformat debian/control
using wrap-and-sort -abt
2017-10-04 11:05:33 +02:00
Wolfgang Bumiller
c0c71b1bf7 bump version to 3.0-3 2017-09-12 14:43:13 +02:00
Wolfgang Bumiller
f15b772b20 buildsys: clean: remove .buildinfo files 2017-09-06 09:35:04 +02:00
Wolfgang Bumiller
2388cab121 Fix #1492: logger: print timestamps only if we have one
There's no guarantee that there's a timestamp in an skb, so
nflog_get_timestamp can fail.
2017-09-04 12:39:27 +02:00