mirror of
https://github.com/netdata/netdata.git
synced 2025-04-25 21:43:55 +00:00
support https_proxy too (#19733)
* support https_proxy too * fixed documentation
This commit is contained in:
parent
b1c78c095c
commit
e3b7abee30
2 changed files with 45 additions and 16 deletions
src
|
@ -88,26 +88,34 @@ static inline int check_socks_enviroment(const char **proxy)
|
|||
}
|
||||
|
||||
safe_log_proxy_error(
|
||||
"Environment var \"socks_proxy\" defined but of unknown format. Supported syntax: \"socks5[h]://[user:pass@]host:ip\".",
|
||||
"Environment var \"socks_proxy\" defined but of unknown format. Supported syntax: \"socks5[h]://[user:pass@]host:port\".",
|
||||
tmp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline int check_http_enviroment(const char **proxy)
|
||||
static inline int check_http_environment(const char **proxy)
|
||||
{
|
||||
char *tmp = getenv("http_proxy");
|
||||
const char *var = "http_proxy";
|
||||
char *tmp = getenv(var);
|
||||
|
||||
if (!tmp || !*tmp)
|
||||
return 1;
|
||||
if (!tmp || !*tmp) {
|
||||
var = "https_proxy";
|
||||
tmp = getenv(var);
|
||||
if (!tmp || !*tmp)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (aclk_verify_proxy(tmp) == PROXY_TYPE_HTTP) {
|
||||
*proxy = tmp;
|
||||
return 0;
|
||||
}
|
||||
|
||||
safe_log_proxy_error(
|
||||
"Environment var \"http_proxy\" defined but of unknown format. Supported syntax: \"http[s]://[user:pass@]host:ip\".",
|
||||
tmp);
|
||||
char buf[1024];
|
||||
snprintfz(buf, sizeof(buf),
|
||||
"Environment var '%s' defined but of unknown format. Supported syntax: 'http://[user:pass@]host:port'.",
|
||||
var, tmp);
|
||||
safe_log_proxy_error(buf, tmp);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -132,7 +140,7 @@ const char *aclk_lws_wss_get_proxy_setting(ACLK_PROXY_TYPE *type)
|
|||
proxy);
|
||||
#endif
|
||||
}
|
||||
if (check_http_enviroment(&proxy) == 0)
|
||||
if (check_http_environment(&proxy) == 0)
|
||||
*type = PROXY_TYPE_HTTP;
|
||||
return proxy;
|
||||
}
|
||||
|
|
|
@ -40,18 +40,39 @@ Netdata Agents can be connected to Netdata Cloud by creating `/INSTALL_PREFIX/ne
|
|||
insecure = no
|
||||
```
|
||||
|
||||
| option | description | required |
|
||||
|:--------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------:|
|
||||
| url | The Netdata Cloud base URL (defaults to `https://app.netdata.cloud`) | no |
|
||||
| token | The claiming token for your Netdata Cloud Space | yes |
|
||||
| rooms | A comma-separated list of Rooms that the Agent will be added to | no |
|
||||
| proxy | Can be anything libcurl accepts as a proxy, or the `none` and `env` keywords. `none` (or just an empty value) disables proxy configuration, while `env` tells libcurl to use the environment to determine the proxy configuration (usually the `https_proxy` environment variable) | no |
|
||||
| insecure | A boolean (either `yes`, or `no`) and when set to `yes` it instructs libcurl to disable host verification. | no |
|
||||
| option | description | required |
|
||||
|:--------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------:|
|
||||
| url | The Netdata Cloud base URL (defaults to `https://app.netdata.cloud`) | no |
|
||||
| token | The claiming token for your Netdata Cloud Space | yes |
|
||||
| rooms | A comma-separated list of Rooms that the Agent will be added to | no |
|
||||
| proxy | The format is similar to libcurl, or `none`, or `env`. `none` (or just an empty value) disables proxy configuration, while `env` makes Netdata check the environment variable `http_proxy` for proxy configuration. | no |
|
||||
| insecure | A boolean (either `yes`, or `no`) and when set to `yes` it instructs libcurl to disable host verification. | no |
|
||||
|
||||
If the Agent is already running, you can either run `netdatacli reload-claiming-state` or [restart the Agent](/docs/netdata-agent/start-stop-restart.md). Otherwise, the Agent will be connected when it starts.
|
||||
|
||||
If the connection process fails, the reason will be logged in daemon.log (search for "CLAIM") and the `cloud` section of `http://ip:19999/api/v3/info`.
|
||||
|
||||
##### Proxy configuration
|
||||
|
||||
If you need to use a proxy to connect to Netdata Cloud, you can set the `proxy` option in `claim.conf`, like this:
|
||||
|
||||
- empty, to disable proxy configuration.
|
||||
- `none` to disable proxy configuration.
|
||||
- `env` to use the environment variable `http_proxy` (this is the default).
|
||||
- `http://[user:pass@]host:port`, to connect via an HTTP or HTTPS proxy.
|
||||
- `socks5[h]://[user:pass@]host:port`, to connect via a SOCKS5 or SOCKS5h proxy.
|
||||
|
||||
The `http_proxy` environment variable is used only when the `proxy` option in `claim.conf` is set to `env` (which is the default). The `http_proxy` environment can be:
|
||||
|
||||
- empty, to disable proxy configuration.
|
||||
- `http://[user:pass@]host:port`, to connect via an HTTP or HTTPS proxy.
|
||||
- `socks5[h]://[user:pass@]host:port`, to connect via a SOCKS5 or SOCKS5h proxy.
|
||||
|
||||
In Netdata version v2.2.7 and later, Netdata also checks for the `https_proxy` environment variable if the `http_proxy` variable is not set (so, Netdata first checks for `http_proxy` and only this is unset it checks for `https_proxy`).
|
||||
|
||||
Netdata does not currently support secure connections to proxies. So, while the connection from the proxy to Netdata Cloud is encrypted and secure, the connection from the Netdata Agent to the proxy is unencrypted.
|
||||
|
||||
|
||||
#### Automatically, via environment variables
|
||||
|
||||
Netdata will use the following environment variables:
|
||||
|
|
Loading…
Add table
Reference in a new issue