Compare commits

..

No commits in common. "2bf7f9a42dab90de43bb2bd316159e2db131b186" and "6383bd74529d2e679b6a6496516b96434eb7cf0d" have entirely different histories.

17 changed files with 109 additions and 146 deletions

View File

@ -1,35 +0,0 @@
{
"intent": "Turn main's red Pre-commit CI (dependency-freshness, 6+ findings since 6383bd74) green by moving every flagged pin to latest stable.",
"scope": [
"meta/requirements.txt, meta/requirements-test.txt, python_pkg/random_jpg/requirements.txt",
"Non-goal: .pre-commit-config.yaml hook revs (not flagged)"
],
"changes": [
"anthropic 1.15.0, hypothesis 6.170.1, pipdeptree 4.2.8, pre-commit 4.7.0, reorder-python-imports 3.19.0, ruff 0.17.1",
"pillow 12.3.0 -> 13.0.0 (major) in all three manifests"
],
"verification": [
{
"command": "pre-commit run dependency-freshness --all-files",
"result": "pass",
"evidence": "dependencies on newest stable....Passed (was FAILED: 6 findings in CI run 38918522094)"
},
{
"command": "python3 -m pytest -q python_pkg/artgate python_pkg/random_jpg (pillow 13.0.0 installed)",
"result": "pass",
"evidence": "128 passed in 0.21s; artgate and random_jpg are the only PIL importers"
},
{
"command": "uv pip compile -q meta/requirements.txt / meta/requirements-test.txt",
"result": "pass",
"evidence": "both resolve, rc=0"
}
],
"risks": [
"pillow 13 major: API removals could hit untested PIL paths in artgate/random_jpg"
],
"rollback": [
"git revert this commit",
"re-run pre-commit run dependency-freshness --all-files"
]
}

View File

@ -1,34 +0,0 @@
{
"intent": "The pacman wrapper no longer has blocked-keyword, white or grey lists (removed in digital-wellbeing e2a7176); stop the services checker and docs from expecting them.",
"scope": [
"linux_configuration/periodic_background/lib/services_wrappers.sh and its test",
"linux_configuration/periodic_background/lib/services_browser.sh comment + note",
"linux_configuration/.github/copilot-instructions.md and linux_configuration/docs pacman docs",
"Non-goal: the wrapper itself lives in ~/src/digital-wellbeing"
],
"changes": [
"check_pacman_wrapper only checks words.txt as a supporting file, no longer pacman_blocked_keywords.txt / pacman_whitelist.txt",
"test_services_wrappers.sh stages and removes only words.txt",
"VirtualBox n/a note no longer claims it is blocked by pacman policy",
"Docs drop the list files, greylist challenge and comparisons; integrity/immutability text now names the lock lib and pw_*.sh"
],
"verification": [
{
"command": "bash linux_configuration/periodic_background/lib/tests/run_all.sh",
"result": "pass",
"evidence": "test_services_wrappers.sh: 29 passed, 0 failed; All check_and_enable_services test files passed."
},
{
"command": "bash linux_configuration/periodic_background/check_and_enable_services.sh --status",
"result": "pass",
"evidence": "Supporting file exists: /usr/local/bin/words.txt; no list-file lines; 'VirtualBox not installed — not applicable'. Drift flagged as expected until the hourly reinstall deploys digital-wellbeing e2a7176."
}
],
"risks": [
"VirtualBox is now installable without friction; only post-transaction VM removal remains"
],
"rollback": [
"git revert this commit together with digital-wellbeing e2a7176",
"Re-run install_pacman_wrapper.sh and check_and_enable_services.sh --status"
]
}

View File

