Implementing F5 NGINX STIGs: A Practical Guide to DoD Security Compliance
Introduction
In today’s security-conscious environment, particularly within federal and DoD contexts, Security Technical Implementation Guides (STIGs) have become the gold standard for hardening systems and applications. For organizations deploying NGINX—whether as a web server, reverse proxy, or load balancer—understanding and implementing NGINX STIGs is critical for maintaining compliance and securing your infrastructure.
This guide walks through the essential aspects of NGINX STIG implementation, providing practical insights for security engineers and system administrators tasked with meeting these stringent requirements.
Understanding STIGs and Their Importance
STIGs are configuration standards created by the Defense Information Systems Agency (DISA) to enhance the security posture of DoD information systems. These guides provide detailed technical requirements for securing software, hardware, and networks against known vulnerabilities and attack vectors.
For NGINX deployments, STIG compliance ensures:
- Protection against common web server vulnerabilities
- Proper access controls and authentication mechanisms
- Secure configuration of cryptographic protocols
- Comprehensive logging and auditing capabilities
- Defense-in-depth security posture
Key NGINX STIG Categories
-
Access Control and Authentication
Critical Controls:
The STIG mandates strict access controls for NGINX configuration files and directories. All NGINX configuration files should be owned by root (or the designated administrative user) with permissions set to 600 or more restrictive.
# Verify permissions
sudo chmod 600 /etc/nginx/nginx.conf
Client Certificate Authentication:
For environments requiring mutual TLS authentication, NGINX must be configured to validate client certificates:
# Include the following lines in the server {} block of nginx.conf:
ssl_certificate /etc/nginx/ssl/server_cert.pem;
ssl_certificate_key /etc/nginx/ssl/server_key.pem;
# Enable client certificate verification
ssl_client_certificate /etc/nginx/ca_cert.pem;
ssl_verify_client on;
# Optional: Set verification depth for client certificates
ssl_verify_depth 2;
location / {
proxy_pass http://backend_service;
# Restrict access to valid PIV credentials
if ($ssl_client_verify != SUCCESS) {
return 403;
}
}
Certificate Management:
- All certificates must be signed by a DoD-approved Certificate Authority
- Private keys must be protected with appropriate file permissions (400)
- Certificate expiration dates must be monitored and renewed before expiry
-
Cryptographic Protocols and Ciphers
One of the most critical STIG requirements involves configuring approved cryptographic protocols and cipher suites.
Approved TLS Versions:
STIGs typically require TLS 1.2 as a minimum, with TLS 1.3 preferred:
ssl_protocols TLSv1.2 TLSv1.3;
FIPS-Compliant Cipher Suites:
When operating in FIPS mode, NGINX must use only FIPS 140-2 validated cipher suites:
ssl_ciphers 'TLS_AES_256_GCM_SHA384:TLS_AES_128_GCM_SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256';
ssl_prefer_server_ciphers on;
-
Logging and Auditing
Comprehensive logging is mandatory for STIG compliance, enabling security monitoring and incident response.
Required Log Formats:
log_format security_log '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" '
'$request_time $upstream_response_time '
'$ssl_protocol/$ssl_cipher';
access_log /var/log/nginx/access.log security_log;
error_log /var/log/nginx/error.log info;
Key Logging Requirements:
- Log all access attempts (successful and failed)
- Capture client IP addresses and authentication details
- Record timestamps in UTC or local time consistently
- Ensure logs are protected from unauthorized modification (600 permissions)
- Implement log rotation and retention policies
-
Pass Security Attributes via a Proxy
STIGs require implementation of security attributes to implement security policy for access control and flow control for users, data, and traffic:
# Include the "proxy_pass" service as well as the "proxy_set_header" values as required:
proxy_pass http://backend_service;
proxy_set_header X-Security-Classification "Confidential";
proxy_set_header X-Data-Origin "Internal-System";
proxy_set_header X-Access-Permissions "Read,Write";
-
Request Filtering and Validation
Protecting against malicious requests is a core STIG requirement:
# Limit request methods
if ($request_method !~ ^(GET|POST|PUT|DELETE|HEAD)$) {
return 405;
}
# Request size limits
client_max_body_size 10m;
client_body_buffer_size 128k;
# Timeouts to prevent slowloris attacks
client_body_timeout 10s;
client_header_timeout 10s;
keepalive_timeout 5s 5s;
send_timeout 10s;
# Rate limiting
limit_req_zone $binary_remote_addr zone=req_limit:10m rate=10r/s;
limit_req zone=req_limit burst=20 nodelay;
-
SIEM Integration
Forward NGINX logs to SIEM platforms for centralized monitoring:
# Syslog integration
error_log syslog:server=siem.example.com:514,facility=local7,tag=nginx,severity=info;
access_log syslog:server=siem.example.com:514,facility=local7,tag=nginx
NGINX Plus Specific STIG Considerations
Organizations using NGINX Plus have additional capabilities to meet STIG requirements:
Active Health Checks
upstream backend {
zone backend 64k;
server backend1.example.com;
server backend2.example.com;
}
match server_ok {
status 200-399;
header Content-Type ~ "text/html";
body ~ "Expected Content";
}
server {
location / {
proxy_pass http://backend;
health_check match=server_ok;
}
}
JWT Authentication
For API security, NGINX Plus can validate JSON Web Tokens:
location /api {
auth_jwt "API Authentication";
auth_jwt_key_file /etc/nginx/keys/jwt_public_key.pem;
auth_jwt_require exp iat;
}
Dynamic Configuration API
The NGINX Plus API must be secured and access-controlled:
location /api {
api write=on;
allow 10.0.0.0/8; # Management network only
deny all;
# Require client certificate
ssl_verify_client on;
}
Best Practices for STIG Implementation
-
Start with Baseline Configuration: Use DISA's STIG checklist as your starting point and customize for your environment.
-
Implement Defense in Depth: STIGs are minimum requirements; layer additional security controls where appropriate.
-
Automate Validation: Use configuration management and automated scanning to maintain continuous compliance.
-
Document Deviations: When technical controls aren't feasible, document risk acceptances and compensating controls.
-
Regular Updates: STIGs are updated periodically; establish a process to review and implement new requirements.
-
Testing Before Production: Validate STIG configurations in development/staging before deploying to production.
-
Monitor and Audit: Implement continuous monitoring to detect configuration drift and security events.
Conclusion
Achieving and maintaining NGINX STIG compliance requires a comprehensive approach combining technical controls, process discipline, and ongoing vigilance. While the requirements can seem daunting initially, properly implemented STIGs significantly enhance your security posture and reduce risk exposure.
By treating STIG compliance as an opportunity to improve security rather than merely a checkbox exercise, organizations can build robust, defensible NGINX deployments that meet the most stringent security requirements while maintaining operational efficiency.
Remember: security is not a destination but a journey. Regular reviews, updates, and continuous improvement are essential to maintaining compliance and protecting your infrastructure in an ever-evolving threat landscape.
Additional Resources
-
DISA STIG Library: https://public.cyber.mil/stigs/
-
NGINX Security Controls: https://docs.nginx.com/nginx/admin-guide/security-controls/
- NIST Cybersecurity Framework: https://www.nist.gov/cyberframework
Have questions about implementing NGINX STIGs in your environment? Share your challenges and experiences in the comments below.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)