2021-05-24 06:13:59 -04:00
|
|
|
#!/usr/bin/env sh
|
2014-04-01 19:42:54 -04:00
|
|
|
set -e
|
|
|
|
|
2016-11-02 19:23:52 -04:00
|
|
|
EXITCODE=0
|
|
|
|
|
2014-04-01 19:42:54 -04:00
|
|
|
# bits of this were adapted from lxc-checkconfig
|
|
|
|
# see also https://github.com/lxc/lxc/blob/lxc-1.0.2/src/lxc/lxc-checkconfig.in
|
|
|
|
|
2021-05-24 06:13:59 -04:00
|
|
|
possibleConfigs="
|
|
|
|
/proc/config.gz
|
|
|
|
/boot/config-$(uname -r)
|
|
|
|
/usr/src/linux-$(uname -r)/.config
|
|
|
|
/usr/src/linux/.config
|
|
|
|
"
|
2015-01-23 03:36:55 -05:00
|
|
|
|
|
|
|
if [ $# -gt 0 ]; then
|
|
|
|
CONFIG="$1"
|
|
|
|
else
|
2021-05-24 06:13:59 -04:00
|
|
|
: "${CONFIG:=/proc/config.gz}"
|
2015-01-23 03:36:55 -05:00
|
|
|
fi
|
2014-04-03 13:46:24 -04:00
|
|
|
|
2021-05-24 06:13:59 -04:00
|
|
|
if ! command -v zgrep > /dev/null 2>&1; then
|
2014-04-03 13:46:24 -04:00
|
|
|
zgrep() {
|
|
|
|
zcat "$2" | grep "$1"
|
|
|
|
}
|
|
|
|
fi
|
2014-04-01 19:42:54 -04:00
|
|
|
|
2015-06-03 05:26:39 -04:00
|
|
|
kernelVersion="$(uname -r)"
|
|
|
|
kernelMajor="${kernelVersion%%.*}"
|
|
|
|
kernelMinor="${kernelVersion#$kernelMajor.}"
|
|
|
|
kernelMinor="${kernelMinor%%.*}"
|
|
|
|
|
2014-04-01 19:42:54 -04:00
|
|
|
is_set() {
|
2014-04-03 13:46:24 -04:00
|
|
|
zgrep "CONFIG_$1=[y|m]" "$CONFIG" > /dev/null
|
2014-04-01 19:42:54 -04:00
|
|
|
}
|
2015-05-14 22:20:31 -04:00
|
|
|
is_set_in_kernel() {
|
|
|
|
zgrep "CONFIG_$1=y" "$CONFIG" > /dev/null
|
|
|
|
}
|
|
|
|
is_set_as_module() {
|
|
|
|
zgrep "CONFIG_$1=m" "$CONFIG" > /dev/null
|
|
|
|
}
|
2014-04-01 19:42:54 -04:00
|
|
|
|
|
|
|
color() {
|
2021-05-24 06:13:59 -04:00
|
|
|
codes=
|
2014-04-01 19:42:54 -04:00
|
|
|
if [ "$1" = 'bold' ]; then
|
2021-05-24 06:13:59 -04:00
|
|
|
codes='1'
|
2014-04-01 19:42:54 -04:00
|
|
|
shift
|
|
|
|
fi
|
2016-01-12 23:57:56 -05:00
|
|
|
if [ "$#" -gt 0 ]; then
|
2021-05-24 06:13:59 -04:00
|
|
|
code=
|
2016-01-12 23:57:56 -05:00
|
|
|
case "$1" in
|
|
|
|
# see https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
|
|
|
|
black) code=30 ;;
|
|
|
|
red) code=31 ;;
|
|
|
|
green) code=32 ;;
|
|
|
|
yellow) code=33 ;;
|
|
|
|
blue) code=34 ;;
|
|
|
|
magenta) code=35 ;;
|
|
|
|
cyan) code=36 ;;
|
|
|
|
white) code=37 ;;
|
|
|
|
esac
|
|
|
|
if [ "$code" ]; then
|
2021-05-27 03:11:31 -04:00
|
|
|
codes="${codes:+$codes;}$code"
|
2016-01-12 23:57:56 -05:00
|
|
|
fi
|
2014-04-02 04:44:12 -04:00
|
|
|
fi
|
2021-05-24 06:13:59 -04:00
|
|
|
printf '\033[%sm' "$codes"
|
2014-04-02 04:44:12 -04:00
|
|
|
}
|
|
|
|
wrap_color() {
|
|
|
|
text="$1"
|
|
|
|
shift
|
|
|
|
color "$@"
|
2021-05-24 06:13:59 -04:00
|
|
|
printf '%s' "$text"
|
2014-04-02 04:44:12 -04:00
|
|
|
color reset
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
|
|
|
wrap_good() {
|
|
|
|
echo "$(wrap_color "$1" white): $(wrap_color "$2" green)"
|
|
|
|
}
|
|
|
|
wrap_bad() {
|
|
|
|
echo "$(wrap_color "$1" bold): $(wrap_color "$2" bold red)"
|
|
|
|
}
|
|
|
|
wrap_warning() {
|
|
|
|
wrap_color >&2 "$*" red
|
2014-04-01 19:42:54 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
check_flag() {
|
2015-05-14 22:20:31 -04:00
|
|
|
if is_set_in_kernel "$1"; then
|
2014-04-02 04:44:12 -04:00
|
|
|
wrap_good "CONFIG_$1" 'enabled'
|
2015-05-14 22:20:31 -04:00
|
|
|
elif is_set_as_module "$1"; then
|
|
|
|
wrap_good "CONFIG_$1" 'enabled (as module)'
|
2014-04-01 19:42:54 -04:00
|
|
|
else
|
2014-04-02 04:44:12 -04:00
|
|
|
wrap_bad "CONFIG_$1" 'missing'
|
2016-11-02 19:23:52 -04:00
|
|
|
EXITCODE=1
|
2014-04-01 19:42:54 -04:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
check_flags() {
|
|
|
|
for flag in "$@"; do
|
2021-05-24 06:13:59 -04:00
|
|
|
printf -- '- '
|
2020-03-02 22:27:49 -05:00
|
|
|
check_flag "$flag"
|
2014-04-01 19:42:54 -04:00
|
|
|
done
|
2014-12-03 07:57:23 -05:00
|
|
|
}
|
2014-04-01 19:42:54 -04:00
|
|
|
|
2014-09-03 10:26:19 -04:00
|
|
|
check_command() {
|
2020-03-02 22:27:49 -05:00
|
|
|
if command -v "$1" > /dev/null 2>&1; then
|
2014-09-03 10:26:19 -04:00
|
|
|
wrap_good "$1 command" 'available'
|
|
|
|
else
|
|
|
|
wrap_bad "$1 command" 'missing'
|
2016-11-02 19:23:52 -04:00
|
|
|
EXITCODE=1
|
2014-09-03 10:26:19 -04:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
check_device() {
|
|
|
|
if [ -c "$1" ]; then
|
|
|
|
wrap_good "$1" 'present'
|
|
|
|
else
|
|
|
|
wrap_bad "$1" 'missing'
|
2016-11-02 19:23:52 -04:00
|
|
|
EXITCODE=1
|
2014-09-03 10:26:19 -04:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2016-02-24 00:28:24 -05:00
|
|
|
check_distro_userns() {
|
2021-05-24 06:13:59 -04:00
|
|
|
. /etc/os-release 2> /dev/null || /bin/true
|
|
|
|
case "$ID" in
|
|
|
|
centos | rhel)
|
|
|
|
case "$VERSION_ID" in
|
|
|
|
7*)
|
|
|
|
# this is a CentOS7 or RHEL7 system
|
|
|
|
grep -q 'user_namespace.enable=1' /proc/cmdline || {
|
|
|
|
# no user namespace support enabled
|
|
|
|
wrap_bad " (RHEL7/CentOS7" "User namespaces disabled; add 'user_namespace.enable=1' to boot command line)"
|
|
|
|
EXITCODE=1
|
|
|
|
}
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
2016-02-24 00:28:24 -05:00
|
|
|
}
|
|
|
|
|
2014-04-02 04:44:12 -04:00
|
|
|
if [ ! -e "$CONFIG" ]; then
|
2015-06-19 01:47:48 -04:00
|
|
|
wrap_warning "warning: $CONFIG does not exist, searching other paths for kernel config ..."
|
2021-05-24 06:13:59 -04:00
|
|
|
for tryConfig in $possibleConfigs; do
|
2014-04-02 04:44:12 -04:00
|
|
|
if [ -e "$tryConfig" ]; then
|
|
|
|
CONFIG="$tryConfig"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ ! -e "$CONFIG" ]; then
|
|
|
|
wrap_warning "error: cannot find kernel config"
|
|
|
|
wrap_warning " try running this script again, specifying the kernel config:"
|
2015-02-13 06:52:11 -05:00
|
|
|
wrap_warning " CONFIG=/path/to/kernel/.config $0 or $0 /path/to/kernel/.config"
|
2014-04-02 04:44:12 -04:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
2014-04-01 19:42:54 -04:00
|
|
|
|
2014-04-02 04:44:12 -04:00
|
|
|
wrap_color "info: reading kernel config from $CONFIG ..." white
|
|
|
|
echo
|
2014-04-01 19:42:54 -04:00
|
|
|
|
|
|
|
echo 'Generally Necessary:'
|
2014-04-02 04:44:12 -04:00
|
|
|
|
2021-05-24 06:13:59 -04:00
|
|
|
printf -- '- '
|
2021-01-11 15:28:21 -05:00
|
|
|
if [ "$(stat -f -c %t /sys/fs/cgroup 2> /dev/null)" = '63677270' ]; then
|
2021-05-24 06:13:59 -04:00
|
|
|
wrap_good 'cgroup hierarchy' 'cgroupv2'
|
2014-04-02 04:44:12 -04:00
|
|
|
else
|
2021-05-24 04:56:04 -04:00
|
|
|
cgroupSubsystemDir="$(sed -rne '/^[^ ]+ ([^ ]+) cgroup ([^ ]*,)?(cpu|cpuacct|cpuset|devices|freezer|memory)[, ].*$/ { s//\1/p; q }' /proc/mounts)"
|
2021-01-11 15:28:21 -05:00
|
|
|
cgroupDir="$(dirname "$cgroupSubsystemDir")"
|
|
|
|
if [ -d "$cgroupDir/cpu" ] || [ -d "$cgroupDir/cpuacct" ] || [ -d "$cgroupDir/cpuset" ] || [ -d "$cgroupDir/devices" ] || [ -d "$cgroupDir/freezer" ] || [ -d "$cgroupDir/memory" ]; then
|
|
|
|
echo "$(wrap_good 'cgroup hierarchy' 'properly mounted') [$cgroupDir]"
|
2014-04-08 00:53:42 -04:00
|
|
|
else
|
2021-01-11 15:28:21 -05:00
|
|
|
if [ "$cgroupSubsystemDir" ]; then
|
|
|
|
echo "$(wrap_bad 'cgroup hierarchy' 'single mountpoint!') [$cgroupSubsystemDir]"
|
|
|
|
else
|
|
|
|
wrap_bad 'cgroup hierarchy' 'nonexistent??'
|
|
|
|
fi
|
|
|
|
EXITCODE=1
|
|
|
|
echo " $(wrap_color '(see https://github.com/tianon/cgroupfs-mount)' yellow)"
|
2014-04-08 00:53:42 -04:00
|
|
|
fi
|
2014-04-02 04:44:12 -04:00
|
|
|
fi
|
|
|
|
|
2020-03-02 22:27:49 -05:00
|
|
|
if [ "$(cat /sys/module/apparmor/parameters/enabled 2> /dev/null)" = 'Y' ]; then
|
2021-05-24 06:13:59 -04:00
|
|
|
printf -- '- '
|
|
|
|
if command -v apparmor_parser > /dev/null 2>&1; then
|
2019-06-04 09:09:05 -04:00
|
|
|
wrap_good 'apparmor' 'enabled and tools installed'
|
2014-07-22 12:08:41 -04:00
|
|
|
else
|
2019-06-04 09:09:05 -04:00
|
|
|
wrap_bad 'apparmor' 'enabled, but apparmor_parser missing'
|
2021-05-24 06:13:59 -04:00
|
|
|
printf ' '
|
|
|
|
if command -v apt-get > /dev/null 2>&1; then
|
2019-06-04 09:09:05 -04:00
|
|
|
wrap_color '(use "apt-get install apparmor" to fix this)'
|
2021-05-24 06:13:59 -04:00
|
|
|
elif command -v yum > /dev/null 2>&1; then
|
2019-06-04 09:09:05 -04:00
|
|
|
wrap_color '(your best bet is "yum install apparmor-parser")'
|
2014-07-22 12:08:41 -04:00
|
|
|
else
|
2019-06-04 09:09:05 -04:00
|
|
|
wrap_color '(look for an "apparmor" package for your distribution)'
|
2014-07-22 12:08:41 -04:00
|
|
|
fi
|
2016-11-02 19:23:52 -04:00
|
|
|
EXITCODE=1
|
2014-07-22 12:08:41 -04:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2021-05-24 06:13:59 -04:00
|
|
|
check_flags \
|
2021-05-27 03:12:33 -04:00
|
|
|
NAMESPACES NET_NS PID_NS IPC_NS UTS_NS \
|
2021-05-24 06:13:59 -04:00
|
|
|
CGROUPS CGROUP_CPUACCT CGROUP_DEVICE CGROUP_FREEZER CGROUP_SCHED CPUSETS MEMCG \
|
|
|
|
KEYS \
|
|
|
|
VETH BRIDGE BRIDGE_NETFILTER \
|
|
|
|
IP_NF_FILTER IP_NF_TARGET_MASQUERADE \
|
|
|
|
NETFILTER_XT_MATCH_ADDRTYPE \
|
|
|
|
NETFILTER_XT_MATCH_CONNTRACK \
|
|
|
|
NETFILTER_XT_MATCH_IPVS \
|
|
|
|
NETFILTER_XT_MARK \
|
|
|
|
IP_NF_NAT NF_NAT \
|
2014-12-26 16:59:25 -05:00
|
|
|
POSIX_MQUEUE
|
2021-05-24 06:13:59 -04:00
|
|
|
# (POSIX_MQUEUE is required for bind-mounting /dev/mqueue into containers)
|
|
|
|
|
2020-03-02 22:27:49 -05:00
|
|
|
if [ "$kernelMajor" -lt 4 ] || ([ "$kernelMajor" -eq 4 ] && [ "$kernelMinor" -lt 8 ]); then
|
|
|
|
check_flags DEVPTS_MULTIPLE_INSTANCES
|
2016-11-18 06:38:07 -05:00
|
|
|
fi
|
|
|
|
|
2021-01-11 15:38:33 -05:00
|
|
|
if [ "$kernelMajor" -lt 5 ] || [ "$kernelMajor" -eq 5 -a "$kernelMinor" -le 1 ]; then
|
|
|
|
check_flags NF_NAT_IPV4
|
|
|
|
fi
|
|
|
|
|
2021-01-11 15:40:53 -05:00
|
|
|
if [ "$kernelMajor" -lt 5 ] || [ "$kernelMajor" -eq 5 -a "$kernelMinor" -le 2 ]; then
|
|
|
|
check_flags NF_NAT_NEEDED
|
|
|
|
fi
|
|
|
|
|
2014-04-01 19:42:54 -04:00
|
|
|
echo
|
|
|
|
|
|
|
|
echo 'Optional Features:'
|
2015-10-11 05:26:34 -04:00
|
|
|
{
|
|
|
|
check_flags USER_NS
|
2016-02-24 00:28:24 -05:00
|
|
|
check_distro_userns
|
2015-10-11 05:26:34 -04:00
|
|
|
}
|
2015-11-18 04:42:12 -05:00
|
|
|
{
|
|
|
|
check_flags SECCOMP
|
2021-03-22 22:16:25 -04:00
|
|
|
check_flags SECCOMP_FILTER
|
2015-11-18 04:42:12 -05:00
|
|
|
}
|
2015-12-15 14:15:43 -05:00
|
|
|
{
|
|
|
|
check_flags CGROUP_PIDS
|
|
|
|
}
|
2015-04-01 20:38:39 -04:00
|
|
|
{
|
2021-01-11 16:25:16 -05:00
|
|
|
check_flags MEMCG_SWAP
|
|
|
|
# Kernel v5.8+ removes MEMCG_SWAP_ENABLED.
|
|
|
|
if [ "$kernelMajor" -lt 5 ] || [ "$kernelMajor" -eq 5 -a "$kernelMinor" -le 8 ]; then
|
|
|
|
CODE=${EXITCODE}
|
|
|
|
check_flags MEMCG_SWAP_ENABLED
|
|
|
|
# FIXME this check is cgroupv1-specific
|
|
|
|
if [ -e /sys/fs/cgroup/memory/memory.memsw.limit_in_bytes ]; then
|
|
|
|
echo " $(wrap_color '(cgroup swap accounting is currently enabled)' bold black)"
|
|
|
|
EXITCODE=${CODE}
|
|
|
|
elif is_set MEMCG_SWAP && ! is_set MEMCG_SWAP_ENABLED; then
|
|
|
|
echo " $(wrap_color '(cgroup swap accounting is currently not enabled, you can enable it by setting boot option "swapaccount=1")' bold black)"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
# Kernel v5.8+ enables swap accounting by default.
|
2016-11-20 21:27:04 -05:00
|
|
|
echo " $(wrap_color '(cgroup swap accounting is currently enabled)' bold black)"
|
2015-04-01 20:38:39 -04:00
|
|
|
fi
|
|
|
|
}
|
2016-11-24 06:39:05 -05:00
|
|
|
{
|
|
|
|
if is_set LEGACY_VSYSCALL_NATIVE; then
|
2021-05-24 06:13:59 -04:00
|
|
|
printf -- '- '
|
2020-03-02 22:27:49 -05:00
|
|
|
wrap_bad "CONFIG_LEGACY_VSYSCALL_NATIVE" 'enabled'
|
2016-12-05 05:13:07 -05:00
|
|
|
echo " $(wrap_color '(dangerous, provides an ASLR-bypassing target with usable ROP gadgets.)' bold black)"
|
2016-11-24 06:39:05 -05:00
|
|
|
elif is_set LEGACY_VSYSCALL_EMULATE; then
|
2021-05-24 06:13:59 -04:00
|
|
|
printf -- '- '
|
2020-03-02 22:27:49 -05:00
|
|
|
wrap_good "CONFIG_LEGACY_VSYSCALL_EMULATE" 'enabled'
|
2016-11-24 06:39:05 -05:00
|
|
|
elif is_set LEGACY_VSYSCALL_NONE; then
|
2021-05-24 06:13:59 -04:00
|
|
|
printf -- '- '
|
2020-03-02 22:27:49 -05:00
|
|
|
wrap_bad "CONFIG_LEGACY_VSYSCALL_NONE" 'enabled'
|
2016-11-24 06:39:05 -05:00
|
|
|
echo " $(wrap_color '(containers using eglibc <= 2.13 will not work. Switch to' bold black)"
|
|
|
|
echo " $(wrap_color ' "CONFIG_VSYSCALL_[NATIVE|EMULATE]" or use "vsyscall=[native|emulate]"' bold black)"
|
|
|
|
echo " $(wrap_color ' on kernel command line. Note that this will disable ASLR for the,' bold black)"
|
|
|
|
echo " $(wrap_color ' VDSO which may assist in exploiting security vulnerabilities.)' bold black)"
|
|
|
|
# else Older kernels (prior to 3dc33bd30f3e, released in v4.40-rc1) do
|
|
|
|
# not have these LEGACY_VSYSCALL options and are effectively
|
|
|
|
# LEGACY_VSYSCALL_EMULATE. Even older kernels are presumably
|
|
|
|
# effectively LEGACY_VSYSCALL_NATIVE.
|
|
|
|
fi
|
|
|
|
}
|
2015-06-03 05:26:39 -04:00
|
|
|
|
2020-03-02 22:27:49 -05:00
|
|
|
if [ "$kernelMajor" -lt 4 ] || ([ "$kernelMajor" -eq 4 ] && [ "$kernelMinor" -le 5 ]); then
|
2016-05-16 01:55:24 -04:00
|
|
|
check_flags MEMCG_KMEM
|
|
|
|
fi
|
|
|
|
|
2020-03-02 22:27:49 -05:00
|
|
|
if [ "$kernelMajor" -lt 3 ] || ([ "$kernelMajor" -eq 3 ] && [ "$kernelMinor" -le 18 ]); then
|
2015-06-03 05:26:39 -04:00
|
|
|
check_flags RESOURCE_COUNTERS
|
|
|
|
fi
|
|
|
|
|
2020-03-02 22:27:49 -05:00
|
|
|
if [ "$kernelMajor" -lt 3 ] || ([ "$kernelMajor" -eq 3 ] && [ "$kernelMinor" -le 13 ]); then
|
2015-08-14 02:38:48 -04:00
|
|
|
netprio=NETPRIO_CGROUP
|
|
|
|
else
|
|
|
|
netprio=CGROUP_NET_PRIO
|
|
|
|
fi
|
|
|
|
|
2021-01-11 16:31:19 -05:00
|
|
|
if [ "$kernelMajor" -lt 5 ]; then
|
|
|
|
check_flags IOSCHED_CFQ CFQ_GROUP_IOSCHED
|
|
|
|
fi
|
|
|
|
|
2021-05-24 06:13:59 -04:00
|
|
|
check_flags \
|
|
|
|
BLK_CGROUP BLK_DEV_THROTTLING \
|
|
|
|
CGROUP_PERF \
|
|
|
|
CGROUP_HUGETLB \
|
|
|
|
NET_CLS_CGROUP $netprio \
|
|
|
|
CFS_BANDWIDTH FAIR_GROUP_SCHED RT_GROUP_SCHED \
|
|
|
|
IP_NF_TARGET_REDIRECT \
|
|
|
|
IP_VS \
|
|
|
|
IP_VS_NFCT \
|
|
|
|
IP_VS_PROTO_TCP \
|
|
|
|
IP_VS_PROTO_UDP \
|
|
|
|
IP_VS_RR \
|
|
|
|
SECURITY_SELINUX \
|
2021-03-30 01:37:43 -04:00
|
|
|
SECURITY_APPARMOR
|
2014-04-01 19:42:54 -04:00
|
|
|
|
2016-10-28 06:16:04 -04:00
|
|
|
if ! is_set EXT4_USE_FOR_EXT2; then
|
|
|
|
check_flags EXT3_FS EXT3_FS_XATTR EXT3_FS_POSIX_ACL EXT3_FS_SECURITY
|
|
|
|
if ! is_set EXT3_FS || ! is_set EXT3_FS_XATTR || ! is_set EXT3_FS_POSIX_ACL || ! is_set EXT3_FS_SECURITY; then
|
|
|
|
echo " $(wrap_color '(enable these ext3 configs if you are using ext3 as backing filesystem)' bold black)"
|
|
|
|
fi
|
2015-06-19 01:45:07 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
check_flags EXT4_FS EXT4_FS_POSIX_ACL EXT4_FS_SECURITY
|
|
|
|
if ! is_set EXT4_FS || ! is_set EXT4_FS_POSIX_ACL || ! is_set EXT4_FS_SECURITY; then
|
2016-10-28 06:16:04 -04:00
|
|
|
if is_set EXT4_USE_FOR_EXT2; then
|
|
|
|
echo " $(wrap_color 'enable these ext4 configs if you are using ext3 or ext4 as backing filesystem' bold black)"
|
|
|
|
else
|
|
|
|
echo " $(wrap_color 'enable these ext4 configs if you are using ext4 as backing filesystem' bold black)"
|
|
|
|
fi
|
2015-06-19 01:45:07 -04:00
|
|
|
fi
|
|
|
|
|
2016-04-11 19:42:53 -04:00
|
|
|
echo '- Network Drivers:'
|
2019-06-04 09:09:05 -04:00
|
|
|
echo " - \"$(wrap_color 'overlay' blue)\":"
|
2018-05-24 04:18:50 -04:00
|
|
|
check_flags VXLAN BRIDGE_VLAN_FILTERING | sed 's/^/ /'
|
2016-11-02 19:23:52 -04:00
|
|
|
echo ' Optional (for encrypted networks):'
|
|
|
|
check_flags CRYPTO CRYPTO_AEAD CRYPTO_GCM CRYPTO_SEQIV CRYPTO_GHASH \
|
2021-01-11 16:39:06 -05:00
|
|
|
XFRM XFRM_USER XFRM_ALGO INET_ESP | sed 's/^/ /'
|
|
|
|
if [ "$kernelMajor" -lt 5 ] || [ "$kernelMajor" -eq 5 -a "$kernelMinor" -le 3 ]; then
|
|
|
|
check_flags INET_XFRM_MODE_TRANSPORT | sed 's/^/ /'
|
|
|
|
fi
|
2019-06-04 09:09:05 -04:00
|
|
|
echo " - \"$(wrap_color 'ipvlan' blue)\":"
|
2016-11-02 19:23:52 -04:00
|
|
|
check_flags IPVLAN | sed 's/^/ /'
|
2019-06-04 09:09:05 -04:00
|
|
|
echo " - \"$(wrap_color 'macvlan' blue)\":"
|
2016-11-02 19:23:52 -04:00
|
|
|
check_flags MACVLAN DUMMY | sed 's/^/ /'
|
2019-06-04 09:09:05 -04:00
|
|
|
echo " - \"$(wrap_color 'ftp,tftp client in container' blue)\":"
|
2016-12-13 17:51:45 -05:00
|
|
|
check_flags NF_NAT_FTP NF_CONNTRACK_FTP NF_NAT_TFTP NF_CONNTRACK_TFTP | sed 's/^/ /'
|
2016-11-02 19:23:52 -04:00
|
|
|
|
|
|
|
# only fail if no storage drivers available
|
|
|
|
CODE=${EXITCODE}
|
|
|
|
EXITCODE=0
|
|
|
|
STORAGE=1
|
2016-04-11 19:42:53 -04:00
|
|
|
|
2014-04-01 19:42:54 -04:00
|
|
|
echo '- Storage Drivers:'
|
2019-06-04 09:09:05 -04:00
|
|
|
echo " - \"$(wrap_color 'aufs' blue)\":"
|
2016-11-02 19:23:52 -04:00
|
|
|
check_flags AUFS_FS | sed 's/^/ /'
|
|
|
|
if ! is_set AUFS_FS && grep -q aufs /proc/filesystems; then
|
|
|
|
echo " $(wrap_color '(note that some kernels include AUFS patches but not the AUFS_FS flag)' bold black)"
|
|
|
|
fi
|
|
|
|
[ "$EXITCODE" = 0 ] && STORAGE=0
|
|
|
|
EXITCODE=0
|
|
|
|
|
2019-06-04 09:09:05 -04:00
|
|
|
echo " - \"$(wrap_color 'btrfs' blue)\":"
|
2016-11-02 19:23:52 -04:00
|
|
|
check_flags BTRFS_FS | sed 's/^/ /'
|
|
|
|
check_flags BTRFS_FS_POSIX_ACL | sed 's/^/ /'
|
|
|
|
[ "$EXITCODE" = 0 ] && STORAGE=0
|
|
|
|
EXITCODE=0
|
|
|
|
|
2019-06-04 09:09:05 -04:00
|
|
|
echo " - \"$(wrap_color 'devicemapper' blue)\":"
|
2016-11-02 19:23:52 -04:00
|
|
|
check_flags BLK_DEV_DM DM_THIN_PROVISIONING | sed 's/^/ /'
|
|
|
|
[ "$EXITCODE" = 0 ] && STORAGE=0
|
|
|
|
EXITCODE=0
|
|
|
|
|
2019-06-04 09:09:05 -04:00
|
|
|
echo " - \"$(wrap_color 'overlay' blue)\":"
|
2016-11-02 19:23:52 -04:00
|
|
|
check_flags OVERLAY_FS | sed 's/^/ /'
|
|
|
|
[ "$EXITCODE" = 0 ] && STORAGE=0
|
|
|
|
EXITCODE=0
|
|
|
|
|
2019-06-04 09:09:05 -04:00
|
|
|
echo " - \"$(wrap_color 'zfs' blue)\":"
|
2021-05-24 06:13:59 -04:00
|
|
|
printf ' - '
|
2020-03-02 22:27:49 -05:00
|
|
|
check_device /dev/zfs
|
2021-05-24 06:13:59 -04:00
|
|
|
printf ' - '
|
2020-03-02 22:27:49 -05:00
|
|
|
check_command zfs
|
2021-05-24 06:13:59 -04:00
|
|
|
printf ' - '
|
2020-03-02 22:27:49 -05:00
|
|
|
check_command zpool
|
2016-11-02 19:23:52 -04:00
|
|
|
[ "$EXITCODE" = 0 ] && STORAGE=0
|
|
|
|
EXITCODE=0
|
|
|
|
|
|
|
|
EXITCODE=$CODE
|
|
|
|
[ "$STORAGE" = 1 ] && EXITCODE=1
|
2014-09-03 10:26:19 -04:00
|
|
|
|
2014-04-01 19:42:54 -04:00
|
|
|
echo
|
|
|
|
|
2020-03-02 22:27:49 -05:00
|
|
|
check_limit_over() {
|
2019-06-04 09:09:05 -04:00
|
|
|
if [ "$(cat "$1")" -le "$2" ]; then
|
|
|
|
wrap_bad "- $1" "$(cat "$1")"
|
2016-05-20 19:05:25 -04:00
|
|
|
wrap_color " This should be set to at least $2, for example set: sysctl -w kernel/keys/root_maxkeys=1000000" bold black
|
2016-11-02 19:23:52 -04:00
|
|
|
EXITCODE=1
|
2016-05-20 19:05:25 -04:00
|
|
|
else
|
2019-06-04 09:09:05 -04:00
|
|
|
wrap_good "- $1" "$(cat "$1")"
|
2016-05-20 19:05:25 -04:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
echo 'Limits:'
|
|
|
|
check_limit_over /proc/sys/kernel/keys/root_maxkeys 10000
|
|
|
|
echo
|
2016-11-02 19:23:52 -04:00
|
|
|
|
|
|
|
exit $EXITCODE
|