@ -9,7 +9,7 @@ This repo automates Linux desktop bootstrap, hardening, and i3 setup. It’s pri
- `hosts/install.sh` builds and locks `/etc/hosts` (immutable/append-only; selective unblocks; custom blocks). - `hosts/install.sh` builds and locks `/etc/hosts` (immutable/append-only; selective unblocks; custom blocks).
- `hosts/guard/` enforcement is provided by guard-lib (`guardctl`, installed outside this repo): a `file-guard` instance per target (`hosts`, `nsswitch`, `resolved`) with a path-watcher, optional RO bind mount, generic pacman hooks, and per-target plugins under `hosts/guard/plugins/`. The pre-guard-lib scripts (`setup_hosts_guard.sh`, `enforce-*.sh`, per-target systemd units, `psychological/unlock-hosts.sh`) are archived at github.com/kuhyx/testsAndMisc-archive — see `./fixes/migrate_hosts_guard_to_guard_lib.sh` for how the migration works. - `hosts/guard/` enforcement is provided by guard-lib (`guardctl`, installed outside this repo): a `file-guard` instance per target (`hosts`, `nsswitch`, `resolved`) with a path-watcher, optional RO bind mount, generic pacman hooks, and per-target plugins under `hosts/guard/plugins/`. The pre-guard-lib scripts (`setup_hosts_guard.sh`, `enforce-*.sh`, per-target systemd units, `psychological/unlock-hosts.sh`) are archived at github.com/kuhyx/testsAndMisc-archive — see `./fixes/migrate_hosts_guard_to_guard_lib.sh` for how the migration works.
- periodic_background/digital_wellbeing/pacman/: a policy-aware pacman wrapper with friction mechanics. - periodic_background/digital_wellbeing/pacman/: a policy-aware pacman wrapper with friction mechanics.
- `pacman_wrapper.sh` intercepts transactions, runs hosts-guard pre/post hooks, handles stale db lock, auto-wires maintenance services, adds a weekend-only “Steam” challenge powered by `words.txt`, and removes VirtualBox VMs after each transaction. It has no package block/allow lists (retired 2026-10-17; hosts/DNS blocking covers that). - `pacman_wrapper.sh` intercepts transactions, runs hosts-guard pre/post hooks, handles stale db lock, auto-wires maintenance services, and enforces package policy (blocked/whitelisted lists); adds weekend-only “Steam” challenge and a VirtualBox challenge powered by `words.txt`.
- `install_pacman_wrapper.sh` backs up `/usr/bin/pacman` to `pacman.orig` and symlinks to the wrapper. - `install_pacman_wrapper.sh` backs up `/usr/bin/pacman` to `pacman.orig` and symlinks to the wrapper.
- periodic_background/system-maintenance/: templates and installer for periodic jobs and monitoring. - periodic_background/system-maintenance/: templates and installer for periodic jobs and monitoring.
- `setup_periodic_system.sh` installs: `/usr/local/bin/periodic-system-maintenance.sh`, a timer (`periodic-system-maintenance.timer`), a startup oneshot, and `hosts-file-monitor.service` that restores `/etc/hosts` if tampered. Also installs a browser pre-exec wrapper that re-runs the hosts installer before launching common browsers. - `setup_periodic_system.sh` installs: `/usr/local/bin/periodic-system-maintenance.sh`, a timer (`periodic-system-maintenance.timer`), a startup oneshot, and `hosts-file-monitor.service` that restores `/etc/hosts` if tampered. Also installs a browser pre-exec wrapper that re-runs the hosts installer before launching common browsers.
@ -44,7 +44,7 @@ This repo automates Linux desktop bootstrap, hardening, and i3 setup. It’s pri
- Follow the sudo re-exec + idempotent install pattern from `setup_periodic_system.sh` and `./fixes/migrate_hosts_guard_to_guard_lib.sh`. - Follow the sudo re-exec + idempotent install pattern from `setup_periodic_system.sh` and `./fixes/migrate_hosts_guard_to_guard_lib.sh`.
- Add new periodic behaviors as templates under `periodic_background/system-maintenance/bin` and `.../systemd`, then extend `setup_periodic_system.sh` to install/enable them. - Add new periodic behaviors as templates under `periodic_background/system-maintenance/bin` and `.../systemd`, then extend `setup_periodic_system.sh` to install/enable them.
- Add package friction by adding `check_for_<pkg>` + `prompt_for_<pkg>_challenge` blocks in the wrapper (now in github.com/kuhyx/digital-wellbeing). - Extend package policy by updating `periodic_background/digital_wellbeing/pacman/pacman_blocked_keywords.txt` or by adding `check_for_<pkg>` + `prompt_for_<pkg>_challenge` blocks in the wrapper.
- Run `meta/shell_check.sh` to detect things to fix before committing. - Run `meta/shell_check.sh` to detect things to fix before committing.
## Detailed LLM Documentation ## Detailed LLM Documentation

View File

