Commit graph

587 commits

Author SHA1 Message Date
Shawn Webb
33bc3d9fd9
HBSD: Enable SEGVGUARD by default
HardenedBSD still has SEGVGUARD in opt-in mode by default. OPNsense
needs to have this as opt-out by default.

Signed-off-by:	Shawn Webb <shawn@opnsense.org>
2018-11-04 18:35:44 -05:00
Franco Fichtner
4b21e5691f HBSD: on i386 RWX pages were RX only
Submitted by: @lattera
2018-11-01 07:52:00 +01:00
kp
ea449cda0d MFC r334375, r334379:
pf: Replace rwlock on PF_RULES_LOCK with rmlock

Given that PF_RULES_LOCK is a mostly read lock, replace the rwlock with rmlock.
This change improves packet processing rate in high pps environments.
Benchmarking by olivier@ shows a 65% improvement in pps.

While here, also eliminate all appearances of "sys/rwlock.h" includes since it
is not used anymore.

Submitted by:   farrokhi@
2018-10-21 19:12:25 +02:00
kp
4f962c3331 MFC r337969:
pf: Limit the maximum number of fragments per packet

Similar to the network stack issue fixed in r337782 pf did not limit the number
of fragments per packet, which could be exploited to generate high CPU loads
with a crafted series of packets.

Limit each packet to no more than 64 fragments. This should be sufficient on
typical networks to allow maximum-sized IP frames.

This addresses the issue for both IPv4 and IPv6.

Security:	CVE-2018-5391
Sponsored by:	Klara Systems
2018-10-21 19:11:41 +02:00
kp
6f1207f710 MFC r335816:
pfsync: Fix state sync during initial bulk update

States learned via pfsync from a peer with the same ruleset checksum were not
getting assigned to rules like they should because pfsync_in_upd() wasn't
passing the PFSYNC_SI_CKSUM flag along to pfsync_state_import.

PR:		229092
Submitted by:	Kajetan Staszkiewicz <vegeta tuxpowered.net>
Obtained from:	OpenBSD
Sponsored by:	InnoGames GmbH
2018-10-21 19:11:35 +02:00
eugen
4ab5484a83 MFC r336195: unbreak dhclient(8) option 26 processing
Make dhclient(8) verify if new MTU (option 26) differs from current one
  and skip unneeded MTU change. This check eliminates infinite loop
  of MTU change / link flap / lease verification / MTU change / link flap etc.
  in case of some NIC drivers like em(4) or igb(4).

