Commit Graph

1322 Commits

Author SHA1 Message Date
Arne Fitzenreiter
2ecb278462 unbound: fix dns working check
pool.ipfire.org cannot resolved. Now try both default dns
servers. If one works dns is working.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2022-02-19 15:53:14 +00:00
Peter Müller
926d840fae firewall: Make logging of conntrack INVALIDs configureable
In theory, logging of dropped packets classified by conntrack as being
INVALID should never be disabled, since one wants to have a paper trail
of what his/her firewall is doing.

However, conntrack seems to drop a lot of (at the first glance
legitimate) packets, hence bloating the logs, making spotting the
important firewall hits more difficult.

This patch therefore adds the option to disable logging of packets being
dropped by conntrack due to INVALID state.

Please note:
- This patch does not add this category to the firewall hits graph.
- The variables in this patch ("LOGDROPCTINVALID") should make it clear
  that it is about toggling _logging_, not the actual _dropping_. Other
  variables are still in need of being renamed to clarify this, which
  will be done in a dedicated patch.
- Also, the changes made to update.sh need to take place in
  config/rootfiles/core/164/update.sh for "master", since this patch has
  been developed against "next". Kindly cherry-pick the necessary
  changes.

Partially fixes: #12778

Reported-by: Arne Fitzenreiter <arne.fitzenreiter@ipfire.org>
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-02-19 15:37:16 +00:00
Peter Müller
5c1af49c83 firewall: Add proper logging prefix for conntrack INVALID hits
Fixes: #12778

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-02-19 08:06:36 +00:00
Arne Fitzenreiter
4b94860d07 firewall: Revert strict martian check on loopback interface
If the firewall is talking to itself using one of its private IP
addresses (e.g. the primary green interface IP address), it will use the
loopback interface.

This is due to the local routing table which will be looked up first:

  [root@ipfire ~]# ip rule
  0:      from all lookup local
  128:    from all lookup 220
  220:    from all lookup 220
  32765:  from all lookup static
  32766:  from all lookup main
  32767:  from all lookup default

It contains:

  [root@ipfire ~]# ip route show table local
  local 8x.1x.1x.1x dev ppp0 proto kernel scope host src 8x.1x.1x.1x
  local 127.0.0.0/8 dev lo proto kernel scope host src 127.0.0.1
  local 127.0.0.1 dev lo proto kernel scope host src 127.0.0.1
  broadcast 127.255.255.255 dev lo proto kernel scope link src 127.0.0.1
  local 192.168.x.1 dev green0 proto kernel scope host src 192.168.x.1
  broadcast 192.168.x.255 dev green0 proto kernel scope link src 192.168.x.1

Any lookup for the green IP address will show this:

  local 192.168.x.1 dev lo table local src 192.168.x.1 uid 0
      cache <local>

A test ping shows this in tcpdump:

  [root@ipfire ~]# tcpdump -i any icmp -nn
  tcpdump: data link type LINUX_SLL2
  tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
  listening on any, link-type LINUX_SLL2 (Linux cooked v2), snapshot length 262144 bytes
  17:24:22.864293 lo    In  IP 127.0.0.1 > 127.0.0.1: ICMP echo request, id 10420, seq 1, length 64
  17:24:22.864422 lo    In  IP 127.0.0.1 > 127.0.0.1: ICMP echo reply, id 10420, seq 1, length 64
  17:24:29.162021 lo    In  IP 192.168.x.1 > 192.168.x.1: ICMP echo request, id 1555, seq 1, length 64
  17:24:29.162201 lo    In  IP 192.168.x.1 > 192.168.x.1: ICMP echo reply, id 1555, seq 1, length 64

For this reason, we will have to accept any source and destination IP
address on the loopback interface, which is what this patch does.

We can however, continue to check whether we received any packets with
the loopback address on any other interface.

This regression was introduced in commit a36cd34e.

Fixes: #12776 - New spoofed or martian filter block
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2022-02-14 19:47:37 +00:00
Arne Fitzenreiter
5462658ea0 firewall: fix missing space
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2022-02-12 18:06:39 +00:00
Arne Fitzenreiter
5b0eca9528 firewall: initialize IFACE if it is empty
at first boot there is no IFACE set which result in iptables
errors at boot.

