156 Commits

Author SHA1 Message Date
Peter Müller
b8769ed95b logrotate: Rotate wtmp files monthly, and keep them for a year
This prevents "last" being rendered unusable, and allows
for better and faster auditing of previous logins.

Fixes: #13322
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2023-09-15 06:53:43 +00:00
Peter Müller
9826ac9bc2 modules.d: Drop orphaned blacklist statements
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-10-03 10:21:24 +00:00
Peter Müller
5086ed681d sysctl: Permit ptrace usage for processes with CAP_SYS_PTRACE
https://lists.ipfire.org/pipermail/development/2022-June/013763.html

Reported-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-06-29 19:43:08 +00:00
Peter Müller
f62b488f82 sysctl: Actually arm YAMA
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-06-20 20:10:47 +00:00
Peter Müller
84d6e93150 sysctl: For the sake of completeness, do not accept IPv6 redirects
While IPFire 2.x' web interface does not support IPv6, users can
technically run it with IPv6 by conducting the necessary configuration
changes manually.

To provide these systems as well, we should disable acceptance of ICMPv6
redirect packets - which is apparently not default in Linux, yet. :-/

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
2022-06-13 15:48:45 +00:00
Peter Müller
1af975dceb sysctl: Use strict Reverse Path Filtering
The strict mode, as specified in RFC 3704, section 2.2, causes packets
to be dropped by the kernel if they arrive with a source IP address that
is not expected on the interface they arrived in. This prevents internal
spoofing attacks, and is considered best practice among the industry.

After a discussion with Michael, we reached the conclusion that
permitting users to configure the operating mode of RPF in IPFire causes
more harm than good. The scenarios where strict RPF is not usable are
negligible, and the vast majority of IPFire's userbase won't even
notice a difference.

This supersedes <495b4ca2-5a4b-2ffa-8306-38f152889582@ipfire.org>.

Suggested-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Reviewed-by: Adolf Belka <adolf.belka@ipfire.org>
2022-05-02 05:28:52 +00:00
Peter Müller
400c4e8edb Kernel: Block non-UID-0 profiling completely
This is recommended by KSPP, Lynis, and others. Indeed, there is no
legitimate reason why an unprivileged user on IPFire should do any
profiling. Unfortunately, this change never landed in the mainline
kernel, hence a distribution patch is necessary.

The second version of this patch rebases the kernel patch by Jeff
Vander Stoep against Linux 5.15.17 to avoid fuzzying.

Tested-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-04-04 19:58:49 +00:00
Peter Müller
d21e6d94cb sysctl.conf: Enable Loose Reverse Path Filter according to RFC 3704
For historical reasons, we were always reluctant to reverse path
filtering, since configuration changes were tricky to evaluate for a
larger userbase, IPFire permits a number of complex scenarios, and due
to limited resources.

As a compromise, this patch suggests to enable Loose Reverse Path
Filtering, as specified in RFC 3704 (section 2.4), to gain at least some
security achievement on this end.

To quote from that:

   Loose Reverse Path Forwarding (Loose RPF) is algorithmically similar
   to strict RPF, but differs in that it checks only for the existence
   of a route (even a default route, if applicable), not where the route
   points to.  Practically, this could be considered as a "route
   presence check" ("loose RPF is a misnomer in a sense because there is
   no "reverse path" check in the first place).

   The questionable benefit of Loose RPF is found in asymmetric routing
   situations: a packet is dropped if there is no route at all, such as
   to "Martian addresses" or addresses that are not currently routed,
   but is not dropped if a route exists.

There is no legitimate reason why we cannot enable this: If IPFire
receives a packet on some interface it cannot route on _any_ interface
at all, there is no sense in processing it.

While testing this change, I was unable to produce a situation where it
actually causes any harm. In theory, it shouldn't do so anyways.

In the future, we will hopefully be able to set these sysctl's to "1",
using Strict Reverse Path Filtering, as specified in RFC 3704 (section
2.2). Doing so was found to work fine in my testing environment as well,
but there is no asymmetric routing in place there.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-01-19 17:45:04 +00:00
Arne Fitzenreiter
ffd857d098 sysctl: kernel 5.13 has removed some scheduler variables.
sched_min_granularity_ns and sched_migration_cost_ns are not
available for sysctl anymore. They can only altered via debugfs
if scheduler debugging is enabled.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-11-30 09:50:38 +01:00
Michael Tremer
7ae1dcb33e Install sysctl.conf only on those architectures where needed
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-04-11 12:12:56 +00:00
Peter Müller
45022af1b8 sysctl.conf: Turn on BPF JIT hardening, if the JIT is enabled
The second version of this patch splits this up into different
architecture-specific sysctl config files, as i586 does not support BPF
JIT, hence the net.core.bpf_jit_harden does not exist on that
architecture.

