I wanted to disable TLS 1.0 and 1.1, but failed somehow.
I had multiple vhosts and a default site for Zabbix monitor. In every server section, I placed “ssl_protocols TLSv1.2 TLSv1.3;” and disabled unsafe ciphers.
But nmap told me TLS 1.0/1.1/1.2 were enabled and 1.3 was not, and the cipher were not correct too.
I also tried comments out the protocol line or just left TLSv1.2 or 1.3, but nothing changed.
I searched every file in /etc/nginx folder, but no other ssl_protocols lines found.
Is there anything I missed?
My environment is CentOS 8 and nginx 1.24.0.
Here are key parts of my configs.
/etc/nginx/nginx.conf:
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" $request_time $upstream_addr $upstream_response_time';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
underscores_in_headers on;
client_max_body_size 50m;
server_names_hash_bucket_size 512;
client_body_buffer_size 1024k;
proxy_cache_path /tmp/cache levels=1:2 keys_zone=cache_one:100m inactive=1d max_size=1g;
#gzip on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/vhost/*.conf;
}
/etc/nginx/conf.d/default.conf
server {
listen 80 default_server;
listen 443 ssl default_server;
server_name _;
ssl_certificate /etc/nginx/ssl/ssl.pem;
ssl_certificate_key /etc/nginx/ssl/ssl.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4:!DH:!DHE:!3DES:!DES;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
/etc/nginx/vhost/xxx_sale.conf
server {
listen 80;
server_name aaa.xxx.com bbb.xxx.com;
listen 443 ssl;
ssl_certificate /etc/nginx/ssl/ssl.pem;
ssl_certificate_key /etc/nginx/ssl/ssl.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4:!DH:!DHE:!3DES:!DES;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
location /station {
proxy_pass http://172.16.30.24;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
}
/etc/nginx/vhost/xxx_admin.conf
server {
listen 80;
server_name ccc.xxx.com;
return 301 https://$host$request_uri;
}
server {
server_name ccc.xxx.com;
listen 443 ssl;
ssl_certificate /etc/nginx/ssl/ssl.pem;
ssl_certificate_key /etc/nginx/ssl/ssl.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4:!DH:!DHE:!3DES:!DES;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
root /data/www/ttp-web;
location ~* .*\.go$ {
proxy_pass http://172.16.30.25;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
}