Skip to content

Commit 2846118

Browse files
authored
check for uppercase letters in the inspect script (#3681)
1 parent 415db58 commit 2846118

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

scripts/inspect.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,17 @@ function check_low_memory_guard {
418418
fi
419419
}
420420

421+
function check_hostname {
422+
HOST=$(hostname)
423+
if echo "${HOST}" | grep -q "[A-Z]" 2> /dev/null
424+
then
425+
printf -- "\033[0;33mWARNING: \033[0m The hostname of this server is '${HOST}'.\n"
426+
printf -- "Having uppercase letters in the hostname may cause issues with RBAC.\n"
427+
printf -- "Consider changing the hostname to only have lowercase letters with:\n"
428+
printf -- "\n"
429+
printf -- " hostnamectl set-hostname $(echo ${HOST} | tr '[:upper:]' '[:lower:]')\n"
430+
fi
431+
}
421432

422433
if [[ (${#@} -ne 0) && (("$*" == "--help") || ("$*" == "-h")) ]]; then
423434
print_help
@@ -432,6 +443,7 @@ mkdir -p ${SNAP_DATA}/inspection-report
432443
printf -- 'Inspecting system\n'
433444
check_memory
434445
check_low_memory_guard
446+
check_hostname
435447

436448
printf -- 'Inspecting Certificates\n'
437449
check_certificates

0 commit comments

Comments
 (0)