core: warn loudly if IP firewalling is configured but not in effect

This commit is contained in:
Lennart Poettering
2017-09-22 15:24:55 +02:00
parent db3a59308c
commit 078ba556da
2 changed files with 20 additions and 0 deletions
+10
View File
@@ -21,6 +21,7 @@
#include "af-list.h"
#include "alloc-util.h"
#include "bpf-firewall.h"
#include "bus-util.h"
#include "cgroup-util.h"
#include "cgroup.h"
@@ -1321,6 +1322,15 @@ int bus_cgroup_set_property(
if (r < 0)
return r;
unit_write_drop_in_private(u, mode, name, buf);
if (*list) {
r = bpf_firewall_supported();
if (r < 0)
return r;
if (r == 0)
log_warning("Transient unit %s configures an IP firewall, but the local system does not support BPF/cgroup firewalling.\n"
"Proceeding WITHOUT firewalling in effect!", u->id);
}
}
return 1;
+10
View File
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include "alloc-util.h"
#include "bpf-firewall.h"
#include "extract-word.h"
#include "hostname-util.h"
#include "ip-address-access.h"
@@ -150,6 +151,15 @@ int config_parse_ip_address_access(
*list = ip_address_access_reduce(*list);
if (*list) {
r = bpf_firewall_supported();
if (r < 0)
return r;
if (r == 0)
log_warning("File %s:%u configures an IP firewall (%s=%s), but the local system does not support BPF/cgroup based firewalling.\n"
"Proceeding WITHOUT firewalling in effect!", filename, line, lvalue, rvalue);
}
return 0;
}