fixes #12767

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2022-02-12 18:00:09 +00:00
Arne Fitzenreiter
2f3af8c0c4 partresize: fix/add more NanoPi R* whitspaces
this fix MAC address generation on R2S
and allow to use the new added overclocked dtb's for R2S and R4S.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2022-02-12 07:04:17 +00:00
Peter Müller
816b0e08c6 firewall: Ensure the xt_geoip module is always loaded
For some reason, this module is not present after the very first boot of
an IPFire installation.

Fixes: #12767

Reported-by: Arne Fitzenreiter <arne_f@ipfire.org>
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2022-02-10 07:03:01 +00:00
Peter Müller
bc176927e4 Merge branch 'next' into temp-c164-development 2022-01-30 13:18:50 +00:00
Arne Fitzenreiter
6b184642d2 leds: fix R4S sys led name at shutdown
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2022-01-30 08:50:22 +00:00
Arne Fitzenreiter
75c9d8c20c u-boot: add/fix NanoPi R2S and R4S
-update arm-trusted firmware to 2.6
-fix mac address generation on R2S because the CPUID fuses are not uniqe
-add support for NanoPi R4S

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2022-01-29 20:32:02 +00:00
Arne Fitzenreiter
75ccf29897 initskript leds: add NanoPi R4S
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2022-01-29 20:31:12 +00:00
Peter Müller
37a9a0ba03 firewall: Align chain name to Collectd configuration
This fixes broken firewall hits graphs.

Cc: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-01-29 17:59:31 +00:00
Peter Müller
92c53b3e0a firewall: Always initialise DROP_HOSTILE chain, even if it's unused
This ensures collectd can keep track of it, and generate the RRD graphs
correctly.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-01-29 15:56:54 +00:00
smooky@v16.de
df0635abb5 New Addons: qemu-ga 6.0.1 second try
>>> https://www.qemu.org/ <<<

source = https://download.qemu.org/qemu-6.0.1.tar.xz

Hi @ all

I have the addon qemu-ga for people who virtualize IPFire and to read the status
without having to install the whole qemu package.
Modified following Michael's suggestions.

Signed-off-by: Marcel Follert (Smooky) <smooky@v16.de>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
2022-01-18 21:26:56 +00:00
Peter Müller
97154d057b firewall: Introduce DROP_HOSTILE
Similar to the Location block, this chain logs and drops all traffic
from and to networks known to pose technical threats to IPFire users.

Doing so in a dedicated chain makes sense for transparency reasons, as
we won't interfer with other firewall rules or the Location block, so it
is always clear why a packet from or to such a network has been dropped.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-01-14 14:16:43 +00:00
Peter Müller
e83ae0d434 firewall: Prevent spoofing our own RED IP address
There is no legitimate reason why traffic from our own IP address on RED
should ever appear incoming on that interface.

This prevents attackers from impersonating IPFire itself, and is only
cleared/reset if the RED interface is brought up. Therefore, an attacker
cannot bypass this by foring a dial-up or DHCP connection to break down.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-01-14 14:16:39 +00:00
Peter Müller
a36cd34eac firewall: Log and drop spoofed loopback packets
Traffic from and to 127.0.0.0/8 must only appear on the loopback
interface, never on any other interface. This ensures offending packets
are logged, and the loopback interface cannot be abused for processing
traffic from and to any other networks.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-01-14 14:16:34 +00:00
Peter Müller
4d25c1f39a firewall: Accept inbound Tor traffic before applying the location filter
Inbound Tor traffic conflicts with Location block as inbound connections
have to be accepted from many parts of the world. To solve this,
inbound Tor traffic has to be accepted before jumping into Location block
chain.

Note this affects Tor relay operators only.

