ใบรับรอง SSL ที่ลงนามด้วยตนเองใน GCE 'ไม่สามารถแยกวิเคราะห์ใบรับรอง SSL'

ฉันมีเว็บไซต์ เช่น mySite.com ทำงานบน Google Cloud Engine ซึ่งเป็นเครื่องเสมือน Debian ฉันต้องการติดตั้งใบรับรอง SSL บนไซต์นี้ เพื่อที่ Firefox จะไม่แสดงข้อผิดพลาดด้านความปลอดภัยในช่องเข้าสู่ระบบสำหรับสิ่งหนึ่ง (ไม่คุ้นเคยกับความปลอดภัยของเว็บ – ขออภัยด้วยถ้อยคำที่ไร้เดียงสา)

ป้อนคำอธิบายรูปภาพที่นี่

ฉันทราบว่า SSL ควรลงนามโดยหน่วยงานกลาง (CA) และสำหรับสิ่งนี้ ฉันสามารถทำได้ i.) ชำระเงินและรับการลงนามโดย CA ที่รู้จัก หรือ ii.) สร้าง CA ด้วยตนเองและลงนามในใบรับรองของฉันเองโดยไม่ต้องจ่ายเงิน อะไรก็ตาม. ตอนนี้ฉันกำลังลองใช้ตัวเลือกที่ 2 เพื่อดูว่าสิ่งต่างๆ ทำงานอย่างไรบน GCE และเพียงพอสำหรับวัตถุประสงค์ของฉันหรือไม่ กล่าวคือ SSL ที่ผ่านการรับรองด้วยตนเองจะให้ความปลอดภัยบน GCE

ฉันทำตามคำสั่งบน https://stackoverflow.com/questions/32072668/openssl-sign-https-client-certificate-with-ca และเรียกใช้ได้สำเร็จ ตามลำดับดังต่อไปนี้:

// Generate CA key and cert:
openssl genrsa -out msite.CA.key 2048
openssl req -x509 -new -key msite.CA.key -days 3650 -out msite.CA.pem -subj '/C=AA/ST=aa/L=aaa/O=msite/OU=msite/CN=aa/emailAddress=sth'

// Generate client key and csr:
openssl genrsa -out mySite.com.key 2048
openssl req -new -key mySite.com.key -out mySite.com.csr -subj '/C=BB/ST=bb/L=bb/O=msite/OU=msite/CN=bb/emailAddress=bbb'

// Generate client cert signed with CA cert:
openssl x509 -req -days 365 -CA msite.CA.pem -CAkey msite.CA.key -CAcreateserial -CAserial serial -in mySite.com.csr -out mySite.com.pem

// verify:
openssl verify -verbose -CAfile msite.CA.pem mySite.com.pem
// the output to this is “mySite.com.pem: OK”

จนถึงตอนนี้ทุกอย่างดูโอเค – คำสั่งข้างต้นทั้งหมดทำงานโดยไม่มีข้อผิดพลาดใดๆ ณ จุดนี้ ฉันรันสิ่งต่อไปนี้ (คำสั่งจาก https://cloud.google.com/load-balancing/docs/ssl-certificates)

gcloud compute ssl-certificates create mysertificatee \
--certificate mySite.com.csr \
--private-key mySite.com.key

และได้รับข้อผิดพลาด:

ERROR: (gcloud.compute.ssl-certificates.create) Some requests did not succeed: 
- The SSL certificate could not be parsed. 

สาเหตุของข้อผิดพลาดคืออะไร? จะแก้ไขได้อย่างไร?


person xavierz    schedule 21.10.2018    source แหล่งที่มา
comment
--certificate mySite.com.csr - นั่นคือ CSR ไม่ใช่ใบรับรอง ควรจะเป็น --certificate mySite.com.pem ไม่ใช่เหรอ?   -  person Steffen Ullrich    schedule 21.10.2018
comment
@SteffenUllrich ใช้งานได้ :) เขียนสิ่งนี้เป็นคำตอบ - ฉันจะยอมรับมัน   -  person xavierz    schedule 21.10.2018


คำตอบ (1)


gcloud compute ssl-certificates create mysertificatee \
--certificate mySite.com.csr \
--private-key mySite.com.key

อาร์กิวเมนต์สำหรับ --certificate ควรเป็นใบรับรอง เช่น mySite.com.pem มอบ CSR mySite.com.csr แทน

person Steffen Ullrich    schedule 21.10.2018