#
4a5fa108 |
| 19-Sep-2024 |
Simon J. Gerraty <sjg@FreeBSD.org> |
procfs require PRIV_PROC_MEM_WRITE to write mem
Add a priv_check for PRIV_PROC_MEM_WRITE which will be blocked by mac_veriexec if being enforced, unless the process has a maclabel to grant priv.
Re
procfs require PRIV_PROC_MEM_WRITE to write mem
Add a priv_check for PRIV_PROC_MEM_WRITE which will be blocked by mac_veriexec if being enforced, unless the process has a maclabel to grant priv.
Reviewed by: stevek Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D46692
show more ...
|
Revision tags: release/13.4.0, release/14.1.0, release/13.3.0, release/14.0.0 |
|
#
bb8d4411 |
| 03-Nov-2023 |
Zhenlei Huang <zlei@FreeBSD.org> |
veriexec: Simplify the initialization of loader tunable
The loader tunable 'security.mac.veriexec.block_unlink' has been already flagged with CTLFLAG_RDTUN, no need to re-fetch it with TUNABLE_INT_F
veriexec: Simplify the initialization of loader tunable
The loader tunable 'security.mac.veriexec.block_unlink' has been already flagged with CTLFLAG_RDTUN, no need to re-fetch it with TUNABLE_INT_FETCH.
While here move the definition of sysctl knob out of function body, which is more common in FreeBSD.
No functional change intended.
Reviewed by: stevek MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D42132
show more ...
|
Revision tags: release/13.2.0 |
|
#
d195f39d |
| 02-Apr-2023 |
Steve Kiernan <stevek@juniper.net> |
veriexec: Add option MAC_VERIEXEC_DEBUG
Obtained from: Juniper Networks, Inc.
|
Revision tags: release/12.4.0, release/13.1.0 |
|
#
8c3e263d |
| 11-Dec-2021 |
Simon J. Gerraty <sjg@juniper.net> |
veriexec: mac_veriexec_syscall compat32 support
Some 32bit apps may need to be able to use MAC_VERIEXEC_GET_PARAMS_PID_SYSCALL MAC_VERIEXEC_GET_PARAMS_PATH_SYSCALL
Therefore compat32 support is req
veriexec: mac_veriexec_syscall compat32 support
Some 32bit apps may need to be able to use MAC_VERIEXEC_GET_PARAMS_PID_SYSCALL MAC_VERIEXEC_GET_PARAMS_PATH_SYSCALL
Therefore compat32 support is required.
Obtained from: Juniper Networks, Inc.
show more ...
|
#
8512d82e |
| 02-Apr-2023 |
Steve Kiernan <stevek@juniper.net> |
veriexec: Additional functionality for MAC/veriexec
Ensure veriexec opens the file before doing any read operations.
When the MAC_VERIEXEC_CHECK_PATH_SYSCALL syscall is requested, veriexec needs to
veriexec: Additional functionality for MAC/veriexec
Ensure veriexec opens the file before doing any read operations.
When the MAC_VERIEXEC_CHECK_PATH_SYSCALL syscall is requested, veriexec needs to open the file before calling mac_veriexec_check_vp. This is to ensure any set up is done by the file system. Most file systems do not explicitly need an open, but some (e.g. virtfs) require initialization of access tokens (file identifiers, etc.) before doing any read or write operations.
The evaluate_fingerprint() function needs to ensure it has an open file for reading in order to evaluate the fingerprint. The ideal solution is to have a hook after the VOP_OPEN call in vn_open. For now, we open the file for reading, envaluate the fingerprint, and close the file. While this leaves a potential hole that could possibly be taken advantage of by a dedicated aversary, this code path is not typically visited often in our use cases, as we primarily encounter verified mounts and not individual files. This should be considered a temporary workaround until discussions about the post-open hook have concluded and the hook becomes available.
Add MAC_VERIEXEC_GET_PARAMS_PATH_SYSCALL and MAC_VERIEXEC_GET_PARAMS_PID_SYSCALL to mac_veriexec_syscall so we can fetch and check label contents in an unconstrained manner.
Add a check for PRIV_VERIEXEC_CONTROL to do ioctl on /dev/veriexec
Make it clear that trusted process cannot be debugged. Attempts to debug a trusted process already fail, but the failure path is very obscure. Add an explicit check for VERIEXEC_TRUSTED in mac_veriexec_proc_check_debug.
We need mac_veriexec_priv_check to not block PRIV_KMEM_WRITE if mac_priv_gant() says it is ok.
Reviewed by: sjg Obtained from: Juniper Networks, Inc.
show more ...
|
#
88a3358e |
| 17-Apr-2023 |
Stephen J. Kiernan <stevek@FreeBSD.org> |
veriexec: Add SPDX-License-Identifier
|
Revision tags: release/12.3.0, release/13.0.0, release/12.2.0, release/11.4.0, release/12.1.0 |
|
#
6ae8d576 |
| 30-Jul-2019 |
Simon J. Gerraty <sjg@juniper.net> |
mac_veriexec: add mac_priv_grant check for NODEV
Allow other MAC modules to override some veriexec checks.
We need two new privileges: PRIV_VERIEXEC_DIRECT process wants to override 'indirect' flag
mac_veriexec: add mac_priv_grant check for NODEV
Allow other MAC modules to override some veriexec checks.
We need two new privileges: PRIV_VERIEXEC_DIRECT process wants to override 'indirect' flag on interpreter PRIV_VERIEXEC_NOVERIFY typically associated with PRIV_VERIEXEC_DIRECT allow override of O_VERIFY
We also need to check for PRIV_VERIEXEC_NOVERIFY override for FINGERPRINT_NODEV and FINGERPRINT_NOENTRY. This will only happen if parent had PRIV_VERIEXEC_DIRECT override.
This allows for MAC modules to selectively allow some applications to run without verification.
Needless to say, this is extremely dangerous and should only be used sparingly and carefully.
Obtained from: Juniper Networks, Inc.
Reviewers: sjg Subscribers: imp, dab
Differential Revision: https://reviews.freebsd.org/D39537
show more ...
|
#
559e41a1 |
| 15-Mar-2023 |
Warner Losh <imp@FreeBSD.org> |
veriexec: Improve comments
Make it clear we're checking to see if the target is a verified file and prevent its replacement if so.
Sponsored by: Netflix Reviewed by: rpokala Differential Revision
veriexec: Improve comments
Make it clear we're checking to see if the target is a verified file and prevent its replacement if so.
Sponsored by: Netflix Reviewed by: rpokala Differential Revision: https://reviews.freebsd.org/D39079
show more ...
|
#
2ef8baba |
| 14-Mar-2023 |
dl <dl@canigo.cat> |
Increase protection provided by veriexec with new unlink/rename hooks.
Functions implemented :
- mac_veriexec_vnode_check_unlink: Unlink on a file has been requested and requires validation. This
Increase protection provided by veriexec with new unlink/rename hooks.
Functions implemented :
- mac_veriexec_vnode_check_unlink: Unlink on a file has been requested and requires validation. This function prohibits the deleting a protected file (or deleting one of these hard links, if any). - mac_veriexec_vnode_check_rename_from: Rename the file has been requested and must be validated. This function controls the renaming of protected file - mac_veriexec_vnode_check_rename_to: File overwrite rename has been requested and must be validated. This function prevent overwriting of a file protected (overwriting by mv command).
The 3 fonctions together aim to control the 'removal' (via unlink) and the 'mv' on files protected by veriexec. The intention is to reach the functional level of NetBSD veriexec.
Add sysctl node security.mac.veriexec.unlink to toggle control on syscall unlink.
Add tunable kernel variable security.mac.veriexec.block_unlink to toggle unlink protection. Add the corresponding read-only sysctl.
[ tidied up commit message, trailing whitespace, long lines, { placement ]
Reviewed by: sjg, imp Pull Request: https://github.com/freebsd/freebsd-src/pull/613
show more ...
|
#
15c362ae |
| 29-Jun-2022 |
Wojciech Macek <wma@FreeBSD.org> |
mac_veriexec: Authorize reads of secured sysctls
Writes to sysctls flagged with CTLFLAG_SECURE are blocked if the appropriate secure level is set. mac_veriexec does not behave this way, it blocks su
mac_veriexec: Authorize reads of secured sysctls
Writes to sysctls flagged with CTLFLAG_SECURE are blocked if the appropriate secure level is set. mac_veriexec does not behave this way, it blocks such sysctls in read-only mode as well.
This change aims to make mac_veriexec behave like secure levels, as it was meant by the original commit ed377cf41.
Reviewed by: sjg Differential revision: https://reviews.freebsd.org/D34327 Obtained from: Stormshield
show more ...
|
#
bb92cd7b |
| 24-Mar-2022 |
Mateusz Guzik <mjg@FreeBSD.org> |
vfs: NDFREE(&nd, NDF_ONLY_PNBUF) -> NDFREE_PNBUF(&nd)
|
#
7e1d3eef |
| 25-Nov-2021 |
Mateusz Guzik <mjg@FreeBSD.org> |
vfs: remove the unused thread argument from NDINIT*
See b4a58fbf640409a1 ("vfs: remove cn_thread")
Bump __FreeBSD_version to 1400043.
|
#
fe8ce390 |
| 29-Jul-2021 |
Wojciech Macek <wma@FreeBSD.org> |
Fix mac_veriexec version mismatch
mac_veriexec sets its version to 1, but the mac_veriexec_shaX modules which depend on it expect MAC_VERIEXEC_VERSION = 2. Be consistent and use MAC_VERIEXEC_VERSION
Fix mac_veriexec version mismatch
mac_veriexec sets its version to 1, but the mac_veriexec_shaX modules which depend on it expect MAC_VERIEXEC_VERSION = 2. Be consistent and use MAC_VERIEXEC_VERSION everywhere. This unbreaks loading of mac_veriexec modules at boot time.
Authored by: Kornel Duleba <mindal@semihalf.com> Obtained from: Semihalf Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D31268
show more ...
|
#
6b3a9a0f |
| 12-Jan-2021 |
Mateusz Guzik <mjg@FreeBSD.org> |
Convert remaining cap_rights_init users to cap_rights_init_one
semantic patch:
@@
expression rights, r;
@@
- cap_rights_init(&rights, r) + cap_rights_init_one(&rights, r)
|
#
75dfc66c |
| 27-Feb-2020 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r358269 through r358399.
|
#
7029da5c |
| 26-Feb-2020 |
Pawel Biernacki <kaktus@FreeBSD.org> |
Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly mark
Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes.
This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags.
Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT
Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718
show more ...
|
#
478368ca |
| 07-Jan-2020 |
Mateusz Guzik <mjg@FreeBSD.org> |
vfs: eliminate v_tag from struct vnode
There was only one consumer and it was using it incorrectly.
It is given an equivalent hack.
Reviewed by: jeff Differential Revision: https://reviews.freebsd
vfs: eliminate v_tag from struct vnode
There was only one consumer and it was using it incorrectly.
It is given an equivalent hack.
Reviewed by: jeff Differential Revision: https://reviews.freebsd.org/D23037
show more ...
|
#
b249ce48 |
| 03-Jan-2020 |
Mateusz Guzik <mjg@FreeBSD.org> |
vfs: drop the mostly unused flags argument from VOP_UNLOCK
Filesystems which want to use it in limited capacity can employ the VOP_UNLOCK_FLAGS macro.
Reviewed by: kib (previous version) Differenti
vfs: drop the mostly unused flags argument from VOP_UNLOCK
Filesystems which want to use it in limited capacity can employ the VOP_UNLOCK_FLAGS macro.
Reviewed by: kib (previous version) Differential Revision: https://reviews.freebsd.org/D21427
show more ...
|
Revision tags: release/11.3.0 |
|
#
0269ae4c |
| 06-Jun-2019 |
Alan Somers <asomers@FreeBSD.org> |
MFHead @348740
Sponsored by: The FreeBSD Foundation
|
#
6cbc9703 |
| 17-May-2019 |
Stephen J. Kiernan <stevek@FreeBSD.org> |
Obtain a shared lock instead of exclusive in the MAC/veriexec MAC_VERIEXEC_CHECK_PATH_SYSCALL per-MAC policy system call.
When we are checking the status of the fingerprint on a vnode using the per-
Obtain a shared lock instead of exclusive in the MAC/veriexec MAC_VERIEXEC_CHECK_PATH_SYSCALL per-MAC policy system call.
When we are checking the status of the fingerprint on a vnode using the per-MAC-policy syscall, we do not need an exclusive lock on the vnode.
Even if there is more than one thread requesting the status at the same time, the worst we can end up doing is processing the file more than once.
This can potentially be improved in the future with offloading the fingerprint evaluation to a separate thread and blocking until the update completes. But for now the race is acceptable.
Obtained from: Juniper Networks, Inc. MFC after: 1 week
show more ...
|
#
ed377cf4 |
| 17-May-2019 |
Stephen J. Kiernan <stevek@FreeBSD.org> |
sysctls which should be restricted when securelevel is raised should also be restricted when veriexec is enforced.
Add mpo_system_check_sysctl method to mac_veriexec which does this.
Obtained from:
sysctls which should be restricted when securelevel is raised should also be restricted when veriexec is enforced.
Add mpo_system_check_sysctl method to mac_veriexec which does this.
Obtained from: Juniper Networks, Inc. MFC after: 1 week
show more ...
|
#
3d53cd0f |
| 17-May-2019 |
Stephen J. Kiernan <stevek@FreeBSD.org> |
Fix format strings for some debug messages that could have arguments that are different types across architectures by using %ju and typecasting to uintmax_t, where appropriate.
Obtained from: Junipe
Fix format strings for some debug messages that could have arguments that are different types across architectures by using %ju and typecasting to uintmax_t, where appropriate.
Obtained from: Juniper Networks, Inc. MFC after: 1 week
show more ...
|
#
3da3012a |
| 17-May-2019 |
Stephen J. Kiernan <stevek@FreeBSD.org> |
Ensure we have obtained a lock on the process before calling mac_veriexec_get_executable_flags(). Only try locking/unlocking if the caller has not already acquired the process lock.
Obtained from: J
Ensure we have obtained a lock on the process before calling mac_veriexec_get_executable_flags(). Only try locking/unlocking if the caller has not already acquired the process lock.
Obtained from: Juniper Networks, Inc. MFC after: 1 week
show more ...
|
Revision tags: release/12.0.0 |
|
#
ade97886 |
| 14-Jul-2018 |
Stephen J. Kiernan <stevek@FreeBSD.org> |
Add mpo_vnode_check_setmode MAC method to MAC/veriexec. In the method, disallow changing SUID/SGID on verified files.
Obtained from: Juniper Networks, Inc.
|
#
1db017d0 |
| 14-Jul-2018 |
Stephen J. Kiernan <stevek@FreeBSD.org> |
Fix a typo which could cause a build breakage when building with MAC/veriexec enabled in the kernel config.
Remove unused mac_veriexec_print_db prototype in internal header file.
|