PR:		229432
Approved by:	mav (mentor)
2018-10-21 17:59:42 +02:00
Franco Fichtner
700c1a0421 hn: do not discard UDP6 traffic
Taken from: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231797
2018-10-18 09:19:31 +02:00
ygy
f877f7754e Add description, parameters, options, sysctl and examples of using AQMs to ipfw man page. CoDel, PIE, FQ-CoDel and FQ-PIE AQM for Dummynet exist in FreeBSD 11 and 10.3.
Submitted by:	ralsaadi@swin.edu.au
Reviewed by:	AllanJude
Approved by:	re (gjb)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D12507
2018-10-16 21:11:10 +02:00
Franco Fichtner
725649d96a pkg: better fix, keep vanilla file, but don't install 2018-10-11 10:34:02 +02:00
Franco Fichtner
2e287ab695 pkg: three is a crowd
When we have three repos, even if two are disabled, the pkg upgrade
output changes and breaks our backend scanning code...
2018-10-11 09:38:04 +02:00
Franco Fichtner
00ba3b2c52 i386: remove stale imgact_linux.c reference 2018-10-08 12:41:38 +02:00
Franco Fichtner
08c4bc7bbc Revert "dwatch: do not install"
This reverts commit a3d6a45820.
Magic undocumented characters in libarchive can fix this elsewhere.
2018-10-08 09:39:48 +02:00
Franco Fichtner
a3d6a45820 dwatch: do not install
PR: https://github.com/libarchive/libarchive/issues/1071
2018-10-08 08:04:47 +02:00
Franco Fichtner
8a0fbbb6a9 HBSD: missed this, prints on OPNsense boot 2018-10-08 00:24:32 +02:00
Franco Fichtner
8ba72fd134 apuled: import APU 1-3 LED kernel module
Taken from: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=189772
PR: https://github.com/opnsense/core/issues/2114
2018-10-07 20:23:44 +02:00
gordon
4a1c7d28db Fix small kernel memory disclosures. [EN-18:12.mem]
Reported by:	Thomas Barabosch, Fraunhofer FKIE
Approved by:	so
Security:	FreeBSD-EN-18:12.mem
Security:	CVE-2018-17155
2018-10-07 19:52:59 +02:00
gordon
f90dc93b2a Fix DoS in listen syscall over IPv6 socket. [EN-18:11.listen]
Reported by:	Jakub Jirasek, Secunia Research at Flexera
Approved by:	so
Security:	FreeBSD-EN-18:11.listen
Security:	CVE-2018-6925
2018-10-07 19:52:59 +02:00
gordon
59ae05f60d Fix NULL pointer dereference in freebsd4_getfsstat. [EN-18:10.syscall]
Reported by:	Thomas Barabosch, Fraunhofer FKIE
Approved by:	so
Security:	FreeBSD-EN-18:10.syscall
Security:	CVE-2018-17154
2018-10-07 19:52:59 +02:00
gordon
83e734ed29 Fix regression in IPv6 fragment reassembly. [EN-18:09.ip]
Approved by:	so
Security:	FreeBSD-EN-18:09.ip
2018-10-07 19:52:59 +02:00
gordon
2b2d381a57 Fix regression in Lazy FPU remediation. [EN-18:08.lazyfpu]
Approved by:	so
Security:	FreeBSD-EN-18:08.lazyfpu
2018-10-07 19:52:35 +02:00
gordon
178d83e5a0 Fix improper elf header parsing. [SA-18:12.elf]
Approved by:	so
Security:	FreeBSD-SA-18:12.elf
Security:	CVE-2018-6924
2018-10-07 19:52:35 +02:00
delphij
aad223b461 Revis manual pages. [SA-18:08.tcp]
Fix L1 Terminal Fault (L1TF) kernel information disclosure.
[SA-18:09.l1tf]

Fix resource exhaustion in IP fragment reassembly. [SA-18:10.ip]

Fix unauthenticated EAPOL-Key decryption vulnerability.
[SA-18:11.hostapd]

Approved by:	so
2018-10-07 19:52:35 +02:00
delphij
d039d53b5a Bump patch level and document them.
Approved by:	so
2018-10-07 19:52:35 +02:00
jtl
be4dd13c69 Address concerns about CPU usage while doing TCP reassembly.
Currently, the per-queue limit is a function of the receive buffer
size and the MSS.  In certain cases (such as connections with large
receive buffers), the per-queue segment limit can be quite large.
Because we process segments as a linked list, large queues may not
perform acceptably.

The better long-term solution is to make the queue more efficient.
But, in the short-term, we can provide a way for a system
administrator to set the maximum queue size.

We set the default queue limit to 100.  This is an effort to balance
performance with a sane resource limit.  Depending on their
environment, goals, etc., an administrator may choose to modify this
limit in either direction.

Approved by:	so
Security:	FreeBSD-SA-18:08.tcp
Security:	CVE-2018-6922
2018-10-07 19:52:35 +02:00
Franco Fichtner
e93c17aa0e vlan: do not protect PCP write with the sysctl
pf will unconditionally "set prio", so this will fail if the
sysctl is off.  The sysctl, however, introduces a side-effect
so we would rather keep the default behaviour.  The allocation
slowdown is already taking place, so this in the worst case
only adds a list traversal / lookup.

PR: https://forum.opnsense.org/index.php?topic=6714.0
2018-10-07 19:31:00 +02:00
Franco Fichtner
ed39d84826 pf/ipfw/netinet[6]: IP forwarding rework, fixes IPv4 in pf(4)
Based on feedback by countless users, this removes the if_output
calls in the pf code that escape pfil processing in IPv4 by going
the long way.

In our 11.1 iteration ip_tryforward() is easy to port and while
we are at it we shall also tackle IPv6.  :)

11.2 update adds all recent fixes into this single commit.

Many thanks to Andrey V. Elsukov (ae@) for giving this direction
and review.

Also see: https://reviews.freebsd.org/D8877
2018-10-07 19:24:22 +02:00
Shawn Webb
7e435c13fa HBSD: Bring in libarchive/libarchive@c246ec5d05
This fixes an out-of-bounds read vulnerability in libarchive.

