因为是本地使用,host 一般都是 localhost,这里注意证书的 common name 也要设置成 localhost,否则会报以下错误:
certificate is valid for xxx, not localhost
Country: FI
State: Pirkanmaa
Locality: Tampere
Organization: masi
Organizational Unit Name: SSL Certificate Test
CommonName: localhost
EmailAddress: masi@gmail.com
To Elasticsearch
openssl genrsa 2048 > host.key
openssl req -new -x509 -nodes -sha1 -days 3650 -key host.key > host.cert
certificate is valid for xxx, not localhost
Country: FI State: Pirkanmaa Locality: Tampere Organization: masi Organizational Unit Name: SSL Certificate Test CommonName: localhost EmailAddress: masi@gmail.com
ssl on; ssl_certificate /usr/local/openresty/nginx/certs/host.cert; ssl_certificate_key /usr/local/openresty/nginx/certs/host.key; ssl_session_timeout 5m; ssl_protocols TLSv1.2 TLSv1.1 TLSv1; ssl_ciphers HIGH:!aNULL:!eNULL:!LOW:!MD5; ssl_prefer_server_ciphers on;
$ elastic
$ service filebeat start
$ sudo update-ca-certificates Updating certificates in /etc/ssl/certs... 1 added, 0 removed; done. Running hooks in /etc/ca-certificates/update.d...
done.