Rolled forward as ongoing from
https://patchwork.ipfire.org/project/ipfire/patch/f8ee2e1d-b642-8c63-1f8a-4f24c354cd90@ipfire.org/,
note the documentation in the wiki needs to be updated once this landed
in production.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-01-14 14:16:29 +00:00
Peter Müller
0e7bfb1343 firewall: Log packets dropped due to conntrack INVALID state
In case of faulty connection tracking, this ensures such packets are
logged, to make analysing network incidents less troublesome. Since
NewNotSYN is handled before, where logging can be turned off for systems
running on weak flash devices, the amount of log messages emitted here
should be neglectible.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-01-14 14:16:24 +00:00
Matthias Fischer
96b9c63b57 squid 5.1: set max number of filedesriptors to 32768
Since the maximum number of filedescriptors which are possible for 'squid 5.1'
are now 32768, I modified the initscript accordingly.

Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
Acked-by: Peter Müller <peter.mueller@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
2022-01-14 13:58:31 +00:00
Michael Tremer
6cf219c427 Drop support for i586
This patch removes support for i586 according to the decision being
taken over a year ago.

It removes the architecture from the build system and removes all
required hacks and other quirks that have been necessary before.

There is no need to ship any changed files to the remaining
architectures as the removed code branches have not been used.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-12-04 23:27:26 +01:00
Arne Fitzenreiter
11a3bd4898 mountkernfs: fix typo (wrong space character)
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-11-30 13:51:13 +01:00
Michael Tremer
91a29ffc16 firewall: Remove unused CONNTRACK chain in raw table
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Acked-by: Peter Müller <peter.mueller@ipfire.org>
2021-11-24 09:17:38 +00:00
Arne Fitzenreiter
cd26578fc9 unbound: initskript change server for dns test
if the system time is incorrect DNSSec validation fail but it fails sometimes for pool.ntp.org already but not for ping.ipfire.org.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-11-24 07:44:14 +00:00
Michael Tremer
76050bdcf2 mountkernfs: Mount /sys/firmware/efi/efivars on EFI systems
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
2021-11-19 07:08:48 +01:00
Peter Müller
52764dbe7f Tell pppd not to ask for IPv6 addresses during dial-up
pppd 2.4.9 supports IPv6 and asks for an IPv6 configuration by default.
Setting the received prefix in the kernel will never work, however, as
the rest of IPFire 2.x does not support IPv6.

pppd notices the ISP about this, and at least Otenet (GR) and British
Telecom (several countries) decide to close a dial-up connection then.
German DTAG seems to ignore such errors silently.

This patch adds an option to the pppd call to prevent asking for an
IPv6 configuration, hence avoiding this errors.

To apply this patch, it is necessary to ship ppp 2.4.9 again. Since I
have no access to a testing machine behind an ISP supporting IPv6, this
patch unfortunately is untested.

Fixes: #12651

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-10-22 10:54:21 +00:00
Arne Fitzenreiter
e850a61429 firewall: replace mark with --pol ipsec to exclude ipsec traffic from masquerade
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-10-19 18:27:49 +00:00
Michael Tremer
19357bc55e firewall: Keep REPEAT bit when saving rest to CONNMARK
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Tested-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-10-19 11:35:28 +00:00
Michael Tremer
3fa8300e70 suricata: Introduce IPSBYPASS chain
NFQUEUE does not let the packet continue where it was processed, but
inserts it back into iptables at the start. That is why we need an
extra IPSBYPASS chain which has the following tasks:

* Make the BYPASS bit permanent for the entire connection
* Clear the REPEAT bit

The latter is more of cosmetic nature so that we can identify packets
that have come from suricata again and those which have bypassed the IPS
straight away.

The IPS_* chain will now only be sent traffic to, when none of the two
relevant bits has been set. Otherwise the packet has already been
processed by suricata in the first pass or suricata has decided to
bypass the connection.