Signed-off-by:	Shawn Webb <shawn.webb@hardenedbsd.org>
Sponsored-by:	SoldierX
MFC-to:		11-STABLE
2018-10-07 18:56:07 +02:00
Franco Fichtner
15acb2f544 sft: merge pfSense stf additions not in FreeBSD
Includes later fixes in OPNsense 18.7 while reworking it for 19.1.

Taken from: https://github.com/pfsense/FreeBSD-src/tree/RELENG_2_4
2018-10-07 18:56:07 +02:00
loos
c396d00980 After the in_control() changes in r257692, an existing address is
(intentionally) deleted first and then completely added again (so all the
events, announces and hooks are given a chance to run).

This cause an issue with CARP where the existing CARP data structure is
removed together with the last address for a given VHID, which will cause
a subsequent fail when the address is later re-added.

This change fixes this issue by adding a new flag to keep the CARP data
structure when an address is not being removed.

There was an additional issue with IPv6 CARP addresses, where the CARP data
structure would never be removed after a change and lead to VHIDs which
cannot be destroyed.

Reviewed by:	glebius
Obtained from:	pfSense
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC (Netgate)
2018-10-07 18:53:35 +02:00
Franco Fichtner
8601775556 dhclient: VLAN priority support
These changes are based on the dhclient used in pfSense 2.3, which
seems not to have made it into FreeBSD 11 as used in pfSense 2.4.

To be able to add a VLAN priority to a DHCP request the following
must be added to the config:

interface "em1_vlan123" {
    vlan-parent "em1";
    vlan-id 123;
    vlan-pcp 6;
}

Extensive (and annoying) care has been taken WRT keeping the BPF
write filter functional for security reasons.

Based on a submission by Martin Wasley <martin@queens-park.com>.
2018-10-07 18:53:14 +02:00
Franco Fichtner
affaa76ca1 re: update to vendor version 1.95
Taken from: http://www.realtek.com
2018-10-07 18:52:33 +02:00
Shawn Webb
914a40efa5 HBSD+OPNsense: Set hardening.pax.disallow_map32bit.status=1 by default
LuaJIT creates 32-bit memory maps in a 64-bit execution environment,
which is disabled by default in HardenedBSD. We never ported the
MAP_32BIT disallow logic over from HardenedBSD to OPNsense prior to
18.1. The merge of HardenedBSD's ASLR implementation for 18.1 also
brought in the new logic.

Instead of removing disallow_map32bit, simply set it to 1 by default.
This will allow those who don't use LuaJIT applications to set it to 2
in /boot/loader.conf.local.

Note that this commit is specific to OPNsense. OPNsense ships without
the PAX_SYSCTLS kernel option, thus it's impossible to toggle via
sysctl.conf(5) and must be set via loader.conf.local.

Signed-off-by:	Shawn Webb <shawn@opnsense.org>
github-issue:	opnsense/plugins#466
2018-10-07 17:50:23 +02:00
cem
b9ad047e72 dhclient(8): Enable numbered user class ID option
By adding it to the option priorities table.

PR:		184117
Submitted by:	Lowell Gilbert <freebsd-bugs-local at be-well.ilk.org>
Reported by:	Tomek CEDRO <cederom at tlen.pl>
Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D7911
2018-10-07 17:49:53 +02:00
kp
3df82065cb pf: port extended DSCP support from OpenBSD
Ignore the ECN bits on 'tos' and 'set-tos' and allow to use
DCSP names instead of having to embed their TOS equivalents
as plain numbers.

Obtained from:	OpenBSD
Sponsored by:	OPNsense
Differential Revision:	https://reviews.freebsd.org/D8165
2018-10-07 17:46:54 +02:00
Franco Fichtner
0595c8c3c1 rtsold: pass sending router address to other script as well
Partially based on an old pfSense modification that never made it
to FreeBSD upstream.

See: https://github.com/fichtner/pfsense-tools/commit/2a78e6483
2018-10-07 17:45:20 +02:00
Franco Fichtner
eb82903353 dhclient: support supersede statement for option 54
Submitted by: Fabian Kurtz <fabian.kurtz@udo.edu>
2018-10-07 17:43:23 +02:00
Franco Fichtner
c689ecc1ec run: add AE3000 and AE6000; closes #17 2018-10-07 17:43:08 +02:00
loos
9b7ed4d3ef The stf(4) interface name does not conform with the default naming
convention for interfaces, because only one stf(4) interface can exist
in the system.

