Skip to content

Commit a5b0c19

Browse files
simonwalzclaude
andcommitted
fix(console): netcheck - recommendations that fit any device
The report is read by the customer's IT, who may run a vendor's device and have no say over its configuration. No recommendation names a config key any more; where the configuration is the cause, it says what is wrong and "Please check it, or contact your support". "Contact your support" throughout, and "not known locally" instead of "the local contact does not know", as the local contact is who reads it. A test keeps config keys out of the recommendations. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Simon Walz <contact@simonwalz.de>
1 parent 8369506 commit a5b0c19

2 files changed

Lines changed: 26 additions & 18 deletions

File tree

‎system/cuos/netcheck.sh‎

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,11 @@ classify_http() {
272272
"${location:-another address}"
273273
;;
274274
403) printf 'error\taccess denied (HTTP 403)\tA proxy or firewall in the path probably refuses the request. Allow the registry host for this device.\n' ;;
275-
404) printf 'error\tno registry at this address (HTTP 404)\tCheck update_registry in the system configuration.\n' ;;
275+
404) printf 'error\tno registry at this address (HTTP 404)\tThere is no update registry at the configured address. Please check the update registry setting of the device, or contact your support.\n' ;;
276276
407) printf 'error\tproxy wants authentication (HTTP 407)\tThe proxy requires credentials the device does not send. Allow the device through the proxy without authentication.\n' ;;
277277
429) printf 'warning\trate limited (HTTP 429)\tTry again later.\n' ;;
278-
5??) printf 'error\tserver-side problem (HTTP %s)\tTry again later; contact support if it persists.\n' "${code}" ;;
279-
*) printf 'error\tunexpected answer (HTTP %s)\tContact support with this output.\n' "${code:-none}" ;;
278+
5??) printf 'error\tserver-side problem (HTTP %s)\tTry again later; contact your support if it persists.\n' "${code}" ;;
279+
*) printf 'error\tunexpected answer (HTTP %s)\tContact your support with this output.\n' "${code:-none}" ;;
280280
esac
281281
}
282282

