我'使用流浪漢,Ansible角色生成SSL/TLS證書,但無論我怎麼努力,將生成的證書缺少主題備用名稱:Ansible X509證書丟失主題備用名稱
- name: Create an SSL security key & CSR (Certificate Signing Request)
shell: openssl req -new -newkey rsa:2048 -nodes -keyout /etc/apache2/ssl/{{ item.host }}.key -subj "/subjectAltName=DNS.1={{ item.host }}, DNS.2=www.{{ item.host }}, IP.1=192.168.33.11/C={{params['ssl'].country_name}}/ST={{params['ssl'].state}}/L={{params['ssl'].locality}}/O={{params['ssl'].organization}}/CN={{ item.host }}" -out /etc/apache2/ssl/{{ item.host }}.csr
args:
executable: "/bin/bash"
with_items: "{{params['vhosts']}}"
when: item.ssl is defined and item.ssl
的證書文件被產生,但他們谷歌瀏覽器總是說
Subject Alternative Name Missing
這是我的環境的調試:
$ openssl version
OpenSSL 1.0.2l 25 May 2017
$ openssl x509 -noout -text -in /etc/apache2/ssl/myhost.dev.crt
Certificate:
Data:
Version: 1 (0x0)
Serial Number:
a2:77:35:c7:6a:72:35:22
Signature Algorithm: sha256WithRSAEncryption
Issuer: subjectAltName=DNS.1=myhost.dev, DNS.2=www.myhost.dev, IP.1=192.168.33.11, C=DE, ST=Berlin, L=Berlin, O=Ltd, CN=myhost.dev
Validity
Not Before: Jun 12 15:36:58 2017 GMT
Not After : Jun 10 15:36:58 2027 GMT
Subject: subjectAltName=DNS.1=myhost.dev, DNS.2=www.myhost.dev, IP.1=192.168.33.11, C=DE, ST=Berlin, L=Berlin, O=Ltd, CN=myhost.dev
'發行人:subjectAltName = DNS.1 = myhost.dev,DNS.2 = www.myhost.dev,IP.1 = 192.168.33.11 ...'是*不正確。它看起來像是因爲你使用了'-subj ...'。也許你應該手動創建它。另請參閱[如何使用您的證書頒發機構簽署證書籤名請求](http://stackoverflow.com/a/21340898/608639)和[如何使用openssl創建自簽名證書?](http:// stackoverflow .com/q/10175812/608639)您還需要將自簽名證書放入適當的信任庫中。 – jww