This massively reduces load on the IPS which allows many common
connections (TLS connections with downloads) to bypass the IPS bringing
us back to line speed.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Tested-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-10-19 11:35:04 +00:00
Michael Tremer
2469ca9fba suricata: Store bypass flag in connmark and restore
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Tested-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-10-19 11:34:54 +00:00
Michael Tremer
49dd3e2946 suricata: Add rule to skip IPS if a packet has the bypass bit set
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Tested-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-10-19 11:34:43 +00:00
Michael Tremer
855475580b suricata: Always append rules instead of inserting them
This allows us to add rules in a consistent order like they are in the
script.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Tested-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-10-19 11:34:32 +00:00
Michael Tremer
11f7218f9c suricata: Define bypass mark
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
Tested-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-10-19 11:34:10 +00:00
Michael Tremer
4f07c279a0 suricata: Rename MARK/MASK to REPEAT_MARK/REPEAT_MASK
This should avoid confusion when we add more marks

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
Tested-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-10-19 11:34:00 +00:00
Michael Tremer
761fadbdde suricata: Set most significant bit as repeat marker
I have no idea why some odd value was chosen here, but one bit should be
enough.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
Tested-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-10-19 11:33:47 +00:00
Michael Tremer
a09578f4eb OCI: Enable serial console by default
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-10-19 11:21:57 +00:00
Adolf Belka
9f9d0974f0 client175: Removal of this package as it currently only works with python2
- Removal of the lfs, rootfile and initscript
- Removal of client175 entry in the make.sh file

Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-10-13 12:09:09 +00:00
Michael Tremer
51c4b73f7a IPsec: Replace MARK 50 by 0x00800000
This change is necessary because we are using the right-hand two bytes
for storing the QoS classes.

All IPsec traffic will now be skipped and never classified by the QoS.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-10-13 11:47:27 +00:00
Michael Tremer
c825fcef40 firewall: Always restore all connection marks
This was done by tc only when QoS was enabled

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-10-13 11:46:23 +00:00
Michael Tremer
ce31144c62 firewall: Only check relevant bits for NAT fix rules
In order to use the highest two bits for surciata bypass, we will need
to make sure that whenever we compare any other marks, we do not care
about anything else.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-10-13 11:45:48 +00:00
Arne Fitzenreiter
02fadedf8d initskrips: leds: add nanopi r2s support 2021-10-10 06:45:09 +00:00
Arne Fitzenreiter
3c691bcc7c Revert "client175: Convert python2 modules in source tarball to python3"
This reverts commit 6d11cd4375.

At my tests the server will not start because missing deps of cherrypy and not all files are properly converted yet.
2021-09-12 14:51:10 +00:00
Adolf Belka
6d11cd4375 client175: Convert python2 modules in source tarball to python3
- Patch created to convert all python modules to python3 compatibility that need it.
   2to3 converter used for this.
- Start initscript changed to use python3
- No change required in rootfile
- Execution of patch added to lfs file
- Tested in vm machine. WUI page showed the same as with the python version.
   scan of directory for mp3 (.flac) files was successful. Could not test actual audio
   playing capability as my vm testbed does not have any audio setup at this time.
  I believe that the purpose of client175 is to provide the WUI page and for that my
   testing seemed to show everything working as expected.

Tested-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-09-05 18:00:25 +00:00
Michael Tremer
0c7ba6523f initscripts: Add switch to start processes in background
Since systemd, many programs no longer behave like a well-behaved
daemon. To avoid any extra solutions, this patch adds a -b switch which
will start a program in the background and throw away any output.

The behaviour remains unchanged for any other programs.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-09-05 17:39:14 +00:00
Michael Tremer
f8447c9d23 dbus: Add reload to initscript
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-07-23 06:15:23 +00:00
Michael Tremer
40a3053a67 libvirtd: Enable required cgroups
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-07-19 18:13:55 +00:00
Michael Tremer
10a2b80cce mountkernfs: Mount cgroup2 hierarchy
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-07-19 18:13:46 +00:00
Michael Tremer
618b9f3a76 aws: Enable serial console by default
AWS for some time now has a serial console feature which is enabled by
default on all systems. The VGA console is not enabled for any new
non-x86 instance types and not interactive.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-07-14 08:24:30 +00:00
Arne Fitzenreiter
1746b394f3 firewall: remove conntrack_gre helper
this is not exist in kernel-5.10

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-07-05 07:42:40 +02:00