Reload global IP policy with gerrit reload-config

Filesystem polling applies global IP policy edits on a later permission
check, rather than at an explicit administrator-controlled reload. Use
Gerrit's existing reload-config command to apply policy changes without
requiring a restart or a change to gerrit.config.

Load GlobalIpPolicyProvider eagerly at startup and register it as a
GerritConfigListener, including for unchanged-config events. Permission
checks read a volatile in-memory snapshot without filesystem polling or
refresh locks. File edits take effect only after a reload on each
server.

Retain the current policy and log an error if a reload cannot read or
parse the file, including deletion of a previously present file. This
prevents a failed reload from discarding active restrictions. Clear
rules explicitly by reloading an empty file. A never-present file stays
optional; startup load errors still follow
failClosedOnGlobalPolicyError, and a successful reload can recover from
an invalid startup policy.

Add unit and daemon acceptance coverage for explicit reloads, unchanged
config, HTTP/SSH visibility, failed-reload retention and recovery, and
admin-only command access. Document per-server reloads and policy-only
command output, and update mode acceptance tests to reload instead of
poll.

Change-Id: I7f227a8eb50460119ad3f4487642aa84e37b8f5a
8 files changed
tree: 2e190f64a38f9a4c1edd103d84cafc7700e864ad
  1. src/
  2. .gitignore
  3. AGENTS.md
  4. BUILD
  5. README.md
README.md

IP Subnet Access

This module restricts Gerrit project permission checks by source IP/CIDR.

Build

Place the repository at plugins/access-ipsubnet/ in a Gerrit source tree and run from the Gerrit root:

bazelisk build //plugins/access-ipsubnet

Use bazel if bazelisk is unavailable. The artifact is bazel-bin/plugins/access-ipsubnet/access-ipsubnet.jar.

Documentation