CIS Logstash Benchmark

Security configuration benchmark for Logstash data processing pipeline

v1.0.0 03-2025

Overview

▶

This benchmark provides prescriptive guidance for establishing a secure configuration posture for Logstash. It covers non-root service operation, API authentication, secrets management via keystore, TLS on inputs and outputs, logging and slowlog configuration, API and input binding restrictions, file permissions, persistent queue settings, and JVM security hardening.

14Recommendations
7Sections
2Profile Levels
SectionAreaFocus
1Installation & ServiceVersion management, service user
2Authentication & SecretsAPI auth, keystore
3Encryption & TLSInput TLS, output TLS
4Logging & MonitoringLog level, rotation
5Network SecurityAPI binding, input binding
6File System SecurityConfig perms, data perms
7Resource & JVM HardeningPersistent queue, JVM

Profile Definitions

▶
ProfileDescriptionIntended Use
L1Level 1 — StandardEssential security for all Logstash deployments; minimal performance impact.
L2Level 2 — HardenedAdvanced hardening for PCI-DSS, HIPAA, or high-security environments.

1 — Installation & Service

▶

1.1 Version & User

▶
1.1.1 Ensure Logstash is running the latest stable version (Manual)
L1 Manual
Description

This recommendation verifies that Logstash is running the latest stable version on the Logstash data processing pipeline. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Logstash data processing pipeline vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check Logstash version
/usr/share/logstash/bin/logstash --version
dpkg -l logstash 2>/dev/null || rpm -qi logstash 2>/dev/null
Remediation
# Update to latest stable
apt-get update && apt-get install -y logstash
# or
yum update logstash
1.1.2 Ensure Logstash runs as a dedicated non-root user (Automated)
L1 Auto
Description

This recommendation verifies that Logstash runs as a dedicated non-root user on the Logstash data processing pipeline. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Logstash data processing pipeline vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check Logstash service user
ps -eo user,pid,args | grep logstash | grep -v grep
grep '^logstash' /etc/passwd
Remediation
# Run Logstash as dedicated non-root user
useradd -r -s /usr/sbin/nologin logstash 2>/dev/null
chown -R logstash:logstash /etc/logstash /var/log/logstash /var/lib/logstash
# In /etc/systemd/system/logstash.service:
# User=logstash
# Group=logstash

2 — Authentication & Secrets

▶

2.1 API Auth & Keystore

▶
2.1.1 Ensure API authentication is enabled (Automated)
L1 Auto
Description

This recommendation verifies that API authentication is enabled on the Logstash data processing pipeline. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Logstash data processing pipeline vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check API authentication
curl -s http://localhost:9600/ | python3 -m json.tool
grep 'api.auth' /etc/logstash/logstash.yml
Remediation
# Enable API authentication
# In /etc/logstash/logstash.yml:
api.auth.type: basic
api.auth.basic.username: logstash_admin
api.auth.basic.password: "${LOGSTASH_API_PASSWORD}"
api.auth.basic.password_policy.mode: WARN
# Restart:
systemctl restart logstash
2.1.2 Ensure credentials are managed via the Logstash keystore (Manual)
L1 Manual
Description

This recommendation verifies that credentials are managed via the Logstash keystore on the Logstash data processing pipeline. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Logstash data processing pipeline vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check pipeline configuration for credentials
grep -rn 'password\|api_key\|secret' /etc/logstash/conf.d/ | head -10
Remediation
# Use Logstash keystore for secrets
/usr/share/logstash/bin/logstash-keystore create
/usr/share/logstash/bin/logstash-keystore add ES_PASSWORD
# Reference in pipeline config:
# output {
#   elasticsearch {
#     password => "${ES_PASSWORD}"
#   }
# }
# Never store plain-text credentials in pipeline configs

3 — Encryption & TLS

▶

3.1 Input & Output TLS

▶
3.1.1 Ensure TLS is enabled on Beats/TCP inputs (Automated)
L1 Auto
Description

