[精讚] [會員登入]
73

使用expect及 openssl 產生SSL 憑證簽署要求

每年都要製做tls 憑證 二十幾張, 此語法利用expect 產生私錀及憑證請求檔 #!/usr/bin/expect

分享此文連結 //n.sfs.tw/16403

分享連結 使用expect及 openssl 產生SSL 憑證簽署要求@igogo
(文章歡迎轉載,務必尊重版權註明連結來源)
最後編修
2024-04-23 15:28:10 By igogo
 

 

每年都要製做tls 憑證 二十幾張, 

此語法利用expect

產生私錀及憑證請求檔

 



#!/usr/bin/expect


#syntax go.expect 13.key 13csr.txt

set key [lindex $argv 0];
set csr [lindex $argv 1];

set passwd PASSWORD

set timeout -1

spawn openssl genrsa -des3 -out "${key}" 2048

expect "Enter PEM pass phrase:"
send "$passwd\r"

expect "Verifying - Enter PEM pass phrase:"
send "$passwd\r"

interact
set timeout 1000

spawn openssl req -new -key "${key}" -out "${csr}"  

expect "Enter pass phrase for ${key}:"
send "$passwd\r"

#expect "Country Name (2 letter code) [AU]:"
expect "Country Name *:"
send "TW\r"

#expect "State or Province Name (full name) [Some-State]:"
expect "State or Province Name *:"
send "\r"

expect "Locality Name *:"
send "臺中市\r"

expect "Organization Name *:"
send "市政府\r"

expect "Organizational Unit Name *:"
send "教育局\r"

expect "Common Name *:"
send "web.tc.edu.tw\r"

expect "Email Address *:"
send "igogo@tc.edu.tw\r"

expect "A challenge password *:"
send "\r"

expect "An optional company name *:"
send "\r"

interact

 

END

你可能感興趣的文章

proxmox zfs 建立異地備份與還原 zfs最吸引人的地方就是可以建立快照並傳輸到遠端机器, 達到增量備份, 並且隨時從任一備份檔還原 完全不怕勒索病毒 將v

vim 特定範圍行數開頭加上# 註解 vim 特定範圍行數開頭加上# 註解

網站無障礙規範 https://accessibility.ncc.gov.tw/News/Detail/3238?Category=4

臺中市雲端校務系統與Windows AD帳號整合(4) 雲端校務系統與Windows AD的架構

臺中市校務雲端系統與Windows AD帳號整合(1) active directory,ldaps,雲端校務系統

使用expect及 openssl 產生SSL 憑證簽署要求 每年都要製做tls 憑證 二十幾張, 此語法利用expect 產生私錀及憑證請求檔 #!/usr/bin/expect

我有話要說

>>

限制:留言最高字數1000字。 限制:未登入訪客,每則留言間隔需超過10分鐘,每日最多5則留言。

訪客留言

[無留言]

隨機好文

[vue.js] input event Form-Input-Components-using-Custom-Events

[scratch2] 巢狀迴圈 有兩清單 一數字 一英文 想排出所以可能, 例如1a,1b,1c,2a,2b,2c...3c 利用巢狀迴圈 內圈累加的變

tc web 問與答 Q. 填報網址 A. https://tiny.cc/tc-web Q. 出現了以下畫面, 怎麼辦 A. 建議瀏覽器開無

[web]空氣品質嵌入頁面語法 空氣品質, aqi, ajax

網站無障礙規範 https://accessibility.ncc.gov.tw/News/Detail/3238?Category=4