mirror of
https://github.com/netdata/netdata.git
synced 2025-04-22 12:32:32 +00:00
Adds support for opting out of telemetry via the DO_NOT_TRACK envirnment variable (#7846)
* Added support for opting out of telemtry via the DO_NOT_TRACK environment variable * Added support for DO_NOT_TRACK=1 in anonymous-statistics.sh and minor cleanup in Dockerfile and run.sh entrypoint * Allow DO_NOT_TRACK to be either non-zero or non-empty * Update md5sum of kickstart-static64.sh in docs * Fixed a bug in netdata-installer.sh * Revert changes to daemon/main.c (testing onyl) * Update docs/anonymous-statistics.md Co-Authored-By: Mansour Behabadi <57921115+ncmans@users.noreply.github.com> Co-authored-by: Mansour Behabadi <57921115+ncmans@users.noreply.github.com>
This commit is contained in:
parent
2979efe031
commit
38ad89fc2b
10 changed files with 124 additions and 111 deletions
|
@ -7,8 +7,8 @@
|
|||
# ACTION_DATA -- fmt, args passed to fatal
|
||||
# - START - netdata started
|
||||
# ACTION_DATA -- nan
|
||||
# - EXIT - installation action
|
||||
# ACTION_DATA -- ret value of
|
||||
# - EXIT - installation action
|
||||
# ACTION_DATA -- ret value of
|
||||
|
||||
ACTION="${1}"
|
||||
ACTION_RESULT="${2}"
|
||||
|
@ -18,8 +18,8 @@ ACTION_DATA=$(echo "${ACTION_DATA}" | tr '"' "'")
|
|||
# -------------------------------------------------------------------------------------------------
|
||||
# check opt-out
|
||||
|
||||
if [ -f "@configdir_POST@/.opt-out-from-anonymous-statistics" ]; then
|
||||
exit 0
|
||||
if [ -f "@configdir_POST@/.opt-out-from-anonymous-statistics" ] || [ ! "$DO_NOT_TRACK" -eq 0 ] || [ -n "$DO_NOT_TRACK" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Shorten version for easier reporting
|
||||
|
@ -29,43 +29,43 @@ NETDATA_VERSION=$(echo "${NETDATA_VERSION}" | sed 's/-.*//g' | tr -d 'v')
|
|||
# send the anonymous statistics to GA
|
||||
# https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters
|
||||
# The maximum index for a cd parameter is 20 so we have effectively run out.
|
||||
if [ -n "$(command -v curl 2>/dev/null)" ]; then
|
||||
curl -X POST -Ss --max-time 2 \
|
||||
--data "v=1" \
|
||||
--data "tid=UA-64295674-3" \
|
||||
--data "aip=1" \
|
||||
--data "ds=shell" \
|
||||
--data-urlencode "cid=${NETDATA_REGISTRY_UNIQUE_ID}" \
|
||||
--data-urlencode "cs=${NETDATA_REGISTRY_UNIQUE_ID}" \
|
||||
--data "t=event" \
|
||||
--data "ni=1" \
|
||||
--data "an=anonymous-statistics" \
|
||||
--data-urlencode "av=${NETDATA_VERSION}" \
|
||||
--data-urlencode "ec=${ACTION}" \
|
||||
--data-urlencode "ea=${ACTION_RESULT}" \
|
||||
--data-urlencode "el=${ACTION_DATA}" \
|
||||
--data-urlencode "cd1=${NETDATA_HOST_OS_NAME}" \
|
||||
--data-urlencode "cd2=${NETDATA_HOST_OS_ID}" \
|
||||
--data-urlencode "cd3=${NETDATA_HOST_OS_ID_LIKE}" \
|
||||
--data-urlencode "cd4=${NETDATA_HOST_OS_VERSION}" \
|
||||
--data-urlencode "cd5=${NETDATA_HOST_OS_VERSION_ID}" \
|
||||
--data-urlencode "cd6=${NETDATA_HOST_OS_DETECTION}" \
|
||||
--data-urlencode "cd7=${NETDATA_SYSTEM_KERNEL_NAME}" \
|
||||
--data-urlencode "cd8=${NETDATA_SYSTEM_KERNEL_VERSION}" \
|
||||
--data-urlencode "cd9=${NETDATA_SYSTEM_ARCHITECTURE}" \
|
||||
--data-urlencode "cd10=${NETDATA_SYSTEM_VIRTUALIZATION}" \
|
||||
--data-urlencode "cd11=${NETDATA_SYSTEM_VIRT_DETECTION}" \
|
||||
--data-urlencode "cd12=${NETDATA_SYSTEM_CONTAINER}" \
|
||||
--data-urlencode "cd13=${NETDATA_SYSTEM_CONTAINER_DETECTION}" \
|
||||
--data-urlencode "cd14=${NETDATA_CONTAINER_OS_NAME}" \
|
||||
--data-urlencode "cd15=${NETDATA_CONTAINER_OS_ID}" \
|
||||
--data-urlencode "cd16=${NETDATA_CONTAINER_OS_ID_LIKE}" \
|
||||
--data-urlencode "cd17=${NETDATA_CONTAINER_OS_VERSION}" \
|
||||
--data-urlencode "cd18=${NETDATA_CONTAINER_OS_VERSION_ID}" \
|
||||
--data-urlencode "cd19=${NETDATA_CONTAINER_OS_DETECTION}" \
|
||||
"https://www.google-analytics.com/collect" >/dev/null 2>&1
|
||||
if [ -n "$(command -v curl 2> /dev/null)" ]; then
|
||||
curl -X POST -Ss --max-time 2 \
|
||||
--data "v=1" \
|
||||
--data "tid=UA-64295674-3" \
|
||||
--data "aip=1" \
|
||||
--data "ds=shell" \
|
||||
--data-urlencode "cid=${NETDATA_REGISTRY_UNIQUE_ID}" \
|
||||
--data-urlencode "cs=${NETDATA_REGISTRY_UNIQUE_ID}" \
|
||||
--data "t=event" \
|
||||
--data "ni=1" \
|
||||
--data "an=anonymous-statistics" \
|
||||
--data-urlencode "av=${NETDATA_VERSION}" \
|
||||
--data-urlencode "ec=${ACTION}" \
|
||||
--data-urlencode "ea=${ACTION_RESULT}" \
|
||||
--data-urlencode "el=${ACTION_DATA}" \
|
||||
--data-urlencode "cd1=${NETDATA_HOST_OS_NAME}" \
|
||||
--data-urlencode "cd2=${NETDATA_HOST_OS_ID}" \
|
||||
--data-urlencode "cd3=${NETDATA_HOST_OS_ID_LIKE}" \
|
||||
--data-urlencode "cd4=${NETDATA_HOST_OS_VERSION}" \
|
||||
--data-urlencode "cd5=${NETDATA_HOST_OS_VERSION_ID}" \
|
||||
--data-urlencode "cd6=${NETDATA_HOST_OS_DETECTION}" \
|
||||
--data-urlencode "cd7=${NETDATA_SYSTEM_KERNEL_NAME}" \
|
||||
--data-urlencode "cd8=${NETDATA_SYSTEM_KERNEL_VERSION}" \
|
||||
--data-urlencode "cd9=${NETDATA_SYSTEM_ARCHITECTURE}" \
|
||||
--data-urlencode "cd10=${NETDATA_SYSTEM_VIRTUALIZATION}" \
|
||||
--data-urlencode "cd11=${NETDATA_SYSTEM_VIRT_DETECTION}" \
|
||||
--data-urlencode "cd12=${NETDATA_SYSTEM_CONTAINER}" \
|
||||
--data-urlencode "cd13=${NETDATA_SYSTEM_CONTAINER_DETECTION}" \
|
||||
--data-urlencode "cd14=${NETDATA_CONTAINER_OS_NAME}" \
|
||||
--data-urlencode "cd15=${NETDATA_CONTAINER_OS_ID}" \
|
||||
--data-urlencode "cd16=${NETDATA_CONTAINER_OS_ID_LIKE}" \
|
||||
--data-urlencode "cd17=${NETDATA_CONTAINER_OS_VERSION}" \
|
||||
--data-urlencode "cd18=${NETDATA_CONTAINER_OS_VERSION_ID}" \
|
||||
--data-urlencode "cd19=${NETDATA_CONTAINER_OS_DETECTION}" \
|
||||
"https://www.google-analytics.com/collect" > /dev/null 2>&1
|
||||
else
|
||||
wget -q -O - --timeout=1 "https://www.google-analytics.com/collect?\
|
||||
wget -q -O - --timeout=1 "https://www.google-analytics.com/collect?\
|
||||
&v=1\
|
||||
&tid=UA-64295674-3\
|
||||
&aip=1\
|
||||
|
|
|
@ -78,7 +78,8 @@ installation, including manual, offline, and macOS installations. Create the fil
|
|||
|
||||
**Pass the option `--disable-telemetry` to any of the installer scripts in the [installation
|
||||
docs](../packaging/installer/README.md).** You can append this option during the initial installation or a manual
|
||||
update.
|
||||
update. You can also export the environment variable `DO_NOT_TRACK` with a non-zero or non-empty value
|
||||
(e.g: `export DO_NOT_TRACK=1`).
|
||||
|
||||
When using Docker, **set your `DO_NOT_TRACK` environment variable to `1`.** You can set this variable with the following
|
||||
command: `export DO_NOT_TRACK=1`. When creating a container using Netdata's [Docker
|
||||
|
|
|
@ -179,7 +179,7 @@ USAGE: ${PROGRAM} [options]
|
|||
--zlib-is-really-here or
|
||||
--libs-are-really-here If you get errors about missing zlib or libuuid but you know it is available, you might
|
||||
have a broken pkg-config. Use this option to proceed without checking pkg-config.
|
||||
--disable-telemetry Use this flag to opt-out from our anonymous telemetry progam.
|
||||
--disable-telemetry Use this flag to opt-out from our anonymous telemetry progam. (DO_NOT_TRACK=1)
|
||||
|
||||
Netdata will by default be compiled with gcc optimization -O2
|
||||
If you need to pass different CFLAGS, use something like this:
|
||||
|
@ -304,7 +304,9 @@ if [ -z "$NETDATA_DISABLE_TELEMETRY" ]; then
|
|||
|
||||
${TPUT_YELLOW}${TPUT_BOLD}NOTE${TPUT_RESET}:
|
||||
Anonymous usage stats will be collected and sent to Google Analytics.
|
||||
To opt-out, pass --disable-telemetry option to the installer.
|
||||
To opt-out, pass --disable-telemetry option to the installer or export
|
||||
the enviornment variable DO_NOT_TRACK to a non-zero or non-empty value
|
||||
(e.g: export DO_NOT_TRACK=1).
|
||||
|
||||
BANNER4
|
||||
fi
|
||||
|
@ -885,6 +887,10 @@ install_go
|
|||
# -----------------------------------------------------------------------------
|
||||
progress "Telemetry configuration"
|
||||
|
||||
if [ ! "$DO_NOT_TRACK" -eq 0 ] || [ -n "$DO_NOT_TRACK" ]; then
|
||||
NETDATA_DISABLE_TELEMETRY=1
|
||||
fi
|
||||
|
||||
# Opt-out from telemetry program
|
||||
if [ -n "${NETDATA_DISABLE_TELEMETRY+x}" ]; then
|
||||
run touch "${NETDATA_USER_CONFIG_DIR}/.opt-out-from-anonymous-statistics"
|
||||
|
|
|
@ -68,7 +68,7 @@ ARG NETDATA_GID=201
|
|||
ENV DOCKER_GRP netdata
|
||||
ENV DOCKER_USR netdata
|
||||
# If DO_NOT_TRACK is set, it will disable anonymous stats collection and reporting
|
||||
#ENV DO_NOT_TRACK
|
||||
#ENV DO_NOT_TRACK=1
|
||||
RUN \
|
||||
# fping from alpine apk is on a different location. Moving it.
|
||||
mv /usr/sbin/fping /usr/local/bin/fping && \
|
||||
|
|
|
@ -7,21 +7,21 @@
|
|||
# Author : Pavlos Emm. Katsoulakis <paul@netdata.cloud>
|
||||
set -e
|
||||
|
||||
if [ -n "${DO_NOT_TRACK+x}" ]; then
|
||||
if [ ! "$DO_NOT_TRACK" -eq 0 ] || [ -n "$DO_NOT_TRACK" ]; then
|
||||
touch /etc/netdata/.opt-out-from-anonymous-statistics
|
||||
fi
|
||||
|
||||
echo "Netdata entrypoint script starting"
|
||||
if [ ${RESCRAMBLE+x} ]; then
|
||||
echo "Reinstalling all packages to get the latest Polymorphic Linux scramble"
|
||||
apk upgrade --update-cache --available
|
||||
echo "Reinstalling all packages to get the latest Polymorphic Linux scramble"
|
||||
apk upgrade --update-cache --available
|
||||
fi
|
||||
|
||||
if [ -n "${PGID}" ]; then
|
||||
echo "Creating docker group ${PGID}"
|
||||
addgroup -g "${PGID}" "docker" || echo >&2 "Could not add group docker with ID ${PGID}, its already there probably"
|
||||
echo "Assign netdata user to docker group ${PGID}"
|
||||
usermod -a -G ${PGID} ${DOCKER_USR} || echo >&2 "Could not add netdata user to group docker with ID ${PGID}"
|
||||
echo "Creating docker group ${PGID}"
|
||||
addgroup -g "${PGID}" "docker" || echo >&2 "Could not add group docker with ID ${PGID}, its already there probably"
|
||||
echo "Assign netdata user to docker group ${PGID}"
|
||||
usermod -a -G "${PGID}" "${DOCKER_USR}" || echo >&2 "Could not add netdata user to group docker with ID ${PGID}"
|
||||
fi
|
||||
|
||||
exec /usr/sbin/netdata -u "${DOCKER_USR}" -D -s /host -p "${NETDATA_PORT}" -W set web "web files group" root -W set web "web files owner" root "$@"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
# --non-interactive do not wait for input
|
||||
# --dont-start-it do not start netdata after install
|
||||
# --stable-channel Use the stable release channel, rather than the nightly to fetch sources
|
||||
# --disable-telemetry Opt-out of anonymous telemetry program
|
||||
# --disable-telemetry Opt-out of anonymous telemetry program (DO_NOT_TRACK=1)
|
||||
# --local-files Use a manually provided tarball for the installation
|
||||
#
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -231,6 +231,10 @@ while [ -n "${1}" ]; do
|
|||
fi
|
||||
done
|
||||
|
||||
if [ ! "$DO_NOT_TRACK" -eq 0 ] || [ -n "$DO_NOT_TRACK" ]; then
|
||||
NETDATA_INSTALLER_OPTIONS="${NETDATA_INSTALLER_OPTIONS:+${NETDATA_INSTALLER_OPTIONS} }--disable-telemtry"
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
TMPDIR=$(create_tmp_directory)
|
||||
cd "${TMPDIR}" || exit 1
|
||||
|
|
|
@ -68,7 +68,7 @@ To use `md5sum` to verify the intregity of the `kickstart-static64.sh` script yo
|
|||
command above, run the following:
|
||||
|
||||
```bash
|
||||
[ "dfa84c3b5e6fd8975555d68f46eccdde" = "$(curl -Ss https://my-netdata.io/kickstart-static64.sh | md5sum | cut -d ' ' -f 1)" ] && echo "OK, VALID" || echo "FAILED, INVALID"
|
||||
[ "788cfe179615158331877a577c140486" = "$(curl -Ss https://my-netdata.io/kickstart-static64.sh | md5sum | cut -d ' ' -f 1)" ] && echo "OK, VALID" || echo "FAILED, INVALID"
|
||||
```
|
||||
|
||||
If the script is valid, this command will return `OK, VALID`.
|
||||
|
|
|
@ -57,6 +57,10 @@ while [ "${1}" ]; do
|
|||
shift 1
|
||||
done
|
||||
|
||||
if [ ! "$DO_NOT_TRACK" -eq 0 ] || [ -n "$DO_NOT_TRACK" ]; then
|
||||
REINSTALL_OPTIONS="${REINSTALL_OPTIONS} --disable-telemtry"
|
||||
fi
|
||||
|
||||
deleted_stock_configs=0
|
||||
if [ ! -f "etc/netdata/.installer-cleanup-of-stock-configs-done" ]; then
|
||||
|
||||
|
|
|
@ -44,4 +44,6 @@
|
|||
https://github.com/netdata/netdata/blob/master/LICENSE.md
|
||||
|
||||
Anonymous stat collection and reporting to Google Analytics is enabled
|
||||
by default. To disable, pass --disable-telemetry option to the installer.
|
||||
by default. To disable, pass --disable-telemetry option to the installer
|
||||
or export the environment variable DO_NOT_TRACK to a non-zero or non-empty
|
||||
value (e.g export DO_NOT_TRACK=1).
|
||||
|
|
|
@ -6,24 +6,22 @@
|
|||
#include "libnetdata/libnetdata.h"
|
||||
|
||||
#ifdef NETDATA_WITH_ZLIB
|
||||
extern int web_enable_gzip,
|
||||
web_gzip_level,
|
||||
web_gzip_strategy;
|
||||
extern int web_enable_gzip, web_gzip_level, web_gzip_strategy;
|
||||
#endif /* NETDATA_WITH_ZLIB */
|
||||
|
||||
// HTTP_CODES 2XX Success
|
||||
#define HTTP_RESP_OK 200
|
||||
#define HTTP_RESP_OK 200
|
||||
|
||||
// HTTP_CODES 3XX Redirections
|
||||
#define HTTP_RESP_MOVED_PERM 301
|
||||
#define HTTP_RESP_REDIR_TEMP 307
|
||||
#define HTTP_RESP_REDIR_PERM 308
|
||||
#define HTTP_RESP_MOVED_PERM 301
|
||||
#define HTTP_RESP_REDIR_TEMP 307
|
||||
#define HTTP_RESP_REDIR_PERM 308
|
||||
|
||||
// HTTP_CODES 4XX Client Errors
|
||||
#define HTTP_RESP_BAD_REQUEST 400
|
||||
#define HTTP_RESP_FORBIDDEN 403
|
||||
#define HTTP_RESP_NOT_FOUND 404
|
||||
#define HTTP_RESP_PRECOND_FAIL 412
|
||||
#define HTTP_RESP_BAD_REQUEST 400
|
||||
#define HTTP_RESP_FORBIDDEN 403
|
||||
#define HTTP_RESP_NOT_FOUND 404
|
||||
#define HTTP_RESP_PRECOND_FAIL 412
|
||||
|
||||
// HTTP_CODES 5XX Server Errors
|
||||
#define HTTP_RESP_INTERNAL_SERVER_ERROR 500
|
||||
|
@ -33,10 +31,10 @@ extern int respect_web_browser_do_not_track_policy;
|
|||
extern char *web_x_frame_options;
|
||||
|
||||
typedef enum web_client_mode {
|
||||
WEB_CLIENT_MODE_NORMAL = 0,
|
||||
WEB_CLIENT_MODE_FILECOPY = 1,
|
||||
WEB_CLIENT_MODE_OPTIONS = 2,
|
||||
WEB_CLIENT_MODE_STREAM = 3
|
||||
WEB_CLIENT_MODE_NORMAL = 0,
|
||||
WEB_CLIENT_MODE_FILECOPY = 1,
|
||||
WEB_CLIENT_MODE_OPTIONS = 2,
|
||||
WEB_CLIENT_MODE_STREAM = 3
|
||||
} WEB_CLIENT_MODE;
|
||||
|
||||
typedef enum {
|
||||
|
@ -52,20 +50,20 @@ typedef enum {
|
|||
} HTTP_VALIDATION;
|
||||
|
||||
typedef enum web_client_flags {
|
||||
WEB_CLIENT_FLAG_DEAD = 1 << 1, // if set, this client is dead
|
||||
WEB_CLIENT_FLAG_DEAD = 1 << 1, // if set, this client is dead
|
||||
|
||||
WEB_CLIENT_FLAG_KEEPALIVE = 1 << 2, // if set, the web client will be re-used
|
||||
WEB_CLIENT_FLAG_KEEPALIVE = 1 << 2, // if set, the web client will be re-used
|
||||
|
||||
WEB_CLIENT_FLAG_WAIT_RECEIVE = 1 << 3, // if set, we are waiting more input data
|
||||
WEB_CLIENT_FLAG_WAIT_SEND = 1 << 4, // if set, we have data to send to the client
|
||||
WEB_CLIENT_FLAG_WAIT_RECEIVE = 1 << 3, // if set, we are waiting more input data
|
||||
WEB_CLIENT_FLAG_WAIT_SEND = 1 << 4, // if set, we have data to send to the client
|
||||
|
||||
WEB_CLIENT_FLAG_DO_NOT_TRACK = 1 << 5, // if set, we should not set cookies on this client
|
||||
WEB_CLIENT_FLAG_DO_NOT_TRACK = 1 << 5, // if set, we should not set cookies on this client
|
||||
WEB_CLIENT_FLAG_TRACKING_REQUIRED = 1 << 6, // if set, we need to send cookies
|
||||
|
||||
WEB_CLIENT_FLAG_TCP_CLIENT = 1 << 7, // if set, the client is using a TCP socket
|
||||
WEB_CLIENT_FLAG_UNIX_CLIENT = 1 << 8, // if set, the client is using a UNIX socket
|
||||
WEB_CLIENT_FLAG_TCP_CLIENT = 1 << 7, // if set, the client is using a TCP socket
|
||||
WEB_CLIENT_FLAG_UNIX_CLIENT = 1 << 8, // if set, the client is using a UNIX socket
|
||||
|
||||
WEB_CLIENT_FLAG_DONT_CLOSE_SOCKET = 1 << 9, // don't close the socket when cleaning up (static-threaded web server)
|
||||
WEB_CLIENT_FLAG_DONT_CLOSE_SOCKET = 1 << 9, // don't close the socket when cleaning up (static-threaded web server)
|
||||
} WEB_CLIENT_FLAGS;
|
||||
|
||||
//#ifdef HAVE_C___ATOMIC
|
||||
|
@ -74,7 +72,7 @@ typedef enum web_client_flags {
|
|||
//#define web_client_flag_clear(w, flag) __atomic_and_fetch(&((w)->flags), ~flag, __ATOMIC_SEQ_CST)
|
||||
//#else
|
||||
#define web_client_flag_check(w, flag) ((w)->flags & (flag))
|
||||
#define web_client_flag_set(w, flag) (w)->flags |= flag
|
||||
#define web_client_flag_set(w, flag) (w)->flags |= flag
|
||||
#define web_client_flag_clear(w, flag) (w)->flags &= ~flag
|
||||
//#endif
|
||||
|
||||
|
@ -118,59 +116,58 @@ typedef enum web_client_flags {
|
|||
#define NETDATA_WEB_REQUEST_MAX_SIZE 16384
|
||||
|
||||
struct response {
|
||||
BUFFER *header; // our response header
|
||||
BUFFER *header_output; // internal use
|
||||
BUFFER *data; // our response data buffer
|
||||
BUFFER *header; // our response header
|
||||
BUFFER *header_output; // internal use
|
||||
BUFFER *data; // our response data buffer
|
||||
|
||||
int code; // the HTTP response code
|
||||
int code; // the HTTP response code
|
||||
|
||||
size_t rlen; // if non-zero, the excepted size of ifd (input of firecopy)
|
||||
size_t sent; // current data length sent to output
|
||||
size_t rlen; // if non-zero, the excepted size of ifd (input of firecopy)
|
||||
size_t sent; // current data length sent to output
|
||||
|
||||
int zoutput; // if set to 1, web_client_send() will send compressed data
|
||||
int zoutput; // if set to 1, web_client_send() will send compressed data
|
||||
#ifdef NETDATA_WITH_ZLIB
|
||||
z_stream zstream; // zlib stream for sending compressed output to client
|
||||
z_stream zstream; // zlib stream for sending compressed output to client
|
||||
Bytef zbuffer[NETDATA_WEB_RESPONSE_ZLIB_CHUNK_SIZE]; // temporary buffer for storing compressed output
|
||||
size_t zsent; // the compressed bytes we have sent to the client
|
||||
size_t zhave; // the compressed bytes that we have received from zlib
|
||||
unsigned int zinitialized:1;
|
||||
size_t zsent; // the compressed bytes we have sent to the client
|
||||
size_t zhave; // the compressed bytes that we have received from zlib
|
||||
unsigned int zinitialized : 1;
|
||||
#endif /* NETDATA_WITH_ZLIB */
|
||||
|
||||
};
|
||||
|
||||
struct web_client {
|
||||
unsigned long long id;
|
||||
|
||||
WEB_CLIENT_FLAGS flags; // status flags for the client
|
||||
WEB_CLIENT_MODE mode; // the operational mode of the client
|
||||
WEB_CLIENT_ACL acl; // the access list of the client
|
||||
int port_acl; // the operations permitted on the port the client connected to
|
||||
char *auth_bearer_token; // the Bearer auth token (if sent)
|
||||
WEB_CLIENT_FLAGS flags; // status flags for the client
|
||||
WEB_CLIENT_MODE mode; // the operational mode of the client
|
||||
WEB_CLIENT_ACL acl; // the access list of the client
|
||||
int port_acl; // the operations permitted on the port the client connected to
|
||||
char *auth_bearer_token; // the Bearer auth token (if sent)
|
||||
size_t header_parse_tries;
|
||||
size_t header_parse_last_size;
|
||||
|
||||
int tcp_cork; // 1 = we have a cork on the socket
|
||||
int tcp_cork; // 1 = we have a cork on the socket
|
||||
|
||||
int ifd;
|
||||
int ofd;
|
||||
|
||||
char client_ip[INET6_ADDRSTRLEN]; // Defined buffer sizes include null-terminators
|
||||
char client_ip[INET6_ADDRSTRLEN]; // Defined buffer sizes include null-terminators
|
||||
char client_port[NI_MAXSERV];
|
||||
char server_host[NI_MAXHOST];
|
||||
char client_host[NI_MAXHOST];
|
||||
|
||||
char decoded_url[NETDATA_WEB_REQUEST_URL_SIZE + 1]; // we decode the URL in this buffer
|
||||
char decoded_query_string[NETDATA_WEB_REQUEST_URL_SIZE + 1]; // we decode the Query String in this buffer
|
||||
char last_url[NETDATA_WEB_REQUEST_URL_SIZE+1]; // we keep a copy of the decoded URL here
|
||||
char decoded_url[NETDATA_WEB_REQUEST_URL_SIZE + 1]; // we decode the URL in this buffer
|
||||
char decoded_query_string[NETDATA_WEB_REQUEST_URL_SIZE + 1]; // we decode the Query String in this buffer
|
||||
char last_url[NETDATA_WEB_REQUEST_URL_SIZE + 1]; // we keep a copy of the decoded URL here
|
||||
size_t url_path_length;
|
||||
char separator; // This value can be either '?' or 'f'
|
||||
char separator; // This value can be either '?' or 'f'
|
||||
char *url_search_path; //A pointer to the search path sent by the client
|
||||
|
||||
struct timeval tv_in, tv_ready;
|
||||
|
||||
char cookie1[NETDATA_WEB_REQUEST_COOKIE_SIZE+1];
|
||||
char cookie2[NETDATA_WEB_REQUEST_COOKIE_SIZE+1];
|
||||
char origin[NETDATA_WEB_REQUEST_ORIGIN_HEADER_SIZE+1];
|
||||
char cookie1[NETDATA_WEB_REQUEST_COOKIE_SIZE + 1];
|
||||
char cookie2[NETDATA_WEB_REQUEST_COOKIE_SIZE + 1];
|
||||
char origin[NETDATA_WEB_REQUEST_ORIGIN_HEADER_SIZE + 1];
|
||||
char *user_agent;
|
||||
|
||||
struct response response;
|
||||
|
@ -179,22 +176,21 @@ struct web_client {
|
|||
size_t stats_sent_bytes;
|
||||
|
||||
// cache of web_client allocations
|
||||
struct web_client *prev; // maintain a linked list of web clients
|
||||
struct web_client *next; // for the web servers that need it
|
||||
struct web_client *prev; // maintain a linked list of web clients
|
||||
struct web_client *next; // for the web servers that need it
|
||||
|
||||
// MULTI-THREADED WEB SERVER MEMBERS
|
||||
netdata_thread_t thread; // the thread servicing this client
|
||||
volatile int running; // 1 when the thread runs, 0 otherwise
|
||||
netdata_thread_t thread; // the thread servicing this client
|
||||
volatile int running; // 1 when the thread runs, 0 otherwise
|
||||
|
||||
// STATIC-THREADED WEB SERVER MEMBERS
|
||||
size_t pollinfo_slot; // POLLINFO slot of the web client
|
||||
size_t pollinfo_filecopy_slot; // POLLINFO slot of the file read
|
||||
size_t pollinfo_slot; // POLLINFO slot of the web client
|
||||
size_t pollinfo_filecopy_slot; // POLLINFO slot of the file read
|
||||
#ifdef ENABLE_HTTPS
|
||||
struct netdata_ssl ssl;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
extern uid_t web_files_uid(void);
|
||||
extern uid_t web_files_gid(void);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue