Skip to content

Access Lists and Security

The outcome of this chapter is a service that used to be open to everyone who could reach it, now gated: a password prompt, an IP rule, or both, applied from the same interface that proxied it. It is also the chapter where this guide's security habits stop being advice and become settings.

Access lists are NPM's reusable gate definitions: Access Lists → Add Access List, name it, then choose its two weapons, which combine freely:

  • Authorization — one or more username/password pairs. nginx checks them with the browser's built-in basic-auth prompt. Passwords are stored as hashes in a generated file under /data/access/ — not in the database in plain text, and not in the host's nginx file.
  • Access rules — allow or deny by client IP address or range, in the order you list them, ending in the default you pick. The home-shaped use: allow 192.168.1.0/24, deny everyone else, which makes a service LAN-only even though its name is public.

Two more switches matter. Satisfy Any turns "password and allowed network" into "password or allowed network" — convenient (no prompt at home, prompt abroad) and weaker (each gate alone now suffices); choose it deliberately, not by default. Pass Auth decides whether the basic-auth credentials are forwarded to the service behind. Leave it off unless the service itself expects those headers — a service with its own login should usually receive the visitor's credentials for itself, not have NPM's gate silently replace them.

Attach the list on the proxy host's Details tab, where chapter 5 left it set to None. The host's generated file gains the list's directives, and the check below proves the gate exists.

The wider security picture, in the order the lab would check it:

  • The admin interface is not a service to publish. Keep port 81 off the public internet (your router's port forwarding should name 80 and 443 only), or gate it behind your VPN. Chapter 1 said the admin login is a master key; this is where you hang it on the inside of the door.
  • Block Common Exploits stays on (chapter 6) — it costs nothing and eats a steady diet of automated probes.
  • A certificate is an announcement. Every Let's Encrypt certificate is published in public transparency logs, so internal.example.com tells the world the name exists. Dead hosts (chapter 9) and access lists are how you answer "and nothing else about it is public".
  • NPM proxies; it does not patch. A service with no login of its own, put behind NPM with no access list, is exactly as exposed as it was — just with a nicer name. The gate is your job to add.

The check: with an access list attached, request the host from a network the rules deny — curl -s -o /dev/null -w "%{http_code}" https://app.example.com should answer 403; from an allowed network without credentials it should answer 401; and with credentials (curl -u user:password …) your service itself. Three codes, three gates, each one proving a layer works.