duplicate httpd "allow" statements cause startup to fail

Issue #351 resolved
Former user created an issue

If you have a duplicate "allow" statements defined in a config file, for example:

set daemon  30              # check services at 30 seconds intervals
set logfile syslog

set httpd port 2812 and
    use address localhost  # only accept connection from localhost
    allow localhost        # allow localhost to connect to the server and
    allow localhost        # duplicate entry
    allow admin:monit      # require user 'admin' with password 'monit'

set daemon 60
include /etc/monit.d/*

Startup will fail saying that the "localhost" entry is incorrect:

Starting monit: /etc/monit.conf:7: Erroneous network or host identifier localhost 'localhost'

Same situation happens when specifying a network. The issue is that either the function Engine_addHostAllow (for hostnames) or Engine_addNetAllow (for networks), both defined in src/http/engine.c, returns false if they don't add the entry, even if it's already there, which will trigger the error message above and startup to fail.

Comments (4)

  1. Tildeslash repo owner

    Fix Issue #351 : Duplicate "set httpd" statement's "allow" option cause startup to fail. Log just warning - duplicate is not hard error, startup can continue.

    → <<cset 5ad9b6aa8978>>

  2. Mark Hudson

    I was able to work around the issue by replacing allow localhost with allow in my config file.

  3. Log in to comment