Skip to main content

Module setup

Module setup 

Source
Expand description

Host integration for the proxy: pitchfork proxy setup, --undo, doctor.

The supervisor itself never needs privileges. Everything that does — writing a resolver file, installing the CA, letting an unprivileged process reach ports 80 and 443 — is collected here, printed as a plan before anything runs, and reversed by --undo.

The plan is built from a SetupContext that carries every platform fact the steps depend on, so the same code can be exercised in tests for a platform the test is not running on.

Structs§

Plan
An ordered list of steps plus trailing advice.
PriorAutoProxy
An automatic-proxy setting as it stood before setup changed it.
Probe
A command run for its result rather than its effect.
RunReport
Outcome of running a plan, for reporting.
SetupContext
Everything the plan depends on, gathered up front so planning is pure.
SetupLock
Record a setup alongside the ones before it, for a later --undo.
Step
A single planned step: what it does, and how it is described.

Enums§

Action
One action in a plan.
Platform
Host platform, as far as setup is concerned.
ProbeExpect
A condition on a probe’s output.
Resource
The system resource a step installs or removes.

Functions§

apply
Run every step, skipping those already in effect.
clear_record
Forget the recorded setup, once it has been undone.
context_from_settings
Build the context for the current machine and settings.
gnome_proxy_available
Whether the GNOME proxy schema is present.
invoked_through_sudo
Whether the current process is already root, in which case sudo is unnecessary (and may not even be installed). The user who ran this process through sudo, when it is running as root on their behalf rather than as a genuine root login.
load_records
Every recorded setup, oldest first.
lock_setup
Take the lock that serialises a whole proxy setup run.
macos_network_services
plan
Build the plan for pitchfork proxy setup.
plan_undo
Build the plan for pitchfork proxy setup --undo.
plan_undo_from
The undo plan, reversing what setup recorded and what the settings imply.
plan_with_reconcile
The setup plan, preceded by removal of anything an earlier setup installed that this one supersedes.
read_prior_auto_proxy
Active macOS network services, as networksetup names them. Read the automatic-proxy configuration that is in place right now.
save_record
Record what this configuration set up, for a later --undo.
systemd_resolved_active
Whether systemd-resolved is the active stub resolver.
systemd_version
Major version of systemd, parsed from systemctl --version.
validate_proxy_port
Reject a proxy.port the proxy itself would refuse to listen on.
validate_tld
Reject a TLD that must not reach a privileged file path or a config file.