#!/bin/sh # verify-lockout.sh # # Layer 6: verification checklist. Run this on the TV after applying the lockout # to confirm each layer is actually in place. Exits non-zero if any critical # check fails. Read-only — makes no changes. set -u # --------------------------------------------------------------------------- # Expectations (edit to taste) # --------------------------------------------------------------------------- EXPECT_HOSTS="snu.lge.com nextlgsdp.com info.lgsmartad.com api.lgtviot.com ngfts.lge.com" EULA_FILE=/var/luna/preferences/eula OPTION_FILE=/var/luna/preferences/option ACR_OPTOUT=/mnt/lg/cmn_data/acr/data/eula_disallowed_rebooted UPDATE_INFO=/mnt/lg/cmn_data/var/palm/data/com.webos.appInstallService/updateInfo PASS=0; FAIL=0 ok() { PASS=$((PASS+1)); echo " [PASS] $*"; } bad() { FAIL=$((FAIL+1)); echo " [FAIL] $*"; } sec() { echo; echo "== $* =="; } # --------------------------------------------------------------------------- sec "1. /etc/hosts block entries" for h in $EXPECT_HOSTS; do if grep -q " $h$" /etc/hosts 2>/dev/null; then ok "hosts blocks $h" else bad "hosts does NOT block $h" fi done if mount | grep -q " on /etc/hosts "; then ok "hosts is a bind mount (persistent block active)" else bad "hosts is NOT a bind mount" fi # --------------------------------------------------------------------------- sec "2. Telemetry / phone-home processes" for p in sdx uploadd rdxd admanager; do if pgrep -x "$p" >/dev/null 2>&1; then echo " [INFO] $p is RUNNING (may be failing to reach LG now — check section 4)" else ok "$p not running" fi done echo " [INFO] note: sdx/uploadd/rdxd may still run but fail to phone home — that is the goal." # --------------------------------------------------------------------------- sec "3. Consent / ToS state" if [ -f "$EULA_FILE" ]; then if grep -q '"networkAllowed"[[:space:]]*:[[:space:]]*false' "$EULA_FILE" 2>/dev/null; then ok "eula: networkAllowed=false (network consent declined)" else bad "eula: networkAllowed is still true" fi if grep -q '"acrAllowed"[[:space:]]*:[[:space:]]*false' "$EULA_FILE" 2>/dev/null; then ok "eula: acrAllowed=false (ACR consent declined)" else bad "eula: acrAllowed is still true" fi if grep -q '"voiceAllowed"[[:space:]]*:[[:space:]]*false' "$EULA_FILE" 2>/dev/null; then ok "eula: voiceAllowed=false (voice consent declined)" else bad "eula: voiceAllowed is still true" fi else bad "eula file missing" fi if [ -f "$OPTION_FILE" ]; then for k in voiceAllowed voice2Allowed usageCare dbgLogUpload; do if grep -q "\"$k\"[[:space:]]*:[[:space:]]*false" "$OPTION_FILE" 2>/dev/null; then ok "option: $k=false" else bad "option: $k is not false" fi done if grep -q '"watchedListCollection"[[:space:]]*:[[:space:]]*"off"' "$OPTION_FILE" 2>/dev/null; then ok "option: watchedListCollection=off" else bad "option: watchedListCollection is not off" fi else bad "option file missing" fi if [ -f "$ACR_OPTOUT" ]; then ok "acr opt-out marker present" else bad "acr opt-out marker missing" fi # --------------------------------------------------------------------------- sec "4. Outbound connections to LG domains" if command -v netstat >/dev/null 2>&1; then HITS=$(netstat -tn 2>/dev/null | grep -E ':(443|80|5100)[[:space:]]+ESTABLISHED|:(443|80|5100)[[:space:]]+CLOSE_WAIT' \ | grep -E 'lge\.com|lgsdp\.com|lgsmartad\.com|lgappstv\.com|lgtviot\.com|lgtvcommon\.com|lgthinq\.com|nextlgsdp\.com|wiselg\.com' || true) if [ -n "$HITS" ]; then echo " [WARN] live connections to LG domains found:" echo "$HITS" | sed 's/^/ /' else ok "no established/close-wait connections to LG domains" fi else echo " [INFO] netstat not available; skipping connection check" fi # --------------------------------------------------------------------------- sec "5. DNS resolver" if grep -qE '^(nameserver[[:space:]]+(127\.0\.0\.1|::1))' /etc/resolv.conf 2>/dev/null; then echo " [INFO] resolver is the local connman proxy (127.0.0.1:53) — upstream blocking must be at the router" else bad "resolv.conf does not point at the local proxy" fi # --------------------------------------------------------------------------- sec "6. App-update gate" if [ -f "$UPDATE_INFO" ]; then SZ=$(wc -c < "$UPDATE_INFO" 2>/dev/null || echo "?") if [ "$SZ" = "0" ] || [ "$SZ" = "2" ]; then ok "updateInfo is empty ($SZ bytes)" else echo " [WARN] updateInfo is $SZ bytes (may have been re-created by the app store)" fi else ok "updateInfo absent" fi # --------------------------------------------------------------------------- echo echo "Result: $PASS passed, $FAIL failed" [ "$FAIL" -eq 0 ] && exit 0 || exit 1