@ -4,22 +4,22 @@
The pacman wrapper had two critical security vulnerabilities: The pacman wrapper had two critical security vulnerabilities:
1. **Easy Policy Bypass**: Users could edit the wrapper's helper libs (`pacman_lock_lib.sh`, `pw_*.sh`) to remove restrictions, reinstall the wrapper, and bypass them. 1. **Easy Policy Bypass**: Users could edit `pacman_greylist.txt` to remove "virtualbox", reinstall the wrapper, and bypass all restrictions.
2. **VirtualBox Hosts Bypass**: VirtualBox VMs do not inherit the host's `/etc/hosts` file, allowing complete circumvention of content filtering inside VMs. 2. **VirtualBox Hosts Bypass**: VirtualBox VMs do not inherit the host's `/etc/hosts` file, allowing complete circumvention of content filtering inside VMs.
## Solution Overview ## Solution Overview
Implemented a **defense-in-depth** security architecture with multiple layers: Implemented a **defense-in-depth** security architecture with multiple layers:
### Layer 1: Immutable Lock Lib ### Layer 1: Immutable Policy Files
- The lock lib (`pacman_lock_lib.sh`) is made immutable using `chattr +i`; the `pw_*.sh` libs are only checksummed - Policy files (`pacman_blocked_keywords.txt`, `pacman_greylist.txt`) are made immutable using `chattr +i`
- Prevents casual editing without root access and knowledge of filesystem attributes - Prevents casual editing without root access and knowledge of filesystem attributes
- Requires explicit `chattr -i` command to modify - Requires explicit `chattr -i` command to modify
### Layer 2: SHA256 Integrity Checks ### Layer 2: SHA256 Integrity Checks
- SHA256 checksums generated for the wrapper libs during installation - SHA256 checksums generated for all policy files during installation
- Stored in `/var/lib/pacman-wrapper/policy.sha256` (also made immutable) - Stored in `/var/lib/pacman-wrapper/policy.sha256` (also made immutable)
- **Every wrapper invocation** verifies file integrity before proceeding - **Every wrapper invocation** verifies file integrity before proceeding
- **Blocks all operations** if tampering is detected - **Blocks all operations** if tampering is detected
@ -29,11 +29,11 @@ Implemented a **defense-in-depth** security architecture with multiple layers:
- VirtualBox detection is **compiled into the wrapper code** - VirtualBox detection is **compiled into the wrapper code**
- Cannot be bypassed by editing any text file - Cannot be bypassed by editing any text file
- Catches all packages matching `*virtualbox*` or `*vbox*` patterns - Catches all packages matching `*virtualbox*` or `*vbox*` patterns
- Difficult word challenge: - More difficult challenge than standard greylist:
- 7-letter words - 7-letter words (vs 6 for greylist)
- 150 words to memorize - 150 words to memorize (vs 120)
- 120-second timeout - 120-second timeout (vs 90s)
- 45-second initial delay - 45-second initial delay (vs 30s)
### Layer 4: VirtualBox Enforcement ### Layer 4: VirtualBox Enforcement
@ -69,7 +69,7 @@ Implemented a **defense-in-depth** security architecture with multiple layers:
### What's Now Protected ### What's Now Protected
✅ Wrapper libs cannot be modified unnoticed (lock lib immutable, all libs checksummed) ✅ Policy files cannot be easily modified (immutable + checksums)
✅ VirtualBox restrictions are hardcoded (cannot bypass via file editing) ✅ VirtualBox restrictions are hardcoded (cannot bypass via file editing)
✅ VMs inherit host's content filtering (DNS proxy + shared hosts) ✅ VMs inherit host's content filtering (DNS proxy + shared hosts)
✅ Tampering is immediately detected and blocked ✅ Tampering is immediately detected and blocked
@ -96,7 +96,7 @@ Tests verify:
- Integrity check function exists and is called early - Integrity check function exists and is called early
- Hardcoded VirtualBox detection exists - Hardcoded VirtualBox detection exists
- VirtualBox challenge function exists - VirtualBox challenge function exists
- The lock lib is made immutable - Policy files are made immutable
- VirtualBox enforcement is integrated - VirtualBox enforcement is integrated
- Error handling is proper - Error handling is proper
@ -109,9 +109,9 @@ sudo ./install_pacman_wrapper.sh
This will: This will:
1. Install wrapper and wrapper libs 1. Install wrapper and policy files
2. Generate SHA256 checksums 2. Generate SHA256 checksums
3. Make the lock lib immutable with `chattr +i` 3. Make policy files immutable with `chattr +i`
4. Install VirtualBox enforcement script 4. Install VirtualBox enforcement script
5. Set up automatic enforcement 5. Set up automatic enforcement
@ -128,15 +128,15 @@ This will:
- Must complete difficult word challenge (7-letter words, 120s timeout) - Must complete difficult word challenge (7-letter words, 120s timeout)
- Enhanced warnings about security implications - Enhanced warnings about security implications
- Automatic VM configuration after successful installation - Automatic VM configuration after successful installation
- Cannot bypass by editing wrapper libs - Cannot bypass by editing policy files
### For Updating Policies ### For Updating Policies
If legitimate policy updates are needed: If legitimate policy updates are needed:
```bash ```bash
sudo chattr -i /usr/local/bin/pacman_lock_lib.sh sudo chattr -i /usr/local/bin/pacman_greylist.txt
sudo nano /usr/local/bin/pacman_lock_lib.sh sudo nano /usr/local/bin/pacman_greylist.txt
cd periodic_background/digital_wellbeing/pacman cd periodic_background/digital_wellbeing/pacman
sudo ./install_pacman_wrapper.sh # Regenerates checksums sudo ./install_pacman_wrapper.sh # Regenerates checksums
``` ```