Fixes: #12384

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-04-10 13:16:28 +00:00
Michael Tremer
4d622b7ebe sysctl.conf: prevent autoloading of TTY line disciplines
This reverts commit a9d90b1b3f.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-04-06 10:13:38 +00:00
Peter Müller
b474e87bb8 sysctl.conf: include PID in file names of generated core dumps
This is recommended by various Linux hardening guides in order to
prevent accidential overwriting of existing core dumps. While it has
probably little to no relevance to the average IPFire user, enabling it
won't harm and fixes a Lynis warning. :-)

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-11-05 23:37:53 +00:00
Michael Tremer
a9d90b1b3f Revert "sysctl.conf: prevent autoloading of TTY line disciplines"
This reverts commit 14c65ab71c.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-10-06 12:26:26 +00:00
Peter Müller
14c65ab71c sysctl.conf: prevent autoloading of TTY line disciplines
Malicious/vulnerable TTY line disciplines have been subject of some
kernel exploits such as CVE-2017-2636, and since - to put it in Greg
Kroah-Hatrman's words - we do not "trust the userspace to do the right
thing", this reduces local kernel attack surface.

Further, there is no legitimate reason why an unprivileged user should
load kernel modules during runtime, anyway.

See also:
- https://lkml.org/lkml/2019/4/15/890
- https://a13xp0p0v.github.io/2017/03/24/CVE-2017-2636.html

Cc: Arne Fitzenreiter <arne.fitzenreiter@ipfire.org>
Cc: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-10-06 12:04:14 +00:00
Peter Müller
b7b65e736e sysctl.conf: prevent unintentional writes into attacker-controlled files and FIFOs
Similar to hard- and symlink protection introduced a while ago, this
patch enables protections against unintentional writes into
attacker-controlled regular files or FIFOs, where a program expected to
create new ones. This makes exploiting TOCTOU flaws harder.

See also: https://www.kernel.org/doc/Documentation/sysctl/fs.txt

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-10-05 15:07:47 +00:00
Peter Müller
dc5a89c948 sysctl.conf: drop RST packets for sockets in TIME-WAIT state
RFC 1337 describes various TCP (side channel) attacks against
prematurely closed connections stalling in TIME-WAIT state, such as DoS
or injecting arbitrary TCP segments, and recommends to silently discard
RST packets for sockets in this state.

While applications still tied to such sockets should tolerate invalid
input (thanks to Jon Postel), there is little legitimate reason to send
such RST packets altogether.

At the time of writing, no collateral damage related to active RFC 1337
implementations is known. Measuerements in productive environments did
not reveal any side effects either, which is why I consider enabling RFC
1337 implementation to be a safe change.

See also: https://tools.ietf.org/html/rfc1337

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-09-30 17:14:07 +00:00
Arne Fitzenreiter
533c4312fa dhcpcd: create dhcpcd user and chroot folder
dhcpcd 9.x adds privelege seperation by creating a chroot
and running parts of the client not as root.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-04-19 17:27:23 +00:00
Peter Müller
29a8992b72 sysctl.conf: Turn on hard- and symlink protection
Cc: Michael Tremer <michael.tremer@ipfire.org>
Cc: Arne Fitzenreiter <arne_f@ipfire.org>
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Acked-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-03-30 17:07:26 +00:00
Michael Tremer
58b3c9b58a sysctl: Adopt more settings from the IBM HPC guidelines
https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/Welcome%20to%20High%20Performance%20Computing%20%28HPC%29%20Central/page/Linux%20System%20Tuning%20Recommendations

Since we have already configured most of our IP/TCP stack
for low latency and fast throughput, these settings complete
those efforts.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2019-10-14 17:56:30 +00:00
Matthias Fischer
686ada3158 Added Mail log file to '/etc/logrotate.conf'
Fixes Bug #12155: logrotate wasn't set up to rotate this file.

For details see:
https://bugzilla.ipfire.org/show_bug.cgi?id=12155

Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
Acked-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2019-10-08 18:17:06 +00:00
Arne Fitzenreiter
10dd2afd6d sysctl: add seperate sysctl-x86_64.conf and move x86_64 only parameters
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2019-08-08 09:30:49 +02:00
Peter Müller
ef21f3e49d sysctl: improve KASLR effectiveness for mmap
By feeding more random bits into mmap allocation, the
effectiveness of KASLR will be improved, making attacks
trying to bypass address randomisation more difficult.

Changed sysctl values are:

vm.mmap_rnd_bits = 32 (default: 28)
vm.mmap_rnd_compat_bits = 16 (default: 8)

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-07-04 11:22:13 +01:00
Alexander Koch
68d7ae338e apache / WPAD: Add correct MIME type for wpad.dat and proxy.pac
Some clients require the correct MIME type to be set for accepting/handling the Proxy-Settings properly.

See: http://findproxyforurl.com/deploying-wpad/

