mirror of
https://github.com/elastic/logstash.git
synced 2025-06-28 01:37:28 -04:00
set allow_superuser
to false as default (#16558)
- set allow_superuser as false by default for v9 - change the buildkite image of ruby unit test to non-root
This commit is contained in:
parent
c602b851bf
commit
db59cd0fbd
5 changed files with 9 additions and 6 deletions
|
@ -22,10 +22,12 @@ steps:
|
||||||
- label: ":rspec: Ruby unit tests"
|
- label: ":rspec: Ruby unit tests"
|
||||||
key: "ruby-unit-tests"
|
key: "ruby-unit-tests"
|
||||||
agents:
|
agents:
|
||||||
image: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-logstash-ci"
|
image: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-logstash-ci-no-root"
|
||||||
cpu: "4"
|
cpu: "4"
|
||||||
memory: "8Gi"
|
memory: "8Gi"
|
||||||
ephemeralStorage: "100Gi"
|
ephemeralStorage: "100Gi"
|
||||||
|
# Run as a non-root user
|
||||||
|
imageUID: "1002"
|
||||||
retry:
|
retry:
|
||||||
automatic:
|
automatic:
|
||||||
- limit: 3
|
- limit: 3
|
||||||
|
|
2
docs/static/settings-file.asciidoc
vendored
2
docs/static/settings-file.asciidoc
vendored
|
@ -359,7 +359,7 @@ separating each log lines per pipeline could be helpful in case you need to trou
|
||||||
|
|
||||||
| `allow_superuser`
|
| `allow_superuser`
|
||||||
| Setting to `true` to allow or `false` to block running Logstash as a superuser.
|
| Setting to `true` to allow or `false` to block running Logstash as a superuser.
|
||||||
| `true`
|
| `false`
|
||||||
|
|
||||||
| `pipeline.buffer.type`
|
| `pipeline.buffer.type`
|
||||||
| Determine where to allocate memory buffers, for plugins that leverage them.
|
| Determine where to allocate memory buffers, for plugins that leverage them.
|
||||||
|
|
|
@ -34,7 +34,7 @@ module LogStash
|
||||||
end
|
end
|
||||||
|
|
||||||
[
|
[
|
||||||
Setting::Boolean.new("allow_superuser", true),
|
Setting::Boolean.new("allow_superuser", false),
|
||||||
Setting::String.new("node.name", Socket.gethostname),
|
Setting::String.new("node.name", Socket.gethostname),
|
||||||
Setting::NullableString.new("path.config", nil, false),
|
Setting::NullableString.new("path.config", nil, false),
|
||||||
Setting::WritableDirectory.new("path.data", ::File.join(LogStash::Environment::LOGSTASH_HOME, "data")),
|
Setting::WritableDirectory.new("path.data", ::File.join(LogStash::Environment::LOGSTASH_HOME, "data")),
|
||||||
|
|
|
@ -456,7 +456,8 @@ class LogStash::Runner < Clamp::StrictCommand
|
||||||
def running_as_superuser
|
def running_as_superuser
|
||||||
if Process.euid() == 0
|
if Process.euid() == 0
|
||||||
if setting("allow_superuser")
|
if setting("allow_superuser")
|
||||||
deprecation_logger.deprecated("NOTICE: Running Logstash as superuser is not recommended and won't be allowed in the future. Set 'allow_superuser' to 'false' to avoid startup errors in future releases.")
|
logger.warn("NOTICE: Allowing Logstash to run as superuser is heavily discouraged as it poses a security risk. " +
|
||||||
|
"It is strongly recommended to set 'allow_superuser' to false.")
|
||||||
else
|
else
|
||||||
raise(RuntimeError, "Logstash cannot be run as superuser.")
|
raise(RuntimeError, "Logstash cannot be run as superuser.")
|
||||||
end
|
end
|
||||||
|
|
|
@ -595,7 +595,7 @@ describe LogStash::Runner do
|
||||||
it "runs successfully with warning message" do
|
it "runs successfully with warning message" do
|
||||||
LogStash::SETTINGS.set("allow_superuser", true)
|
LogStash::SETTINGS.set("allow_superuser", true)
|
||||||
expect(logger).not_to receive(:fatal)
|
expect(logger).not_to receive(:fatal)
|
||||||
expect(deprecation_logger_stub).to receive(:deprecated).with(/NOTICE: Running Logstash as superuser is not recommended and won't be allowed in the future. Set 'allow_superuser' to 'false' to avoid startup errors in future releases./)
|
expect(logger).to receive(:warn).with(/NOTICE: Allowing Logstash to run as superuser is heavily discouraged as it poses a security risk./)
|
||||||
expect { subject.run(args) }.not_to raise_error
|
expect { subject.run(args) }.not_to raise_error
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -607,7 +607,7 @@ describe LogStash::Runner do
|
||||||
it "runs successfully without any messages" do
|
it "runs successfully without any messages" do
|
||||||
LogStash::SETTINGS.set("allow_superuser", false)
|
LogStash::SETTINGS.set("allow_superuser", false)
|
||||||
expect(logger).not_to receive(:fatal)
|
expect(logger).not_to receive(:fatal)
|
||||||
expect(deprecation_logger_stub).not_to receive(:deprecated).with(/NOTICE: Running Logstash as superuser is not recommended and won't be allowed in the future. Set 'allow_superuser' to 'false' to avoid startup errors in future releases./)
|
expect(logger).not_to receive(:warn).with(/NOTICE: Allowing Logstash to run as superuser is heavily discouraged as it poses a security risk./)
|
||||||
expect { subject.run(args) }.not_to raise_error
|
expect { subject.run(args) }.not_to raise_error
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue