Skip to content

Commit d39a080

Browse files
committed
Test LS wont accept input from non fips configured filebeat
This test ensures logstash will not accept data from filebeat when using weak tls configuration. See elastic/ingest-dev#5472
1 parent 018b6a1 commit d39a080

File tree

2 files changed

+59
-3
lines changed

2 files changed

+59
-3
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
input {
2+
beats {
3+
port => 5044
4+
ssl_enabled => true
5+
ssl_certificate => "/usr/share/logstash/config/certs/logstash.crt"
6+
ssl_key => "/usr/share/logstash/config/certs/logstash.key"
7+
ssl_certificate_authorities => ["/usr/share/logstash/config/certs/ca.crt"]
8+
ssl_supported_protocols => ["TLSv1.1"]
9+
}
10+
}
11+
12+
filter {
13+
mutate {
14+
add_tag => ["filebeat"]
15+
}
16+
}
17+
18+
output {
19+
elasticsearch {
20+
hosts => ["https://elasticsearch:9200"]
21+
user => "elastic"
22+
password => "changeme"
23+
ssl_enabled => true
24+
ssl_certificate_authorities => ["/usr/share/logstash/config/certs/ca.crt"]
25+
index => "filebeat-weak-ssl-test-%{+YYYY.MM.dd}"
26+
}
27+
}

x-pack/distributions/internal/observabilitySRE/qa/acceptance/spec/acceptance_tests_spec.rb

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def docker_compose_up(env={}) = docker_compose_invoke("up --detach", env)
7070

7171
def docker_compose_down(env={}) = docker_compose_invoke("down --volumes", env)
7272

73-
context "when running with FIPS-compliant configuration" do
73+
context "when running LS to ES with FIPS-compliant configuration" do
7474
before(:all) do
7575
docker_compose_up
7676
wait_for_elasticsearch
@@ -98,7 +98,7 @@ def docker_compose_down(env={}) = docker_compose_invoke("down --volumes", env)
9898
end
9999
end
100100

101-
context "when running with non-FIPS compliant configuration" do
101+
context "when running LS to ES with non-FIPS compliant configuration" do
102102
before(:all) do
103103
docker_compose_up({"LOGSTASH_PIPELINE" => "logstash-to-elasticsearch-weak.conf"})
104104
wait_for_elasticsearch
@@ -127,7 +127,7 @@ def docker_compose_down(env={}) = docker_compose_invoke("down --volumes", env)
127127
end
128128
end
129129

130-
context "When running in a FIPS compliant configuration" do
130+
context "When running Filebeat through LS to ES in a FIPS compliant configuration" do
131131
before(:all) do
132132
docker_compose_up({"LOGSTASH_PIPELINE" => "filebeat-to-ls-to-es.conf"})
133133
wait_for_elasticsearch
@@ -154,4 +154,33 @@ def docker_compose_down(env={}) = docker_compose_invoke("down --volumes", env)
154154
expect(result["hits"]["hits"].first["_source"]["tags"]).to include("filebeat")
155155
end
156156
end
157+
158+
context "when running Filebeat through LS to ES with non-FIPS compliant configuration" do
159+
before(:all) do
160+
docker_compose_up({"LOGSTASH_PIPELINE" => "filebeat-to-ls-weak.conf"})
161+
wait_for_elasticsearch
162+
end
163+
164+
after(:all) do
165+
docker_compose_down
166+
end
167+
168+
it "prevents data flow when using TLSv1.1 which is not FIPS-compliant" do
169+
# Allow time for Logstash to attempt connections (and fail)
170+
sleep 15
171+
172+
# Verify that no index has been created that would indicate successful data flow
173+
response = es_request("/_cat/indices?v")
174+
today_pattern = "filebeat-weak-ssl-test"
175+
expect(response.body).not_to include(today_pattern)
176+
177+
# Check logs for the specific BouncyCastle FIPS error we expect
178+
logs = `docker logs fips_test_logstash 2>&1`
179+
180+
# Verify the logs contain the FIPS-mode TLS protocol error
181+
expect(logs).to include("No usable protocols enabled")
182+
expect(logs).to include("IllegalStateException")
183+
expect(logs).to include("org.bouncycastle")
184+
end
185+
end
157186
end

0 commit comments

Comments
 (0)