View File

@ -8,35 +8,35 @@ This document describes the security enhancements made to the pacman wrapper to
The original pacman wrapper had the following vulnerabilities: The original pacman wrapper had the following vulnerabilities:
1. **Easy Policy Bypass**: Users could edit the wrapper's helper libs (`pacman_lock_lib.sh`, `pw_*.sh`) to remove restrictions, then reinstall the wrapper. 1. **Easy Policy Bypass**: Users could edit `pacman_greylist.txt` or `pacman_blocked_keywords.txt` to remove restrictions, then reinstall the wrapper.
2. **VirtualBox Hosts Bypass**: VirtualBox VMs do not inherit the host machine's `/etc/hosts` file, allowing users to bypass content filtering within VMs. 2. **VirtualBox Hosts Bypass**: VirtualBox VMs do not inherit the host machine's `/etc/hosts` file, allowing users to bypass content filtering within VMs.
3. **No Tamper Detection**: The wrapper had no mechanism to detect if wrapper libs had been modified. 3. **No Tamper Detection**: The wrapper had no mechanism to detect if policy files had been modified.
## Solutions Implemented ## Solutions Implemented
### 1. Wrapper Lib Integrity Checks ### 1. Policy File Integrity Checks
**File**: `periodic_background/digital_wellbeing/pacman/install_pacman_wrapper.sh` **File**: `periodic_background/digital_wellbeing/pacman/install_pacman_wrapper.sh`
The installer now: The installer now:
- Generates SHA256 checksums of all wrapper libs during installation - Generates SHA256 checksums of all policy files during installation
- Stores checksums in `/var/lib/pacman-wrapper/policy.sha256` - Stores checksums in `/var/lib/pacman-wrapper/policy.sha256`
- Makes the integrity file immutable using `chattr +i` - Makes the integrity file immutable using `chattr +i`
- Makes the lock lib (`pacman_lock_lib.sh`) immutable - Makes policy files (`pacman_blocked_keywords.txt`, `pacman_greylist.txt`) immutable
**File**: `periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh` **File**: `periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh`
The wrapper now: The wrapper now:
- Verifies wrapper lib integrity on **every invocation** - Verifies policy file integrity on **every invocation**
- Compares current file checksums against stored checksums - Compares current file checksums against stored checksums
- **Blocks all operations** if tampering is detected - **Blocks all operations** if tampering is detected
- Displays security warnings and instructs user to reinstall - Displays security warnings and instructs user to reinstall
**Benefits**: **Benefits**:
- Cannot bypass restrictions by editing wrapper libs - Cannot bypass restrictions by editing policy files
- Tampering is immediately detected and blocked - Tampering is immediately detected and blocked
- Must use `chattr -i` (requires root) to modify files, making bypass harder - Must use `chattr -i` (requires root) to modify files, making bypass harder
@ -44,7 +44,7 @@ The wrapper now:
**File**: `periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh` **File**: `periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh`
Added hardcoded VirtualBox detection that **cannot be bypassed** by editing wrapper libs: Added hardcoded VirtualBox detection that **cannot be bypassed** by editing policy files:
```bash ```bash
function is_virtualbox_package() { function is_virtualbox_package() {
@ -61,9 +61,9 @@ This function:
**Enhanced Challenge**: **Enhanced Challenge**:
- 7-letter words - 7-letter words (harder than greylist's 6-letter words)
- 150 words to memorize - 150 words to memorize (more than greylist's 120)
- 120-second timeout - 120-second timeout (longer than greylist's 90s)
- 45-second initial delay (psychological friction) - 45-second initial delay (psychological friction)
- 30-50 second post-challenge delay - 30-50 second post-challenge delay
@ -128,13 +128,13 @@ The installer now:
### What's Protected ### What's Protected
1. **Wrapper libs cannot be easily modified**: 1. **Policy files cannot be easily modified**:
- Immutable attribute prevents casual editing - Immutable attribute prevents casual editing
- Requires `chattr -i` which requires root and knowledge - Requires `chattr -i` which requires root and knowledge
- Changes are detected on next wrapper invocation - Changes are detected on next wrapper invocation
2. **VirtualBox restrictions are hardcoded**: 2. **VirtualBox restrictions are hardcoded**:
- Cannot remove by editing wrapper libs - Cannot remove by editing policy files
- Would require modifying the wrapper code itself - Would require modifying the wrapper code itself
- Integrity checks would detect wrapper modification - Integrity checks would detect wrapper modification

View File

@ -28,21 +28,22 @@ sudo ./install_pacman_wrapper.sh
This will: This will:
- Install the wrapper and wrapper libs - Install the wrapper and policy files
- Generate integrity checksums - Generate integrity checksums
- Make the lock lib immutable - Make policy files immutable
- Install VirtualBox enforcement script - Install VirtualBox enforcement script
### Updating Wrapper Libs ### Updating Policy Files
If you need to legitimately update wrapper libs: If you need to legitimately update policy files:
```bash ```bash
# Remove immutable attribute # Remove immutable attribute
sudo chattr -i /usr/local/bin/pacman_lock_lib.sh sudo chattr -i /usr/local/bin/pacman_blocked_keywords.txt
sudo chattr -i /usr/local/bin/pacman_greylist.txt
# Edit files as needed # Edit files as needed
sudo nano /usr/local/bin/pacman_lock_lib.sh sudo nano /usr/local/bin/pacman_greylist.txt
# Reinstall wrapper to update checksums # Reinstall wrapper to update checksums
cd periodic_background/digital_wellbeing/pacman cd periodic_background/digital_wellbeing/pacman
@ -77,7 +78,7 @@ sudo chmod +x /usr/local/bin/vbox_sync.sh
These enhancements follow the principle of **defense in depth**: These enhancements follow the principle of **defense in depth**:
- **Layer 1**: Immutable lock lib (prevents casual editing) - **Layer 1**: Immutable policy files (prevents casual editing)
- **Layer 2**: Integrity checksums (detects tampering) - **Layer 2**: Integrity checksums (detects tampering)
- **Layer 3**: Hardcoded restrictions (cannot bypass via files) - **Layer 3**: Hardcoded restrictions (cannot bypass via files)
- **Layer 4**: VirtualBox enforcement (prevents VM bypass) - **Layer 4**: VirtualBox enforcement (prevents VM bypass)
@ -90,7 +91,7 @@ Each layer adds difficulty, making circumvention progressively harder while main
Potential improvements: Potential improvements:
1. **Digital signatures**: Sign the wrapper script itself to detect modifications 1. **Digital signatures**: Sign the wrapper script itself to detect modifications
2. **Remote updates**: Fetch wrapper libs from a trusted source 2. **Remote policy updates**: Fetch policy files from a trusted source
3. **Logging**: Log all wrapper invocations and challenges to detect patterns 3. **Logging**: Log all wrapper invocations and challenges to detect patterns
4. **Time-based restrictions**: Different rules for different times/days 4. **Time-based restrictions**: Different rules for different times/days
5. **Multi-factor challenges**: Combine word challenges with other verification methods 5. **Multi-factor challenges**: Combine word challenges with other verification methods

View File

@ -80,18 +80,20 @@
**Files involved:** **Files involved:**
- [periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh](../periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh) (823 lines) - [periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh](../periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh) (823 lines)
- [periodic_background/digital_wellbeing/pacman/pacman_blocked_keywords.txt](../periodic_background/digital_wellbeing/pacman/pacman_blocked_keywords.txt)
- [periodic_background/digital_wellbeing/pacman/install_pacman_wrapper.sh](../periodic_background/digital_wellbeing/pacman/install_pacman_wrapper.sh) - [periodic_background/digital_wellbeing/pacman/install_pacman_wrapper.sh](../periodic_background/digital_wellbeing/pacman/install_pacman_wrapper.sh)
**Current Protection:** **Current Protection:**
1. ✅ Wrapper lib integrity verification (SHA256) 1. ✅ Policy file integrity verification (SHA256)
2. ✅ VirtualBox hardcoded check (cannot bypass via wrapper libs) 2. ✅ Blocked keywords list
3. ✅ Steam weekend-only restriction 3. ✅ Greylist with challenge
4. ✅ VirtualBox hardcoded check (cannot bypass via policy files)
_Note: the package policy lists (blocked keywords, whitelist, greylist) were retired 2026-10-17; hosts/DNS blocking covers them._ 5. ✅ Steam weekend-only restriction
**VULNERABILITIES IDENTIFIED:** **VULNERABILITIES IDENTIFIED:**
- ❌ **Google Chrome not blocked** - `google-chrome` and `google-chrome-stable` missing from blocked list
- ❌ No automatic LeechBlock installation when browsers are detected - ❌ No automatic LeechBlock installation when browsers are detected
- ❌ User can download `.deb`/`.tar.gz` and install manually - ❌ User can download `.deb`/`.tar.gz` and install manually

View File

@ -57,10 +57,16 @@ Changes needed:
- Add input focus grabbing to prevent Alt+Tab escape - Add input focus grabbing to prevent Alt+Tab escape
- Disable window close keyboard shortcuts - Disable window close keyboard shortcuts
## 4. PACMAN WRAPPER - LeechBlock Auto-Install ## 4. PACMAN WRAPPER - Chrome Block + LeechBlock Auto-Install
Location: periodic_background/digital_wellbeing/pacman/ Location: periodic_background/digital_wellbeing/pacman/
Changes needed to pacman_blocked_keywords.txt:
- Add: google-chrome
- Add: google-chrome-stable
- Add: chromium
- Add: ungoogled-chromium
New behavior in pacman_wrapper.sh: New behavior in pacman_wrapper.sh:
- After ANY browser is detected installed (via pacman -Qq check): - After ANY browser is detected installed (via pacman -Qq check):
- Automatically run install_leechblock.sh if it exists - Automatically run install_leechblock.sh if it exists
@ -160,6 +166,7 @@ Modified files:
- hosts/guard/setup_hosts_guard.sh (add nsswitch protection) - hosts/guard/setup_hosts_guard.sh (add nsswitch protection)
- periodic_background/digital_wellbeing/setup_midnight_shutdown.sh (remove helpful messages) - periodic_background/digital_wellbeing/setup_midnight_shutdown.sh (remove helpful messages)
- periodic_background/digital_wellbeing/pacman/pacman_blocked_keywords.txt (add chrome)
- periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh (leechblock auto-install) - periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh (leechblock auto-install)
- periodic_background/digital_wellbeing/block_compulsive_opening.sh (auto-close timer) - periodic_background/digital_wellbeing/block_compulsive_opening.sh (auto-close timer)
- periodic_background/digital_wellbeing/youtube-music-wrapper.sh (daemon integration) - periodic_background/digital_wellbeing/youtube-music-wrapper.sh (daemon integration)

View File

@ -85,22 +85,27 @@ FILES YOU KNOW:
- periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh - Main wrapper (823 lines) - periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh - Main wrapper (823 lines)
- periodic_background/digital_wellbeing/pacman/install_pacman_wrapper.sh - Backs up real pacman - periodic_background/digital_wellbeing/pacman/install_pacman_wrapper.sh - Backs up real pacman
- periodic_background/digital_wellbeing/pacman/pacman_blocked_keywords.txt - Always blocked
- periodic_background/digital_wellbeing/pacman/pacman_whitelist.txt - Exceptions to keywords
- periodic_background/digital_wellbeing/pacman/pacman_greylist.txt - Challenge required
- periodic_background/digital_wellbeing/pacman/words.txt - Word scramble challenge words - periodic_background/digital_wellbeing/pacman/words.txt - Word scramble challenge words
- /var/lib/pacman-wrapper/policy.sha256 - Integrity checksums - /var/lib/pacman-wrapper/policy.sha256 - Integrity checksums
KEY CONCEPTS: KEY CONCEPTS:
- Real pacman at /usr/bin/pacman.orig, wrapper symlinked to /usr/bin/pacman - Real pacman at /usr/bin/pacman.orig, wrapper symlinked to /usr/bin/pacman
- Wrapper lib integrity verification via SHA256 before ANY operation - Policy integrity verification via SHA256 before ANY operation
- Package policy lists (blocked/greylist/whitelist) were retired 2026-10-17; hosts/DNS blocking covers them - Three tiers: blocked (always denied), greylist (challenge), whitelist (bypass)
- VirtualBox check is HARDCODED (cannot bypass via wrapper libs) - VirtualBox check is HARDCODED (cannot bypass via policy files)
- Steam is weekend-only with word scramble challenge - Steam is weekend-only with word scramble challenge
POLICY ENFORCEMENT: POLICY ENFORCEMENT:
1. Verify integrity hashes match 1. Load policy lists from text files
2. Apply the hardcoded checks (VirtualBox challenge, Steam weekend challenge) 2. Verify integrity hashes match
3. Auto-install LeechBlock when a browser is installed 3. Check if package matches blocked keywords (unless whitelisted)
4. Check if greylisted (requires challenge)
5. After transaction, remove any blocked packages that got installed
HOSTS INTEGRATION: HOSTS INTEGRATION:

View File

@ -68,13 +68,14 @@ Intercept pacman to enforce package installation policies.
```` ````
## Files ## Policy Files
| File | Purpose | | File | Purpose |
|------|---------| |------|---------|
| pacman_blocked_keywords.txt | Substring match = always blocked |
| pacman_whitelist.txt | Exact names that bypass blocking |
| pacman_greylist.txt | Requires challenge to install |
| words.txt | Word scramble challenge source | | words.txt | Word scramble challenge source |
_Package policy lists (blocked keywords, whitelist, greylist) were retired 2026-10-17; hosts/DNS blocking covers them._
## Hardcoded Checks (cannot bypass via files) ## Hardcoded Checks (cannot bypass via files)
- VirtualBox → security challenge + hosts enforcement - VirtualBox → security challenge + hosts enforcement
- Steam → weekend-only + word scramble - Steam → weekend-only + word scramble
@ -84,8 +85,11 @@ _Package policy lists (blocked keywords, whitelist, greylist) were retired 2026-
2. Periodic maintenance (auto-setup if missing) 2. Periodic maintenance (auto-setup if missing)
3. VirtualBox hosts enforcement 3. VirtualBox hosts enforcement
## Updating the wrapper ## Adding Blocks
```bash ```bash
# Edit the blocked keywords file
echo "newpackage" >> pacman_blocked_keywords.txt
# Re-run installer to update checksums # Re-run installer to update checksums
sudo ./install_pacman_wrapper.sh sudo ./install_pacman_wrapper.sh
```` ````

View File

@ -50,6 +50,13 @@ else
test_result "pacman wrapper installed" "fail" test_result "pacman wrapper installed" "fail"
fi fi
# Test 5: google-chrome is blocked
if grep -qi "google-chrome" ~/src/testsAndMisc/linux_configuration/scripts/periodic_background/digital_wellbeing/pacman/pacman_blocked_keywords.txt; then
test_result "google-chrome in blocked list" "pass"
else
test_result "google-chrome in blocked list" "fail"
fi
# Summary # Summary
echo "" echo ""
echo "==========================================" echo "=========================================="
@ -68,6 +75,6 @@ This analysis identifies critical vulnerabilities and provides a comprehensive i
1. **nsswitch.conf bypass** - Completely unprotected, defeats all hosts protections 1. **nsswitch.conf bypass** - Completely unprotected, defeats all hosts protections
2. **Information disclosure** - Shutdown system tells users how to bypass 2. **Information disclosure** - Shutdown system tells users how to bypass
3. **App lifetime** - Compulsive blockers don't limit session duration 3. **App lifetime** - Compulsive blockers don't limit session duration
4. **Browser gaps** - no LeechBlock auto-install 4. **Browser gaps** - Chrome not blocked, no LeechBlock auto-install
The implementation prompt above should be used in a focused coding session to address all issues systematically. The implementation prompt above should be used in a focused coding session to address all issues systematically.

View File

@ -72,12 +72,14 @@ check_vbox_hosts() {
local issues=() local issues=()
# Only check if VirtualBox is installed. # Only check if VirtualBox is installed.
# This is NOT "skipped" in the sense of ducking a check: with no VirtualBox # This is NOT "skipped" in the sense of ducking a check: VirtualBox is absent
# there are no VMs to enforce /etc/hosts inside, so the check is genuinely not # AND deliberately blocked by pacman policy — pacman_blocked_keywords.txt lists
# applicable. Report n/a so it reads as deliberate rather than something that # virtualbox/vbox with the comment "can bypass /etc/hosts restrictions", which
# got ducked. # 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 if ! command -v VBoxManage &>/dev/null; then
note "VirtualBox not installed — not applicable" note "VirtualBox not installed (blocked by pacman policy) — not applicable"
set_service_status "vbox_hosts" "n/a" set_service_status "vbox_hosts" "n/a"
return return
fi fi

View File

@ -50,11 +50,13 @@ check_pacman_wrapper() {
fi fi
# Check supporting files # Check supporting files
if [[ -f "${SYSROOT}/usr/local/bin/words.txt" ]]; then for file in words.txt pacman_blocked_keywords.txt pacman_whitelist.txt; do
msg "Supporting file exists: ${SYSROOT}/usr/local/bin/words.txt" if [[ -f "${SYSROOT}/usr/local/bin/$file" ]]; then
else msg "Supporting file exists: ${SYSROOT}/usr/local/bin/$file"
warn "Supporting file missing: ${SYSROOT}/usr/local/bin/words.txt" else
fi warn "Supporting file missing: ${SYSROOT}/usr/local/bin/$file"
fi
done
# Content drift — the check everything above misses. A correct symlink and a # Content drift — the check everything above misses. A correct symlink and a
# present file say nothing about WHICH version is deployed. # present file say nothing about WHICH version is deployed.

View File

@ -23,6 +23,8 @@ stage_pacman_ok() {
sysfile usr/bin/pacman.orig sysfile usr/bin/pacman.orig
ln -sf "${SERVICES_ROOT}/usr/local/bin/pacman_wrapper" "${SERVICES_ROOT}/usr/bin/pacman" ln -sf "${SERVICES_ROOT}/usr/local/bin/pacman_wrapper" "${SERVICES_ROOT}/usr/bin/pacman"
sysfile usr/local/bin/words.txt sysfile usr/local/bin/words.txt
sysfile usr/local/bin/pacman_blocked_keywords.txt
sysfile usr/local/bin/pacman_whitelist.txt
(cd "${SERVICES_ROOT}" && sha256sum usr/local/bin/pacman_wrapper >"$PACMAN_WRAPPER_MANIFEST") (cd "${SERVICES_ROOT}" && sha256sum usr/local/bin/pacman_wrapper >"$PACMAN_WRAPPER_MANIFEST")
} }
@ -108,7 +110,7 @@ _t_called 'ran install_pacman_wrapper' "a missing .orig backup runs the installe
echo "== check_pacman_wrapper: missing supporting files only warn ==" echo "== check_pacman_wrapper: missing supporting files only warn =="
reset_state reset_state
stage_pacman_ok stage_pacman_ok
sysrm usr/local/bin/words.txt sysrm usr/local/bin/words.txt usr/local/bin/pacman_whitelist.txt
run_pacman_check >"${TEST_TMPDIR}/out.txt" run_pacman_check >"${TEST_TMPDIR}/out.txt"
_t_called_in "$(cat "${TEST_TMPDIR}/out.txt")" "Supporting file missing" "a missing supporting file is reported" _t_called_in "$(cat "${TEST_TMPDIR}/out.txt")" "Supporting file missing" "a missing supporting file is reported"
_t_not_called 'ran install_pacman_wrapper' "but it does not trigger a reinstall" _t_not_called 'ran install_pacman_wrapper' "but it does not trigger a reinstall"

View File

@ -21,14 +21,14 @@
# suite itself fails loudly here on a missing import. # suite itself fails loudly here on a missing import.
# ============================================================================== # ==============================================================================
anthropic==1.15.0 anthropic==1.13.0
beautifulsoup4==4.15.0 beautifulsoup4==4.15.0
coverage==7.16.2 coverage==7.16.2
defusedxml==0.7.1 defusedxml==0.7.1
genanki==0.13.1 genanki==0.13.1
markdownify==1.2.3 markdownify==1.2.3
numpy==2.5.4 numpy==2.5.4
pillow==13.0.0 pillow==12.3.0
pytest==9.1.1 pytest==9.1.1
pytest-cov==7.1.0 pytest-cov==7.1.0
pytest-randomly==5.0.0 pytest-randomly==5.0.0

View File

@ -6,7 +6,7 @@
add-trailing-comma==4.0.0 add-trailing-comma==4.0.0
aiohttp==3.14.5 aiohttp==3.14.5
anthropic==1.15.0 anthropic==1.13.0
autoflake==2.4.0 autoflake==2.4.0
autopep8==2.3.2 autopep8==2.3.2
bandit==1.9.4 bandit==1.9.4
@ -39,7 +39,7 @@ gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.9.0#subdirectory=gatel
genanki==0.13.1 genanki==0.13.1
geopandas==1.2.0 geopandas==1.2.0
howlongtobeatpy==1.0.24 howlongtobeatpy==1.0.24
hypothesis==6.170.1 hypothesis==6.169.0
importlib-metadata==9.0.1 importlib-metadata==9.0.1
interrogate==1.7.0 interrogate==1.7.0
# isort is deliberately not pinned: nothing here imports it (ruff's isort # isort is deliberately not pinned: nothing here imports it (ruff's isort
@ -53,10 +53,10 @@ mccabe==0.7.0
mypy==2.4.0 mypy==2.4.0
numpy==2.5.4 numpy==2.5.4
opencv-python==5.0.0.93 opencv-python==5.0.0.93
pillow==13.0.0 pillow==12.3.0
pip-audit==2.10.1 pip-audit==2.10.1
pipdeptree==4.2.8 pipdeptree==4.2.7
pre-commit==4.7.0 pre-commit==4.6.2
prospector==1.19.1 prospector==1.19.1
pycodestyle==2.15.0 pycodestyle==2.15.0
pydocstyle==6.3.0 pydocstyle==6.3.0
@ -74,10 +74,10 @@ python-chess==1.999
python-kasa==0.11.0.1 python-kasa==0.11.0.1
pyupgrade==3.22.0 pyupgrade==3.22.0
radon==6.0.1 radon==6.0.1
reorder-python-imports==3.19.0 reorder-python-imports==3.18.0
requests==2.34.2 requests==2.34.2
rich==15.0.0 rich==15.0.0
ruff==0.17.1 ruff==0.17.0
# safety is deliberately not pinned: its only reference in this repo is a # safety is deliberately not pinned: its only reference in this repo is a
# commented-out pre-commit hook, and safety 3.8.1 declares `typer<0.26`, # commented-out pre-commit hook, and safety 3.8.1 declares `typer<0.26`,
# which would hold the typer this repo actually imports below latest. # which would hold the typer this repo actually imports below latest.

View File

@ -1 +1 @@
pillow==13.0.0 pillow==12.3.0