0
0
Fork 0
mirror of https://github.com/netdata/netdata.git synced 2025-05-06 18:20:10 +00:00

Adds support for opting out of telemetry via the DO_NOT_TRACK envirnment variable ()

* 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:
James Mills 2020-01-30 09:49:23 +10:00 committed by GitHub
parent 2979efe031
commit 38ad89fc2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 124 additions and 111 deletions

View file

@ -18,7 +18,7 @@ ACTION_DATA=$(echo "${ACTION_DATA}" | tr '"' "'")
# -------------------------------------------------------------------------------------------------
# check opt-out
if [ -f "@configdir_POST@/.opt-out-from-anonymous-statistics" ]; then
if [ -f "@configdir_POST@/.opt-out-from-anonymous-statistics" ] || [ ! "$DO_NOT_TRACK" -eq 0 ] || [ -n "$DO_NOT_TRACK" ]; then
exit 0
fi
@ -29,7 +29,7 @@ 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
if [ -n "$(command -v curl 2> /dev/null)" ]; then
curl -X POST -Ss --max-time 2 \
--data "v=1" \
--data "tid=UA-64295674-3" \
@ -63,7 +63,7 @@ if [ -n "$(command -v curl 2>/dev/null)" ]; then
--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
"https://www.google-analytics.com/collect" > /dev/null 2>&1
else
wget -q -O - --timeout=1 "https://www.google-analytics.com/collect?\
&v=1\

View file

@ -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

View file

@ -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"

View file

@ -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 && \

View file

@ -7,7 +7,7 @@
# 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
@ -21,7 +21,7 @@ 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}"
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 "$@"

View file

@ -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

View file

@ -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`.

View file

@ -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

View file

@ -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).

View file

@ -6,9 +6,7 @@
#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
@ -133,9 +131,8 @@ struct response {
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;
unsigned int zinitialized : 1;
#endif /* NETDATA_WITH_ZLIB */
};
struct web_client {
@ -161,16 +158,16 @@ struct web_client {
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 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 *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;
@ -194,7 +191,6 @@ struct web_client {
#endif
};
extern uid_t web_files_uid(void);
extern uid_t web_files_gid(void);