return 0;
}
+#if HAVE_SECCOMP
+
static int assess_system_call_architectures(
const struct security_assessor *a,
const SecurityInfo *info,
uint64_t *ret_badness,
char **ret_description) {
+ uint32_t native = 0;
char *d;
uint64_t b;
assert(ret_badness);
assert(ret_description);
+ assert_se(seccomp_arch_from_string("native", &native) >= 0);
+
if (set_isempty(info->system_call_architectures)) {
b = 10;
d = strdup("Service may execute system calls with all ABIs");
- } else if (set_contains(info->system_call_architectures, "native") &&
+ } else if (set_contains(info->system_call_architectures, UINT32_TO_PTR(native + 1)) &&
set_size(info->system_call_architectures) == 1) {
b = 0;
d = strdup("Service may execute system calls only with native ABI");
return 0;
}
-#if HAVE_SECCOMP
-
static bool syscall_names_in_filter(Hashmap *s, bool allow_list, const SyscallFilterSet *f, const char **ret_offending_syscall) {
const char *syscall;
.assess = assess_bool,
.offset = offsetof(SecurityInfo, restrict_address_family_other),
},
+#if HAVE_SECCOMP
{
.id = "SystemCallArchitectures=",
.json_field = "SystemCallArchitectures",
.range = 10,
.assess = assess_system_call_architectures,
},
-#if HAVE_SECCOMP
{
.id = "SystemCallFilter=~@swap",
.json_field = "SystemCallFilter_swap",
--root=/tmp/img/ testfile.service
# The strict profile adds a lot of sanboxing options
-systemd-analyze security --threshold=20 --offline=true \
+systemd-analyze security --threshold=25 --offline=true \
--security-policy=/tmp/testfile.json \
--profile=strict \
--root=/tmp/img/ testfile.service
set +e
# The trusted profile doesn't add any sanboxing options
-systemd-analyze security --threshold=20 --offline=true \
+systemd-analyze security --threshold=25 --offline=true \
--security-policy=/tmp/testfile.json \
--profile=/usr/lib/systemd/portable/profile/trusted/service.conf \
--root=/tmp/img/ testfile.service \