dcg

nginx

loadbalancer.nginx

Protects against destructive nginx load balancer operations like stopping the service or deleting config files.

  • 5blocking rules
  • 7safe patterns
  • 1Critical
  • 4High
~/.config/dcg/config.toml
[packs]
enabled = ["loadbalancer.nginx"]

Evaluated when a command contains nginx.

Blocking rules

Each rule ID is loadbalancer.nginx:<name>. Use it in allowlists and [policy.rules].

  1. nginx-config-delete

    Critical

    Removing files from /etc/nginx deletes nginx configuration.

    Explanation
    Deleting nginx configuration files removes site definitions, upstream blocks, SSL certificate references, and load balancing rules. Nginx will fail to start or reload without valid configuration. Back up config first: cp -r /etc/nginx /etc/nginx.backup Test config validity: nginx -t
  2. nginx-quit

    High

    nginx -s quit gracefully stops nginx and halts traffic handling.

    Explanation
    The quit signal waits for active connections to complete before shutting down nginx. While graceful, it still permanently stops the load balancer and no new connections are accepted once issued. To reload config without stopping: nginx -s reload Test config before changes: nginx -t
  3. nginx-stop

    High

    nginx -s stop shuts down nginx and stops the load balancer.

    Explanation
    Sending the stop signal terminates nginx immediately without waiting for active connections to finish. All in-flight requests are dropped and upstream traffic stops being routed. To reload config without downtime: nginx -s reload To gracefully finish current requests: nginx -s quit
  4. service-stop-nginx

    High

    service nginx stop stops the nginx service and disrupts traffic.

    Explanation
    Stopping nginx via the legacy service command terminates all worker processes. All sites and proxies served by nginx become unavailable. Check status first: service nginx status Prefer systemctl on systemd systems: systemctl status nginx
  5. systemctl-stop-nginx

    High

    systemctl stop nginx stops the nginx service and disrupts traffic.

    Explanation
    Stopping the nginx systemd service shuts down all nginx worker processes. Any sites, APIs, or reverse proxies served by this nginx instance become unreachable until the service is restarted. Check status first: systemctl status nginx To restart instead of stop: systemctl restart nginx

Safe patterns

Checked first. A command that matches one is never blocked by this pack.

  • nginx-config-test
  • nginx-config-dump
  • nginx-version
  • nginx-version-full
  • nginx-reload
  • systemctl-status-nginx
  • service-status-nginx