This disallow the use of unit numbers different than 0, however, it is
possible to create the clone without specify the unit number (wildcard).

In the wildcard case we must update the interface name before return.

This fix an infinite recursion in pf code that keeps track of network
interfaces and groups:

1 - a group for the cloned type of the interface is added (stf in this
    case);
2 - the system will now try to add an interface named stf (instead of
    stf0) to stf group;
3 - when pfi_kif_attach() tries to search for an already existing 'stf'
    interface, the 'stf' group is returned and thus the group is added
    as an interface of itself;

This will now cause a crash at the first attempt to traverse the groups
which the stf interface belongs (which loops over itself).

Obtained from:	pfSense
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC (Netgate)
2018-10-07 17:42:54 +02:00
sbruno
94f9f4e0ad Do not initialize the adapter on MTU change when adapter status is down.
This fixes long-standing problems when changing settings of the adapter.

Discussed in:
https://lists.freebsd.org/pipermail/freebsd-net/2016-June/045509.html

Submitted by:	arnaud.ysmal@stormshield.eu
Reviewed by:	erj@freebsd.org
Approved by:	re (gjb)
Differential Revision:	https://reviews.freebsd.org/D7030
2018-10-07 17:42:28 +02:00
Franco Fichtner
7514cc6706 dummynet: pfil skip for IPv4 and IPv6
Based on a patch originally found in m0n0wall, expanded
to IPv6 and aligned with FreeBSD's IP input path.
2018-10-07 17:41:46 +02:00
Franco Fichtner
cd1c670224 netmap: ring size limit not enough for multi-queue em(4)
Also mutes a spammy message.  Bravely going where no man
has gone before.  :)
2018-10-07 17:34:21 +02:00
Franco Fichtner
1766f20daf tmpfs: allow recurse as that does happen when using unionfs 2018-10-07 17:34:00 +02:00
Franco Fichtner
98ec75431e etc: OPNsense customisations
o use less(1) as the default pager (inspired by DragonFlyBSD)
o add more key bindings to .cshrc (contributed by Thomas Siegmund)
o add .vimrc to base installation
2018-10-07 17:33:32 +02:00
Franco Fichtner
0c0e584f24 HBSD: cleanups, smaller reverts and review
* Remove default HT disable hardening for now
* Remove default tempaddr IPv6 for now
* Whitespace changes vs. FreeBSD
2018-10-07 17:29:46 +02:00
Shawn Webb
0c60df5d32 HBSD: Remove changes that cause ABI breakage
In order to provide a smooth transition, remove support for shared
library load order randomization. This also removes the ABI breakage
(the ELF auxvec) to allow per-application opt-in of shlibrandom.

Signed-off-by:	Shawn Webb <shawn@opnsense.org>
2018-10-07 14:34:23 +02:00
Franco Fichtner
12706d45cb HBSD: sync up with hardened/11.2-releng/master branch
Commit: b8dead303184bcbd695cdb20407f5677f2424092
2018-10-07 14:26:34 +02:00
Franco Fichtner
0dc4b34cbd src: switch to release/11.2.0
Taken from: FreeBSD commit 62a489e1688b21b7cbdab9ffdb449a67bacc770c
2018-10-07 14:26:34 +02:00
gordon
9fa1d46a07 Fix small kernel memory disclosures. [EN-18:12.mem]
Reported by:	Thomas Barabosch, Fraunhofer FKIE
Approved by:	so
Security:	FreeBSD-EN-18:12.mem
Security:	CVE-2018-17155
2018-09-27 23:06:10 +02:00
gordon
91190ddeed Fix DoS in listen syscall over IPv6 socket. [EN-18:11.listen]
Reported by:	Jakub Jirasek, Secunia Research at Flexera
Approved by:	so
Security:	FreeBSD-EN-18:11.listen
Security:	CVE-2018-6925
2018-09-27 23:06:09 +02:00
gordon
8eaf017b4e Fix NULL pointer dereference in freebsd4_getfsstat. [EN-18:10.syscall]
Reported by:	Thomas Barabosch, Fraunhofer FKIE
Approved by:	so
Security:	FreeBSD-EN-18:10.syscall
Security:	CVE-2018-17154
2018-09-27 23:06:07 +02:00