Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to use 127.0.0.1 for network listeners by default in some cases #3639

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Unreleased

### 🛑 Breaking changes 🛑

- (Splunk) `SPLUNK_LISTEN_INTERFACE`: Move to use 127.0.0.1 for the network listen interface of the collector by default on Windows and Linux installers, as well as Chocolatey.
Users can override this behavior by configuring the installers and Chocolatey to use `0.0.0.0` to continue to use the previous default value. Please see [Advanced Configuration](https://github.com/signalfx/splunk-otel-collector#advanced-configuration) for more information.


## v0.85.0

***ADVANCED NOTICE - SPLUNK_LISTEN_INTERFACE DEFAULTS***
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,17 @@ listen to configure the `SPLUNK_DEBUG_CONFIG_SERVER_PORT` environment variable.

You can use the environment variable `SPLUNK_LISTEN_INTERFACE` and associated installer option to configure the network
interface on which the collector's receivers and telemetry endpoints will listen.
The default value of `SPLUNK_LISTEN_INTERFACE` is set to `0.0.0.0`.
The default value of `SPLUNK_LISTEN_INTERFACE` is set to `0.0.0.0`, except on Chocolatey and
the Windows and Linux standalone installers, where it defaults to `127.0.0.1`.

The table below shows the configuration switches to use at installation time:

| Method | Command |
|------------|-------------------------------------------------------------------------------------|
| Chocolatey | `choco install splunk-otel-collector --params="'/SPLUNK_LISTEN_INTERFACE:0.0.0.0'"` |
| Linux | `sudo install.sh --listen-interface=0.0.0.0` |
atoulme marked this conversation as resolved.
Show resolved Hide resolved
| Windows | `install.ps1 --network_interface=0.0.0.0` |
atoulme marked this conversation as resolved.
Show resolved Hide resolved


## Upgrade guidelines

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The following package parameters are available:
* `/SPLUNK_HEC_URL`: URL of the Splunk HEC endpoint (e.g. `https://ingest.us1.signalfx.com/v1/log`). Default value is `https://ingest.$SPLUNK_REALM.signalfx.com/v1/log`
* `/SPLUNK_TRACE_URL`: URL of the Splunk trace endpoint (e.g. `https://ingest.us1.signalfx.com/v2/trace`). Default value is `https://ingest.$SPLUNK_REALM.signalfx.com/v2/trace`
* `/SPLUNK_BUNDLE_DIR`: The path to the Smart Agent bundle directory for the `smartagent` receiver and extension. The default path is provided by the Collector package. If the specified path is changed from the default value, the path should be an existing directory on the system. Default value is `\Program Files\Splunk\OpenTelemetry Collector\agent-bundle`.
* `/SPLUNK_LISTEN_INTERFACE`: The network interface the collector receivers will listen on. Default value is `0.0.0.0`.
* `/SPLUNK_LISTEN_INTERFACE`: The network interface the collector receivers will listen on. Default value is `127.0.0.1`.
* `/MODE`: This parameter is used for setting the Collector configuration file to `\ProgramData\Splunk\OpenTelemetry Collector\agent_config.yaml` or `\ProgramData\Splunk\OpenTelemetry Collector\gateway_config.yaml`. Possible values are `agent` and `gateway`. Default value is `agent`.
* `/WITH_FLUENTD`: Whether to download, install, and configure Fluentd to collect and forward log events to the Collector. Possible values are `true` and `false`. If set to `true`, the Fluentd MSI package will be downloaded from `https://packages.treasuredata.com`. Default value is `false`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ try {
}
}
catch {
$SPLUNK_LISTEN_INTERFACE = "0.0.0.0"
$SPLUNK_LISTEN_INTERFACE = "127.0.0.1"
write-host "The SPLUNK_LISTEN_INTERFACE parameter is not specified. Using default configuration."
}

