2006-05-14 21:06:28 +00:00
|
|
|
/*
|
|
|
|
* URI-based user authentication using the HTTP basic method.
|
|
|
|
*
|
2011-01-06 16:51:27 +00:00
|
|
|
* Copyright 2006-2011 Willy Tarreau <w@1wt.eu>
|
2006-05-14 21:06:28 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version
|
|
|
|
* 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2006-06-29 15:53:05 +00:00
|
|
|
#ifndef _COMMON_URI_AUTH_H
|
|
|
|
#define _COMMON_URI_AUTH_H
|
2006-06-29 16:54:54 +00:00
|
|
|
|
|
|
|
#include <common/config.h>
|
|
|
|
|
2010-01-29 16:50:44 +00:00
|
|
|
#include <types/auth.h>
|
|
|
|
|
2006-05-21 12:46:15 +00:00
|
|
|
/* This is a list of proxies we are allowed to see. Later, it should go in the
|
|
|
|
* user list, but before this we need to support de/re-authentication.
|
|
|
|
*/
|
|
|
|
struct stat_scope {
|
|
|
|
struct stat_scope *next; /* next entry, NULL if none */
|
|
|
|
int px_len; /* proxy name length */
|
|
|
|
char *px_id; /* proxy id */
|
|
|
|
};
|
|
|
|
|
2007-10-15 08:05:11 +00:00
|
|
|
#define ST_HIDEVER 0x00000001 /* do not report the version and reldate */
|
2009-10-02 20:51:14 +00:00
|
|
|
#define ST_SHNODE 0x00000002 /* show node name */
|
|
|
|
#define ST_SHDESC 0x00000004 /* show description */
|
2010-02-22 18:29:40 +00:00
|
|
|
#define ST_SHLGNDS 0x00000008 /* show legends */
|
2010-02-22 19:27:23 +00:00
|
|
|
#define ST_CONVDONE 0x00000010 /* req_acl conversion done */
|
2016-01-11 14:28:40 +00:00
|
|
|
#define ST_SHOWADMIN 0x00000020 /* show the admin column */
|
2007-10-15 08:05:11 +00:00
|
|
|
|
2006-05-14 21:06:28 +00:00
|
|
|
/* later we may link them to support multiple URI matching */
|
|
|
|
struct uri_auth {
|
|
|
|
int uri_len; /* the prefix length */
|
|
|
|
char *uri_prefix; /* the prefix we want to match */
|
|
|
|
char *auth_realm; /* the realm reported to the client */
|
2009-10-02 20:51:14 +00:00
|
|
|
char *node, *desc; /* node name & description reported in this stats */
|
2007-07-25 05:26:38 +00:00
|
|
|
int refresh; /* refresh interval for the browser (in seconds) */
|
2007-10-15 08:05:11 +00:00
|
|
|
int flags; /* some flags describing the statistics page */
|
2006-05-21 12:46:15 +00:00
|
|
|
struct stat_scope *scope; /* linked list of authorized proxies */
|
2010-01-29 18:29:32 +00:00
|
|
|
struct userlist *userlist; /* private userlist to emulate legacy "stats auth user:password" */
|
2011-01-06 16:51:27 +00:00
|
|
|
struct list http_req_rules; /* stats http-request rules : allow/deny/auth */
|
2010-10-11 22:14:36 +00:00
|
|
|
struct list admin_rules; /* 'stats admin' rules (chained) */
|
2008-05-31 11:53:23 +00:00
|
|
|
struct uri_auth *next; /* Used at deinit() to build a list of unique elements */
|
2006-05-14 21:06:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* This is the default statistics URI */
|
|
|
|
#ifdef CONFIG_STATS_DEFAULT_URI
|
|
|
|
#define STATS_DEFAULT_URI CONFIG_STATS_DEFAULT_URI
|
|
|
|
#else
|
|
|
|
#define STATS_DEFAULT_URI "/haproxy?stats"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* This is the default statistics realm */
|
|
|
|
#ifdef CONFIG_STATS_DEFAULT_REALM
|
|
|
|
#define STATS_DEFAULT_REALM CONFIG_STATS_DEFAULT_REALM
|
|
|
|
#else
|
|
|
|
#define STATS_DEFAULT_REALM "HAProxy Statistics"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2010-10-11 22:14:36 +00:00
|
|
|
struct stats_admin_rule {
|
|
|
|
struct list list; /* list linked to from the proxy */
|
|
|
|
struct acl_cond *cond; /* acl condition to meet */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-05-14 21:06:28 +00:00
|
|
|
/* Various functions used to set the fields during the configuration parsing.
|
|
|
|
* Please that all those function can initialize the root entry in order not to
|
|
|
|
* force the user to respect a certain order in the configuration file.
|
|
|
|
*
|
|
|
|
* Default values are used during initialization. Check STATS_DEFAULT_* for
|
|
|
|
* more information.
|
|
|
|
*/
|
|
|
|
struct uri_auth *stats_check_init_uri_auth(struct uri_auth **root);
|
|
|
|
struct uri_auth *stats_set_uri(struct uri_auth **root, char *uri);
|
|
|
|
struct uri_auth *stats_set_realm(struct uri_auth **root, char *realm);
|
2007-07-25 05:26:38 +00:00
|
|
|
struct uri_auth *stats_set_refresh(struct uri_auth **root, int interval);
|
2007-10-15 08:05:11 +00:00
|
|
|
struct uri_auth *stats_set_flag(struct uri_auth **root, int flag);
|
2006-05-14 21:06:28 +00:00
|
|
|
struct uri_auth *stats_add_auth(struct uri_auth **root, char *user);
|
2006-05-21 12:46:15 +00:00
|
|
|
struct uri_auth *stats_add_scope(struct uri_auth **root, char *scope);
|
2009-10-02 20:51:14 +00:00
|
|
|
struct uri_auth *stats_set_node(struct uri_auth **root, char *name);
|
|
|
|
struct uri_auth *stats_set_desc(struct uri_auth **root, char *desc);
|
2006-05-14 21:06:28 +00:00
|
|
|
|
2006-06-29 15:53:05 +00:00
|
|
|
#endif /* _COMMON_URI_AUTH_H */
|
2007-07-25 05:26:38 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Local variables:
|
|
|
|
* c-indent-level: 8
|
|
|
|
* c-basic-offset: 8
|
|
|
|
* End:
|
|
|
|
*/
|