@@ -447,7 +447,7 @@ check_gateway() {
447447
mapfile -t gateways < <(default_gateways)
448448
if (( ${#gateways[@]} == 0 )); then
449449
record gateway error "no default route" \
450-
"Configure a gateway for this device (network settings)."
450+
"No gateway is configured. Please check the network settings of the device, or contact your support."
451451
return
452452
fi
453453
for gw in "${gateways[@]}"; do
@@ -480,7 +480,7 @@ check_dns_config() {
480480
mapfile -t servers < <(nameservers)
481481
if (( ${#servers[@]} == 0 )); then
482482
record dns_config error "no DNS server configured" \
483-
"Configure DNS servers for this device (network settings)."
483+
"No DNS server is configured. Please check the network settings of the device, or contact your support."
484484
return
485485
fi
486486
for server in "${servers[@]}"; do
@@ -587,26 +587,26 @@ check_tls_handshake() {
587587
case "$(diagnose_block "${no_pq}" "${no_sni}" "${dummy}")" in
588588
pq_clienthello)
589589
record tls_handshake error "$(describe_handshake "${main}") - the large ClientHello is not accepted" \
590-
"A firewall or proxy in the path cannot handle the larger TLS ClientHello with a post-quantum key share (X25519MLKEM768). Update the firmware of that device; contact support for a workaround."
590+
"A firewall or proxy in the path cannot handle the larger TLS ClientHello with a post-quantum key share (X25519MLKEM768). Update the firmware of that device; contact your support for a workaround."
591591
;;
592592
sni_block)
593593
record tls_handshake error "$(describe_handshake "${main}") - blocked by server name" \
594-
"A firewall or proxy in the path blocks the connection by its server name (SNI). Allow ${HOST} in ALL firewalls and proxies in the path (URL/category filter, application control, TLS inspection rules). Often there is a further firewall (corporate, site, provider) the local contact does not know about."
594+
"A firewall or proxy in the path blocks the connection by its server name (SNI). Allow ${HOST} in ALL firewalls and proxies in the path (URL/category filter, application control, TLS inspection rules). Often there is a further firewall in the path (corporate, site, provider) that is not known locally."
595595
;;
596596
*)
597597
if [[ "${main}" == alert* ]]; then
598598
record tls_handshake error "the server refuses the handshake (${main#alert })" \
599-
"The server or a proxy in the path refuses the TLS connection. Contact support with this output."
599+
"The server or a proxy in the path refuses the TLS connection. Contact your support with this output."
600600
else
601601
record tls_handshake error "$(describe_handshake "${main}") - every TLS connection to ${TARGET_IP} is cut" \
602-
"Something in the path cuts every TLS connection to ${TARGET_IP}:${PORT}, whatever the server name. Allow ${HOST} in all firewalls in the path, including any the local contact may not know about (corporate, site, provider)."
602+
"Something in the path cuts every TLS connection to ${TARGET_IP}:${PORT}, whatever the server name. Allow ${HOST} in all firewalls in the path, including any that are not known locally (corporate, site, provider)."
603603
fi
604604
;;
605605
esac
606606
}
607607

608608
check_time() {
609-
local now build ntp rec="Configure NTP servers (network settings) and allow NTP (UDP 123) to them. A wrong clock makes certificates look invalid."
609+
local now build ntp rec="Please check the NTP servers in the network settings of the device, and allow NTP (UDP 123) from the device; or contact your support. A wrong clock makes certificates look invalid."
610610
now="$(now_epoch)"
611611
build="$(build_epoch)"
612612
if [[ -n "${build}" ]] && (( now < build )); then
@@ -655,7 +655,7 @@ check_cert_ca() {
655655

656656
if [[ "${sys_code}" == "aborted" || "${pub_code}" == "aborted" || -z "${LEAF}" ]]; then
657657
record cert_ca error "the certificate could not be fetched${SYS_MSG:+: ${SYS_MSG#curl: }}" \
658-
"The connection broke off although the handshake worked before. Run the check again; if it happens again, contact support with this output."
658+
"The connection broke off although the handshake worked before. Run the check again; if it happens again, contact your support with this output."
659659
return
660660
fi
661661

@@ -677,7 +677,7 @@ check_cert_ca() {
677677
;;
678678
time)
679679
record cert_ca error "certificate expired or not yet valid" \
680-
"If the system time is wrong, fix it first (see System time). Otherwise contact support with this output."
680+
"If the system time is wrong, fix it first (see System time). Otherwise contact your support with this output."
681681
;;
682682
unknown)
683683
describe_cert "topmost certificate" "${top}"
@@ -691,7 +691,7 @@ Note: with b) the inspection infrastructure sees this traffic, credentials inclu
691691
;;
692692
*)
693693
record cert_ca error "certificate not accepted${SYS_MSG:+: ${SYS_MSG#curl: }}" \
694-
"Contact support with this output."
694+
"Contact your support with this output."
695695
;;
696696
esac
697697
}
@@ -711,7 +711,7 @@ check_hostname() {
711711
fi
712712
names="$(openssl x509 -in "${LEAF}" -noout -ext subjectAltName 2>/dev/null | sed -n '2,$p' | tr -d ' \n')"
713713
detail "certificate is for: ${names:-$(cert "${LEAF}" subject)}"
714-
local rec="Contact support with this output."
714+
local rec="Contact your support with this output."
715715
[[ "${CA_CLASS}" == "customer" ]] &&
716716
rec="The TLS inspection issues the certificate for the wrong name - check its configuration, or exempt ${HOST} from inspection."
717717
record hostname error "certificate is not valid for ${HOST}" "${rec}"
@@ -723,7 +723,7 @@ check_tls_connection() {
723723
record tls_connection ok "established, certificate verified"
724724
else
725725
record tls_connection error "${SYS_MSG:-curl failed (${SYS_RC})}" \
726-
"Contact support with this output."
726+
"Contact your support with this output."
727727
fi
728728
}
729729

@@ -743,15 +743,16 @@ check_credentials() {
743743
local out rc
744744
out="$(registry_login "$(bracket "${HOST}"):${PORT}" "${REG_USER}" "${REG_PASS}")"
745745
rc=$?
746-
local rec="Check update_registry_user and update_registry_password in the system configuration, and the licence; contact support."
746+
local rec="The access data for the update registry is not accepted. Please check it, or contact your support."
747747
case "$(classify_login "${rc}" "${out}")" in
748748
ok) record credentials ok "accepted" ;;
749749
rejected) record credentials error "rejected" "${rec}" ;;
750-
denied) record credentials error "accepted, but access denied" "${rec}" ;;
750+
denied) record credentials error "accepted, but access denied" \
751+
"The access data for the update registry is accepted, but does not give access to the updates (licence or permissions). Please check it, or contact your support." ;;
751752
*)
752753
detail "$(grep -m 1 -i 'error' <<<"${out}" | cut -c 1-200)"
753754
record credentials error "the docker daemon could not log in" \
754-
"curl reached the registry, docker did not. Docker has its own TLS implementation and proxy settings. Contact support with this output."
755+
"curl reached the registry, docker did not. Docker has its own TLS implementation and proxy settings. Contact your support with this output."
755756
;;
756757
esac
757758
}

‎system/cuos/netcheck.test.sh‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ reset_mocks() {
221221
run() {
222222
OUT="$( (main) )"
223223
RC=$?
224+
sed -n '/^Recommendations$/,/^Result:/p' <<<"${OUT}" >>"${TMP}/all-recommendations"
224225
}
225226

226227
# line TITLE: the status column of that check, e.g. "[OK]".
@@ -365,4 +366,10 @@ run
365366
expect "proxy auth: error" "[ERROR]" line "Registry answer"
366367
expect "proxy auth: credentials skipped" "[SKIPPED]" line "Credentials"
367368

369+
# The report is read by the customer's IT, who may have a device from a vendor
370+
# and no say over its configuration: no recommendation names a config key.
371+
expect "recommendations name no configuration key" "" \
372+
grep -oE 'update_registry[a-z_]*|custom_ca_certs|ntp-server|system\.json' "${TMP}/all-recommendations"
373+
expect "recommendations were collected" "yes" eval '[[ -s "${TMP}/all-recommendations" ]] && echo yes'
374+
368375
summary

0 commit comments

Comments
 (0)