Expand Down
4 changes: 2 additions & 2 deletions internal/buildscripts/packaging/installer/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
.EXAMPLE
.\install.ps1 -access_token "ACCESSTOKEN" -mode "gateway"
.PARAMETER network_interface
(OPTIONAL) The network interface the collector receivers listen on. (default: "0.0.0.0")
(OPTIONAL) The network interface the collector receivers listen on. (default: "127.0.0.1")
.EXAMPLE
.\install.ps1 -access_token "ACCESSTOKEN" -network_interface "127.0.0.1"
.PARAMETER ingest_url
Expand Down Expand Up @@ -113,7 +113,7 @@ param (
[string]$realm = "us0",
[string]$memory = "512",
[ValidateSet('agent','gateway')][string]$mode = "agent",
[string]$network_interface = "0.0.0.0",
[string]$network_interface = "127.0.0.1",
[string]$ingest_url = "",
[string]$api_url = "",
[string]$trace_url = "",
Expand Down
2 changes: 1 addition & 1 deletion internal/buildscripts/packaging/installer/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ td_agent_gpg_key_url="${td_agent_repo_base}/GPG-KEY-td-agent"
default_stage="release"
default_realm="us0"
default_memory_size="512"
default_listen_interface="0.0.0.0"
default_listen_interface="127.0.0.1"

default_collector_version="latest"
default_td_agent_version="4.3.2"
Expand Down
6 changes: 3 additions & 3 deletions internal/buildscripts/packaging/tests/installer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def verify_config_file(container, path, key, value, exists=True):
assert not match, f"'{line}' found in {path}:\n{config}"


def verify_env_file(container, mode="agent", config_path=None, memory=TOTAL_MEMORY, listen_addr="0.0.0.0", ballast=None):
def verify_env_file(container, mode="agent", config_path=None, memory=TOTAL_MEMORY, listen_addr="127.0.0.1", ballast=None):
env_path = SPLUNK_ENV_PATH
if container.exec_run(f"test -f {OLD_SPLUNK_ENV_PATH}").exit_code == 0:
env_path = OLD_SPLUNK_ENV_PATH
Expand Down Expand Up @@ -227,7 +227,7 @@ def test_installer_custom(distro, arch):
install_cmd = " ".join((
get_installer_cmd(),
"--with-fluentd",
"--listen-interface 127.0.0.1",
"--listen-interface 10.0.0.1",
"--memory 256",
"--ballast 64",
f"--service-user {service_owner} --service-group {service_owner}",
Expand All @@ -250,7 +250,7 @@ def test_installer_custom(distro, arch):
assert output.decode("utf-8").strip() == f"otelcol version v{collector_version}"

# verify env file created with configured parameters
verify_env_file(container, config_path=custom_config, memory="256", listen_addr="127.0.0.1", ballast="64")
verify_env_file(container, config_path=custom_config, memory="256", listen_addr="10.0.0.1", ballast="64")

# verify collector service status
assert wait_for(lambda: service_is_running(container, service_owner=service_owner))
Expand Down
2 changes: 1 addition & 1 deletion tests/zeroconfig/windows/testdata/Dockerfile.iis.server
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ENV ACCESS_TOKEN_TMP=$access_token
RUN `
$token = $Env:ACCESS_TOKEN_TMP; `
$collector_msi_path = (dir "c:\setup\splunk-otel-collector-*.msi").FullName; `
c:\setup\install.ps1 -access_token $token -msi_path $collector_msi_path -with_dotnet_instrumentation $true -deployment_env zc-iis-test -ingest_url "http://splunk-otel-collector:9943" -trace_url "http://splunk-otel-collector:7276/v2/trace"
c:\setup\install.ps1 -access_token $token -msi_path $collector_msi_path -with_dotnet_instrumentation $true -deployment_env zc-iis-test -ingest_url "http://splunk-otel-collector:9943" -trace_url "http://splunk-otel-collector:7276/v2/trace" -network_interface "0.0.0.0"
ENV ACCESS_TOKEN_TMP=

COPY apps/bin/aspnetfxapp/_PublishedWebsites/AspNet.WebApi.NetFramework/ /apps/aspnetfx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ENV ACCESS_TOKEN_TMP=$access_token
RUN `
$token = $Env:ACCESS_TOKEN_TMP; `
$collector_msi_path = (dir "c:\setup\splunk-otel-collector-*.msi").FullName; `
c:\setup\install.ps1 -access_token $token -msi_path $collector_msi_path -with_fluentd $false -ingest_url "http://192.0.2.1:12345" -trace_url "http://192.0.2.1:12345"
c:\setup\install.ps1 -access_token $token -msi_path $collector_msi_path -with_fluentd $false -ingest_url "http://192.0.2.1:12345" -trace_url "http://192.0.2.1:12345" -network_interface "0.0.0.0"
ENV ACCESS_TOKEN_TMP=
RUN `
Set-ItemProperty -force -path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' -name 'SPLUNK_CONFIG' -value 'C:\setup\pipeline-collector.yaml'
Expand Down
Loading