Skip to content

Commit

Permalink
check for uppercase letters in the inspect script (#3681)
Browse files Browse the repository at this point in the history
  • Loading branch information
neoaggelos authored Jan 20, 2023
1 parent 415db58 commit 2846118
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scripts/inspect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,17 @@ function check_low_memory_guard {
fi
}

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

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

printf -- 'Inspecting Certificates\n'
check_certificates
Expand Down

0 comments on commit 2846118

Please sign in to comment.