Networking and Remote Access

Identify the layer, bound the check, verify the endpoint, and preserve every outcome.

A connection has several distinct questions

name -> address -> route -> transport endpoint -> TLS identity -> application

A port is not a process identity. A listening socket does not prove external reachability. Ping does not establish HTTP health, and a denied ping does not prove HTTP is down.

Use only instructor-approved endpoints. Automatic request fixtures stay on loopback.

Observe local network state without scanning

ip -brief address
ip route show
ss -ltn

Linux-only bounded snapshots. A route lookup describes a local choice, not a completed connection. Missing process ownership details can reflect access limits.

macOS uses different interfaces; it does not emulate these Linux observations.

Allow only the ports you serve

sudo ufw allow OpenSSH      # before enable
sudo ufw enable
sudo ufw allow 80/tcp
sudo ufw status verbose
sudo ufw delete allow 80/tcp   # removes IPv4 and IPv6 copies

A listener answers "ready?"; the firewall answers "allowed?". Providers may add another layer.

Test one complete HTTP exchange

The supplied Python 3 fixture binds an ephemeral loopback port and handles one request.

curl --noproxy '*' --connect-timeout 2 --max-time 3 -fsS "$fixture_url"

Expected known body: ok. The fixture verifies response, status, and diagnostics, then collects the server process.

This does not test DNS or TLS. A separate bounded closed-endpoint case records connection failure.

SSH identity and user authentication differ

Verify the server host-key fingerprint through the trusted course channel before enrollment. Protect private keys and never place them in lesson files.

Use BatchMode for unattended checks and StrictHostKeyChecking=yes after onboarding. Do not bypass an identity error to make a check appear successful.

An encrypted session alone does not authorize a task.

Set up key-based login

ssh-keygen -t ed25519 -C "your_name laptop"     # on your computer
ssh-copy-id -i ~/.ssh/id_ed25519.pub student_user@VM_ADDRESS
ssh -o BatchMode=yes labvm whoami                # alias in ~/.ssh/config

Share only the .pub file. The private key stays on your computer, mode 600, with a passphrase.

Control where expansion occurs

A quoted here-document sends literal source text to the receiving Bash. An unquoted delimiter can expand variables on the sender first.

The lesson labels its local child-shell trace as local. The separate integration actually runs the inspected payload over SSH.

Capture remote stdout, diagnostics, and status. ConnectTimeout bounds setup, not an arbitrary remote program's total runtime.

Transfer acceptance includes received bytes

The verified route uses a preverified course host and generated owned temporary paths.

  • Remote payload succeeds; deliberate remote failure preserves status 6.
  • SCP transfers a spaced local filename; received SHA-256 matches.
  • Rsync dry run leaves the receiver unchanged.
  • Applied rsync copy is retrieved and compared byte-for-byte.
  • Generated remote files and directories are cleaned up.

A transfer is not yet a backup/restore strategy.

Retries must be bounded and meaningful

Keep per-attempt time limits, an overall attempt bound, and one outcome for every approved input.

A timeout is an incomplete observation, not an attribution claim. A failed aggregate does not prove nothing completed. Retrying a read-only check differs from repeating a state-changing operation.

The deterministic fixture fails once and succeeds on attempt two; students also test exhaustion.

Consolidate on your VM

The graded homework applies this: a check script on your own computer that names each failure.

Record tested layers, endpoint identity, status/diagnostics, received-byte verification, time/attempt bounds, and remaining unknowns. Do not expand the approved endpoint set to explain an error.

Sources: OpenSSH, curl, and Linuxize references linked in the lessons. Integration evidence distinguishes macOS client/Linux server from portable local fixtures.

Enabling deny-by-default before allowing SSH refuses the next connection. Deleting by number removes only one of the two copies.

BatchMode forbids password prompts, so success proves the key worked. Without the key: Permission denied, status 255.