Signed-off-by: Alexander Koch <ipfire@starkstromkonsument.de>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-04-23 20:19:43 +01:00
Michael Tremer
01604708c3 Merge remote-tracking branch 'stevee/next-suricata' into next 2019-03-14 13:19:35 +00:00
Stefan Schantl
fd378b3b08 Rename snort user and group to suricata
This only affects new installations.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-03-10 18:50:37 +01:00
Michael Tremer
50fcec161c /etc/group: Order groups by ID
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-03-08 10:11:23 +00:00
Michael Tremer
3d0a190843 /etc/passwd: Order users by ID
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-03-08 10:08:02 +00:00
Alexander Koch
06fc6170a2 zabbix_agentd: New addon
New addon for monitoring IPFire by Zabbix Monitoring (https://www.zabbix.com/features).
See https://forum.ipfire.org/viewtopic.php?f=52&t=22039 and https://lists.ipfire.org/pipermail/development/2019-February/005324.html for further details.

Best regards,
Alex

Signed-off-by: Alexander Koch <ipfire@starkstromkonsument.de>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-03-08 09:55:18 +00:00
Michael Tremer
0e28ea9f3e suricata: Log to syslog
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-03-01 17:56:46 +01:00
Michael Tremer
e37e796206 sysctl.conf: Revert enabling busy loop waiting on sockets
This causes the firmware in my ath10k module to crash.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-02-28 18:53:22 +00:00
Stefan Schantl
1ef235f08d logrotate: Rotate suricata logs instead of snort ones
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-02-15 11:22:14 +01:00
Michael Tremer
d03916e558 Enable some performance tuning
These parameters increase the throughput on various (large-ish)
systems by 5-10% on the slight expense of higher power consumption.

Socket buffers are increases and the system is configured to be
less aggressive when scheduling processes from one processor to
another one which ensures that the cache remains "hot" for longer.

On a slower system (apu1d) no performance improvement or loss
could have been measured.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-01-24 12:31:27 +00:00
Michael Tremer
93d516bd70 Revert "Disable Path MTU discovery"
This reverts commit 1c0cfaa594.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-01-17 19:24:46 +00:00
Michael Tremer
f0092a6e3e keepalived: Move change of conntrack sysctl option into package
The setting cannot be set on the default system because the ip_vs
module is not loaded by default and there is no reason to load it
just because we would be able to set the setting.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-01-13 12:50:26 +01:00
Michael Tremer
af2cc3be64 IPVS: Enable connection tracking by default
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-01-06 21:33:43 +00:00
Michael Tremer
3ed2de1251 Merge branch 'haproxy' into next 2018-10-29 11:59:18 +01:00
Michael Tremer
c5494ad098 haproxy: Log to syslog and install logrotate script
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2018-10-22 21:47:05 +02:00
Tim FitzGeorge
dfb985caa9 Allow kernel to swap memory on high demand
Signed-off-by: Tim FitzGeorge <ipfr@tfitzgeorge.me.uk>
Fixes: Bug 11839
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2018-10-18 14:34:33 +01:00
Peter Müller
d5fe332283 do not expose kernel address spaces even to privileged users
Change this setting from 1 to 2 so kernel addresses are not
displayed even if a user has CAPS_SYSLOG privileges.

See also:
- https://lwn.net/Articles/420403/
- https://tails.boum.org/contribute/design/kernel_hardening/

Signed-off-by: Peter Müller <peter.mueller@link38.eu>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2018-09-09 17:47:08 +01:00
Peter Müller
373590b7c3 hide kernel addresses in /proc
Make sure kernel address space is hidden from files somewhere
in /proc . This reduces attack surface and partially addresses #11659.

Signed-off-by: Peter Müller <peter.mueller@link38.eu>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2018-07-03 10:32:56 +01:00
Michael Tremer
a1c5ceeb34 nsswitch.conf: Use nss-myhostname to resolve local hostname
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2018-06-30 19:56:56 +01:00
Arne Fitzenreiter
302dba205b Merge remote-tracking branch 'origin/master' into kernel-4.14 2018-03-30 10:26:01 +02:00
Arne Fitzenreiter
ea9d53c822 inittab: change tty1 to console
this reduce the differences between tty and scon installations
and make it easier to switch between.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2018-03-24 13:26:32 +01:00
Michael Tremer
1c0cfaa594 Disable Path MTU discovery
This seems to be a failed concept and causes issues with transferring
large packets through an IPsec tunnel connection.

This configures the kernel to still respond to PMTU ICMP discovery
messages, but will not try this on its own.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2018-02-26 15:37:49 +00:00
Michael Tremer
2d5940daca Drop MySQL
This is outdated and still on 5.0.x and nobody volunteered to
update this package.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2018-02-12 12:05:46 +00:00
Michael Tremer
56720befc7 Drop vsftpd which isn't actively maintained any more
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-11-28 17:30:08 +00:00
Arne Fitzenreiter
874eabd6f5 serial-console: remove baudrate from inittab
new versions of agetty missinterpretes the baudrate and set it as TERM
without the parameter agetty use the previous rate that was set by the
kernel via console=XXX,Baudrate parameter.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2017-08-15 20:08:22 +02:00
Jonatan Schlag
0f1cda211c Disable netfilter on all bridges per default
Fixes: #11301

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-03-11 10:08:16 +00:00
Michael Tremer
5056b4f104 Drop mldonkey files
The packages has been dropped years ago. However, some
files remained in the source tree.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-01-16 16:53:35 +00:00