- presetenv
- prealloc-fd
- resetenv
+ - unresolvable-server-fqdn
- set-dumpable
- set-var
- setenv
both are specified, the "bind" statement has priority, meaning that the
"unix-bind" settings may be seen as process-wide default settings.
+unresolvable-server-fqdn [ fail | warn ]
+ Server names with more than 63 characters per FQDN component cannot be
+ resolved by DNS (this is a limitation of the DNS protocol, not haproxy). Any
+ server with such a name will never work, and as any configuration error, will
+ trigger a fatal error preventing it from starting. However, some bogus
+ configuration generators may occasionally generate such invalid names without
+ checking them, preventing haproxy from starting. Similarly, hosting providers
+ might face the issue if their customers are free to choose any server name
+ without and input control. If this happens, setting this option to "warn"
+ will turn the error into a warning and will force the server into maintenance
+ mode so that it never tries to resolve. The default setting is "fail".
+
unsetenv [<name> ...]
Removes environment variables specified in arguments. This can be useful to
hide some sensitive information that are occasionally inherited from the
struct list servers_to_init = LIST_HEAD_INIT(servers_to_init);
static struct task *server_atomic_sync_task = NULL;
static event_hdl_async_equeue server_atomic_sync_queue;
+static int srv_unresolvable_fqdn_warn;
/* SERVER DELETE(n)->ADD global tracker:
* This is meant to provide srv->rid (revision id) value.
if ((newsrv->srvrq = find_srvrq_by_name(fqdn, curproxy)) == NULL)
newsrv->srvrq = new_resolv_srvrq(newsrv, fqdn);
if (newsrv->srvrq == NULL) {
+ if (srv_unresolvable_fqdn_warn) {
+ ha_warning("%s %s/%s: invalid FQDN <%s>, skipping.\n",
+ (parse_flags & SRV_PARSE_TEMPLATE) ? "server-template" : "server",
+ curproxy->id,
+ (parse_flags & SRV_PARSE_TEMPLATE) ? args[2] : args[1],
+ fqdn);
+ (*cur_arg)++;
+ goto skip_addr;
+ }
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
}
LIST_APPEND(&newsrv->srvrq->attached_servers, &newsrv->srv_rec_item);
}
else if (srv_prepare_for_resolution(newsrv, fqdn) == -1) {
- ha_alert("Can't create DNS resolution for server '%s'\n",
- newsrv->id);
+ if (srv_unresolvable_fqdn_warn) {
+ ha_warning("%s %s/%s: invalid FQDN <%s>, skipping.\n",
+ (parse_flags & SRV_PARSE_TEMPLATE) ? "server-template" : "server",
+ curproxy->id,
+ (parse_flags & SRV_PARSE_TEMPLATE) ? args[2] : args[1],
+ fqdn);
+ (*cur_arg)++;
+ goto skip_addr;
+ }
+ ha_alert("Can't create DNS resolution for server '%s' ('%s'). If you have no control "
+ "over the server's syntax and wish to start regardless of this error, please "
+ "consider setting 'unresolvable-server-fqdn' to 'warn'.\n",
+ newsrv->id, fqdn);
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
}
return 0;
}
+/* config parser for global "unresolvable-server-fqdn" */
+static int cfg_parse_unres_srv_fqdn(char **args, int section_type, struct proxy *curpx,
+ const struct proxy *defpx, const char *file, int line,
+ char **err)
+{
+ if (too_many_args(1, args, err, NULL))
+ return -1;
+
+ if (strcmp(args[1], "warn") == 0)
+ srv_unresolvable_fqdn_warn = 1;
+ else if (strcmp(args[1], "fail") == 0)
+ srv_unresolvable_fqdn_warn = 0;
+ else {
+ memprintf(err, "'%s' expects either 'warn' or 'fail'", args[0]);
+ return -1;
+ }
+ return 0;
+}
+
/* config parser for global "tune.pool-{low,high}-fd-ratio" */
static int cfg_parse_pool_fd_ratio(char **args, int section_type, struct proxy *curpx,
const struct proxy *defpx, const char *file, int line,
/* config keyword parsers */
static struct cfg_kw_list cfg_kws = {ILH, {
+ { CFG_GLOBAL, "unresolvable-server-fqdn", cfg_parse_unres_srv_fqdn },
{ CFG_GLOBAL, "tune.idle-pool.shared", cfg_parse_idle_pool_shared },
{ CFG_GLOBAL, "tune.pool-high-fd-ratio", cfg_parse_pool_fd_ratio },
{ CFG_GLOBAL, "tune.pool-low-fd-ratio", cfg_parse_pool_fd_ratio },