This recommendation verifies that TLS is enabled on Beats/TCP inputs on the Logstash data processing pipeline. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Logstash data processing pipeline vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check SSL/TLS on Beats input
grep -A10 'beats' /etc/logstash/conf.d/*.conf | grep -i 'ssl'
Remediation
# Enable TLS on Beats input
# In pipeline config:
input {
  beats {
    port => 5044
    ssl_enabled => true
    ssl_certificate => "/etc/logstash/certs/logstash.crt"
    ssl_key => "/etc/logstash/certs/logstash.key"
    ssl_certificate_authorities => ["/etc/logstash/certs/ca.crt"]
    ssl_client_authentication => "required"
  }
}
3.1.2 Ensure TLS is enabled on Elasticsearch output (Automated)
L1 Auto
Description

This recommendation verifies that TLS is enabled on Elasticsearch output on the Logstash data processing pipeline. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Logstash data processing pipeline vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check Elasticsearch output TLS
grep -A10 'elasticsearch' /etc/logstash/conf.d/*.conf | grep -i 'ssl\|https'
Remediation
# Enable TLS on Elasticsearch output
output {
  elasticsearch {
    hosts => ["https://es-node1:9200"]
    ssl_enabled => true
    ssl_certificate_authorities => ["/etc/logstash/certs/ca.crt"]
    ssl_certificate => "/etc/logstash/certs/logstash.crt"
    ssl_key => "/etc/logstash/certs/logstash.key"
    ssl_verification_mode => "full"
  }
}

4 — Logging & Monitoring

▶

4.1 Logs & Rotation

▶
4.1.1 Ensure logging level and slowlog are configured (Automated)
L1 Auto
Description

This recommendation verifies that logging level and slowlog are configured on the Logstash data processing pipeline. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Logstash data processing pipeline vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check logging configuration
grep 'log.level\|log.format\|path.logs' /etc/logstash/logstash.yml
ls -la /var/log/logstash/
Remediation
# Configure logging
# In /etc/logstash/logstash.yml:
log.level: info
log.format: json
path.logs: /var/log/logstash
slowlog.threshold.warn: 2s
slowlog.threshold.info: 1s
slowlog.threshold.debug: 500ms
4.1.2 Ensure log rotation is configured (Automated)
L1 Auto
Description

This recommendation verifies that log rotation is configured on the Logstash data processing pipeline. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Logstash data processing pipeline vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check log rotation
ls -la /var/log/logstash/logstash-plain*.log* 2>/dev/null
cat /etc/logrotate.d/logstash 2>/dev/null
Remediation
# Configure log rotation
cat > /etc/logrotate.d/logstash << 'EOF'
/var/log/logstash/*.log {
    daily
    rotate 30
    compress
    delaycompress
    missingok
    notifempty
    copytruncate
}
EOF

5 — Network Security

▶

5.1 API & Input Bindings

▶
5.1.1 Ensure the monitoring API is bound to localhost (Automated)
L1 Auto
Description

This recommendation verifies that the monitoring API is bound to localhost on the Logstash data processing pipeline. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Logstash data processing pipeline vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check API binding
grep 'api.http.host\|api.http.port' /etc/logstash/logstash.yml
ss -tlnp | grep 9600
Remediation
# Restrict API binding
# In /etc/logstash/logstash.yml:
api.http.host: 127.0.0.1
api.http.port: 9600
api.ssl.enabled: true
api.ssl.keystore.path: /etc/logstash/certs/api-keystore.p12
api.ssl.keystore.password: "${API_KEYSTORE_PASSWORD}"
5.1.2 Ensure pipeline inputs are bound to specific interfaces (Automated)
L1 Auto
Description

This recommendation verifies that pipeline inputs are bound to specific interfaces on the Logstash data processing pipeline. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Logstash data processing pipeline vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check pipeline input bindings
grep -rn 'host\|port' /etc/logstash/conf.d/*.conf | head -10
ss -tlnp | grep -E '5044|514'
Remediation
# Restrict input bindings
# Bind to specific interfaces:
input {
  beats {
    host => "10.0.1.5"
    port => 5044
  }
}
# Use firewall rules:
ufw allow from 10.0.0.0/8 to any port 5044 proto tcp

6 — File System Security

▶

6.1 Config & Data Permissions

▶
6.1.1 Ensure configuration file permissions are restricted (Automated)
L1 Auto
Description

This setting ensures that configuration file permissions are restricted on the Logstash data processing pipeline. Restricting this capability limits potential abuse and enforces the principle of least privilege across the environment.

Rationale

Unrestricted access to this capability could allow unauthorized users or processes to perform actions beyond their intended scope. Applying least-privilege principles to the Logstash data processing pipeline is essential for defense in depth.

Audit
# Check config file permissions
stat -c '%a %U %G' /etc/logstash/logstash.yml
find /etc/logstash -type f -exec stat -c '%a %U %G %n' {} \;
Remediation
# Restrict configuration permissions
chown -R root:logstash /etc/logstash
chmod 750 /etc/logstash
chmod 640 /etc/logstash/logstash.yml
chmod 640 /etc/logstash/conf.d/*.conf
chmod 600 /etc/logstash/logstash.keystore
6.1.2 Ensure data directory permissions are restricted (Automated)
L1 Auto
Description

This setting ensures that data directory permissions are restricted on the Logstash data processing pipeline. Restricting this capability limits potential abuse and enforces the principle of least privilege across the environment.

Rationale

Unrestricted access to this capability could allow unauthorized users or processes to perform actions beyond their intended scope. Applying least-privilege principles to the Logstash data processing pipeline is essential for defense in depth.

Audit
# Check data directory
stat -c '%a %U %G' /var/lib/logstash
find /var/lib/logstash -maxdepth 1 -exec stat -c '%a %n' {} \;
Remediation
# Restrict data directory
chown -R logstash:logstash /var/lib/logstash
chmod 750 /var/lib/logstash
chmod 750 /var/log/logstash

7 — Resource & JVM Hardening

▶

7.1 Queue & JVM

▶
7.1.1 Ensure persistent queue and resource limits are configured (Automated)
L1 Auto
Description

This recommendation verifies that persistent queue and resource limits are configured on the Logstash data processing pipeline. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Logstash data processing pipeline vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check pipeline workers and queue
grep -E 'pipeline.workers|queue.type|queue.max_bytes' /etc/logstash/logstash.yml
Remediation
# Configure resource limits and persistent queue
# In /etc/logstash/logstash.yml:
pipeline.workers: 2
pipeline.batch.size: 125
queue.type: persisted
queue.max_bytes: 1gb
queue.checkpoint.writes: 1024
7.1.2 Ensure JVM security settings are hardened (Automated)
L1 Auto
Description

This recommendation verifies that JVM security settings are hardened on the Logstash data processing pipeline. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Logstash data processing pipeline vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check JVM settings
cat /etc/logstash/jvm.options | grep -v '^#' | grep -v '^$'
Remediation
# Configure JVM security settings
# In /etc/logstash/jvm.options:
-Xms1g
-Xmx1g
-Dlog4j2.formatMsgNoLookups=true
-Djava.security.policy=/etc/logstash/security.policy
# Disable remote JMX:
# Do NOT set com.sun.management.jmxremote