首先系統要已經安裝了openssl,以下是使用openssl安裝配置單向認證的執行步驟與腳本:
代碼如下:
#--------------------------------------------------------
# 單向認證,就是傳輸的數據加密過了,但是不會校驗客戶端的來源
# 單項SSL連接,也就是只是客戶端驗證服務器證書
#--------------------------------------------------------
#創建存儲路徑
rm -rf /usr/local/nginx/ca.1way
mkdir -p /usr/local/nginx/ca.1way/
cd /usr/local/nginx/ca.1way/
#建立服務器私鑰(過程需要輸入密碼,請記住這個密碼) 生成RSA密鑰
/usr/local/openssl/bin/openssl genrsa -des3 -out server.key 2048
#------------------------------------------------------------------
Enter pass phrase for server.key: zhoulf123
Verifying - Enter pass phrase for server.key: zhoulf123
#------------------------------------------------------------------
#生成一個證書請求
/usr/local/openssl/bin/openssl req -new -key server.key -out server.csr
#---------------------------------------------------------------------------------------------------------------
Enter pass phrase for server.key: zhoulf123
Country Name (2 letter code) [XX]: CN #國家
State or Province Name (full name) []: BEIJING #區域或是省份
Locality Name (eg, city) [Default City]: BEIJING #地區局部名字
Organization Name (eg, company) [Default Company Ltd]: Navinfo Co.,Ltd #機構名稱:填寫公司名
Organizational Unit Name (eg, section) []: GIS #組織單位名稱:部門名稱
Common Name (eg, your name or your server's hostname) []: vw.test.zhoulf.com #網站域名
Email Address []: xxxxxx@163.com #郵箱地址
A challenge password []: #輸入一個密碼
新聞熱點
疑難解答