mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-10 20:07:04 +01:00
Chromium 151 removed the last Manifest V2 code paths and the Web Store purged uBlock Origin on 2026-08-31, so ungoogled-chromium 153 cannot load the full blocker any more. Helium (GPL-3, ungoogled-chromium base) bundles uBO 1.75.0 as a component extension and keeps MV2 alive. - installers/install_helium.sh: pacman deps, AUR via yay or makepkg (+validpgpkeys import), /usr/local/bin/helium-browser -> browser-preexec-wrapper so LeechBlock NG and the hosts refresh still apply, --clone-profile with a downgrade check and running-browser refusal, then the verifier. Passed in vmbox from scratch, then host. - installers/verify_helium.py: Xvfb + DevTools exit-code gate — uBO background_page + manifest_version 2, every /etc/chromium/policies key on chrome://policy (Helium reads that dir natively), adblock-tester >= 95. - installers/migrate_helium_passwords_to_basic.py: lightdm autologin leaves gnome-keyring locked, so the 5 v11 logins make Helium prompt on every launch; this re-encrypts them as v10 and only then enables --password-store=basic. - register helium-browser in aur_packages.txt and the periodic browser wrapper/service lists; pylint hook gets websockets + cryptography; codespell learns the vendor name; anthropic 1.6.0 -> 1.7.0 (gate red); oldest evidence artifact pruned to stay under the 60-file cap. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M8YGXVZdNUG79q5DGsdMm3
173 lines
5.5 KiB
Bash
Executable File
173 lines
5.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# lib/services_browser.sh — checks whose subject is a browser policy, a VM
|
|
# hosts-enforcement marker, or the per-user workout locker service.
|
|
#
|
|
# Sourced by check_and_enable_services.sh. check_workout_locker queries a USER
|
|
# unit from root and must go through user_systemctl (see its comment) rather
|
|
# than `sudo -u ... systemctl --user`.
|
|
|
|
# Absolute paths the checks below probe are prefixed with $SYSROOT, which is
|
|
# empty in production and a fixture tree under test. It is deliberately NOT
|
|
# defaulted here: several repairs in this family write outside `run` (chattr,
|
|
# find -delete, an append to resolved.conf), so a test that forgot to set it
|
|
# would edit the real /etc. Unset is a hard error; empty is the real filesystem.
|
|
SYSROOT="${SERVICES_ROOT?SERVICES_ROOT must be set (empty = the real filesystem)}"
|
|
|
|
check_guest_mode_removal() {
|
|
header "Chromium Guest Mode Removal"
|
|
|
|
local status="ok"
|
|
local issues=()
|
|
|
|
# Check if managed policy files exist for any browser
|
|
local policy_found=false
|
|
for policy_dir in \
|
|
"${SYSROOT}/etc/chromium/policies/managed" \
|
|
"${SYSROOT}/etc/opt/chrome/policies/managed" \
|
|
"${SYSROOT}/etc/thorium/policies/managed" \
|
|
"${SYSROOT}/etc/brave/policies/managed"; do
|
|
if [[ -d $policy_dir ]] && ls "$policy_dir"/*.json &>/dev/null 2>&1; then
|
|
# Check for guest mode policy
|
|
if grep -rl 'BrowserGuestModeEnabled' "$policy_dir" &>/dev/null 2>&1; then
|
|
msg "Guest mode policy found in $policy_dir"
|
|
policy_found=true
|
|
fi
|
|
fi
|
|
done
|
|
|
|
if [[ $policy_found == false ]]; then
|
|
# Only flag as issue if a Chromium browser is actually installed
|
|
if command -v helium-browser &>/dev/null || command -v thorium-browser &>/dev/null || command -v chromium &>/dev/null || command -v google-chrome &>/dev/null || command -v brave-browser &>/dev/null; then
|
|
issues+=("No guest mode removal policies found for installed browsers")
|
|
status="error"
|
|
else
|
|
note "No Chromium-based browsers detected, skipping"
|
|
fi
|
|
fi
|
|
|
|
if [[ $status != "ok" ]]; then
|
|
for issue in "${issues[@]}"; do
|
|
err "$issue"
|
|
done
|
|
((ISSUES_FOUND++)) || true
|
|
|
|
if [[ $STATUS_ONLY -eq 0 ]]; then
|
|
note "Removing guest mode..."
|
|
if [[ -f $REMOVE_GUEST_MODE_SCRIPT ]]; then
|
|
run bash "$REMOVE_GUEST_MODE_SCRIPT"
|
|
((FIXES_APPLIED++)) || true
|
|
else
|
|
err_missing_script "Script not found: $REMOVE_GUEST_MODE_SCRIPT"
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
set_service_status "guest_mode_removal" "$status"
|
|
}
|
|
|
|
check_vbox_hosts() {
|
|
header "VirtualBox Hosts Enforcement"
|
|
|
|
local status="ok"
|
|
local issues=()
|
|
|
|
# Only check if VirtualBox is installed.
|
|
# This is NOT "skipped" in the sense of ducking a check: VirtualBox is absent
|
|
# AND deliberately blocked by pacman policy — pacman_blocked_keywords.txt lists
|
|
# virtualbox/vbox with the comment "can bypass /etc/hosts restrictions", which
|
|
# is the very thing this check enforces. With no VirtualBox there are no VMs to
|
|
# enforce /etc/hosts inside, so the check is genuinely not applicable. Report
|
|
# n/a so it reads as deliberate rather than something that got ducked.
|
|
if ! command -v VBoxManage &>/dev/null; then
|
|
note "VirtualBox not installed (blocked by pacman policy) — not applicable"
|
|
set_service_status "vbox_hosts" "n/a"
|
|
return
|
|
fi
|
|
|
|
# Check if enforcement marker exists
|
|
if [[ -f "${SYSROOT}/var/lib/vbox-hosts-enforced" ]]; then
|
|
msg "VirtualBox hosts enforcement marker exists"
|
|
else
|
|
issues+=("VirtualBox hosts enforcement not applied")
|
|
status="error"
|
|
fi
|
|
|
|
if [[ $status != "ok" ]]; then
|
|
for issue in "${issues[@]}"; do
|
|
err "$issue"
|
|
done
|
|
((ISSUES_FOUND++)) || true
|
|
|
|
if [[ $STATUS_ONLY -eq 0 ]]; then
|
|
note "Enforcing hosts in VirtualBox VMs..."
|
|
if [[ -f $VBOX_HOSTS_SCRIPT ]]; then
|
|
run bash "$VBOX_HOSTS_SCRIPT"
|
|
((FIXES_APPLIED++)) || true
|
|
else
|
|
err_missing_script "Script not found: $VBOX_HOSTS_SCRIPT"
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
set_service_status "vbox_hosts" "$status"
|
|
}
|
|
|
|
check_workout_locker() {
|
|
header "Workout Lock Screen"
|
|
|
|
local status="ok"
|
|
local issues=()
|
|
local user="${SUDO_USER:-$USER}"
|
|
|
|
# Check screen_lock.py script exists
|
|
if [[ -f $WORKOUT_LOCKER_SCRIPT ]]; then
|
|
msg "screen_lock.py exists at $WORKOUT_LOCKER_SCRIPT"
|
|
else
|
|
issues+=("screen_lock.py not found at $WORKOUT_LOCKER_SCRIPT")
|
|
status="error"
|
|
fi
|
|
|
|
# Check user service is enabled
|
|
if user_systemctl "$user" is-enabled workout-locker.service &>/dev/null 2>&1; then
|
|
msg "workout-locker.service is enabled (user service)"
|
|
else
|
|
issues+=("workout-locker.service is not enabled (user service)")
|
|
status="error"
|
|
fi
|
|
|
|
# Check user service is active (advisory — it only runs at login)
|
|
if user_systemctl "$user" is-active workout-locker.service &>/dev/null 2>&1; then
|
|
msg "workout-locker.service is active"
|
|
else
|
|
issues+=("workout-locker.service is not active (expected at login time)")
|
|
if [[ $status != "error" ]]; then status="warning"; fi
|
|
fi
|
|
|
|
if [[ $status != "ok" ]]; then
|
|
for issue in "${issues[@]}"; do
|
|
if [[ $status == "error" ]]; then
|
|
err "$issue"
|
|
else
|
|
warn "$issue"
|
|
fi
|
|
done
|
|
((ISSUES_FOUND++)) || true
|
|
|
|
if [[ $STATUS_ONLY -eq 0 && $status == "error" ]]; then
|
|
note "Installing workout locker service..."
|
|
if [[ -f $WORKOUT_LOCKER_INSTALL_SCRIPT ]]; then
|
|
run sudo -u "$user" bash "$WORKOUT_LOCKER_INSTALL_SCRIPT"
|
|
((FIXES_APPLIED++)) || true
|
|
# Re-verify
|
|
if [[ $DRY_RUN -eq 0 ]] && user_systemctl "$user" is-enabled workout-locker.service &>/dev/null 2>&1; then
|
|
status="ok"
|
|
fi
|
|
else
|
|
err_missing_script "Install script not found: $WORKOUT_LOCKER_INSTALL_SCRIPT"
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
set_service_status "workout_locker" "$status"
|
|
}
|