duplicate httpd "allow" statements cause startup to fail

Issue #351 resolved
Anonymous 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. Log in to comment