mocou 回復于:2005-08-25 10:53:16 |
(while preserving the original file):
$ cp server.key server.key.org $ openssl rsa -in server.key.org -out server.key 確認server.key 文件為root可讀 $ chmod 400 server.key |
platinum 回復于:2005-08-25 10:57:28 |
已解決,謝謝 mocou :em18:
[quote:1fe90b3ae9] 讓apache在啟動時不需輸入 RSA私鑰 (while preserving the original file): $ cp server.key server.key.org $ openssl rsa -in server.key.org -out server.key 確認server.key 文件為root可讀 $ chmod 400 server.key [/quote:1fe90b3ae9] |
abel 回復于:2005-08-25 11:30:45 |
補充一下,若原來沒密碼好像就不用,
若有密碼,但要自動輸入則在 SSLPassPhraseDialog 項上面設定, exec 的輸出結果即是 passwd http://httpd.apache.org/docs/2.0/mod/mod_ssl.html#sslpassphrasedialog |
platinum 回復于:2005-08-26 00:29:04 |
[quote:c954f82f90="abel"]補充一下,若原來沒密碼好像就不用,
若有密碼,但要自動輸入則在 SSLPassPhraseDialog 項上面設定, exec 的輸出結果即是 passwd http://httpd.apache.org/docs/2.0/mod/mod_ssl.html#sslpassphrasedialog[/quote:c954f82f90] 請問 abel 兄,“若原來沒密碼”怎么理解呢? 我創建 CA 的時候,必須讓我輸入 4 位以上的密碼啊 :em14: 另外,像這種方式(沒有證書的)的 https,除了在網絡中不是以明文傳輸以外,并不能保證數據的安全吧? 我是這樣理解的,別人截取以后一樣可以還原,不知道說的對嗎? |
ioly 回復于:2005-08-26 09:31:01 |
學習!· |
haoyufu 回復于:2005-08-26 10:25:43 |
為你的Apache服務器創建一個RSA私用密鑰(被Triple-DES加密并且進行PEM格式化):
# openssl genrsa -des3 -out server.key 1024 請在安全的地方備份這個server.key文件。記住你輸入的通行短語(pass phrase)!你可以通過下面的命令看到這個RSA私用密鑰的細節。 # openssl rsa -noout -text -in server.key 而且你可以為這個RSA私用密鑰創建一個加密的PEM版本(不推薦),通過下列命令: # openssl rsa -in server.key -out server.key.unsecure 用服務器RSA私用密鑰生成一個證書簽署請求(CSR-Certificate Signing Request)(輸出將是PEM格式的): # openssl req -new -key server.key -out server.csr 當OpenSSL提示你“CommonName”時,確保你輸入了服務器的FQDN("Fully Qualified Domain Name") ,即,當你為一個以后用https://www.foo.dom/訪問的網站生成一個CSR時,這里輸入"www.foo.dom"。你可借助下列命令查看該CSR的細節: # openssl req -noout -text -in server.csr 將CSR發到一個CA 現在你必須發送該CSR到一個CA以便簽署,然后的結果才是可以用于Apache的一個真正的證書。 有兩種選擇: 第一種,你可以通過一個商業性CA如Verisign 或 Thawte簽署證書。那么你通常要將CSR貼入一個web表格,支付簽署費用并等待簽署的證書,然后你可以把它存在一個server.crt文件中。關于商業性CA的更多信息,請參見下列鏈接: Verisign - http://digitalid.verisign.com/server/apacheNotice.htm Thawte Consulting - http://www.thawte.com/certs/server/request.html CertiSign Certificadora Digital Ltda. - http://www.certisign.com.br IKS GmbH - http://www.iks-jena.de/produkte/ca / Uptime Commerce Ltd. - http://www.uptimecommerce.com BelSign NV/SA - http://www.belsign.be 你自己的CA 第二種,你可以利用自己的CA并由該CA簽署CSR。你可以創建自己的認證中心來簽署證書。最簡單的方法是利用OpenSSL提供的CA.sh或 CA.pl腳本。比較復雜而且是手工的方法是: 為你的CA創建一個RSA私用密鑰( 被Triple-DES加密并且進行PEM格式化的): # openssl genrsa -des3 -out ca.key 1024 請在安全的地方備份這個ca.key文件。記住你輸入的通行短語(pass phrase)!你可以通過下面的命令看到這個RSA私用密鑰的細節。 # openssl rsa -noout -text -in ca.key 而且你可以為這個RSA私用密鑰創建一個加密的PEM版本(不推薦),通過下列命令: # openssl rsa -in ca.key -out ca.key.unsecure 利用CA的RSA密鑰創建一個自簽署的CA證書(X509結構)(輸出將是PEN格式的): # openssl req -new -x509 -days 365 -key ca.key -out ca.crt 你可以通過下列命令查看該證書的細節: # openssl x509 -noout -text -in ca.crt 準備一個簽署所需的腳本,因為"openssl ca"命令有一些奇怪的要求而且缺省的OpenSSL配置不允許簡單地直接使用"openssl ca"命令,所以一個名為sign.sh的腳本隨mod_ssl分發一道發布(子目錄pkg.contrib/)。 使用該腳本進行簽署。 現在你可以使這個CA簽署服務器的CSR,以便創建用于Apache服務器內部的真正的SSL證書(假定你手頭已經有一個server.csr): # ./sign.sh server.csr 它簽署服務器的CSR并且結果在一個server.crt文件中。 現在你有兩個文件:server.ket和server.crt。在你的Apache的httpd.conf文件中,如下使用它們: SSLCertificateFile /path/to/this/server.crt SSLCertificateKeyFile /path/to/this/server.key server.csr不再需要了。 |
haoyufu 回復于:2005-08-26 10:27:17 |
原來沒密碼好像就不用,
若有密碼,但要自動輸入(其實說的就是上面的CA) |
platinum 回復于:2005-08-26 10:40:30 |
謝謝你,這個做法我知道
但我想知道,像這種方式(沒有證書的)的 https,除了在網絡中不是以明文傳輸以外,并不能保證數據的安全吧? 我是這樣理解的,別人截取以后一樣可以還原,不知道說的對嗎? |
ccn 回復于:2005-08-26 11:19:06 |
你能破解DES算法就能還原了 |
haoyufu 回復于:2005-08-26 12:03:51 |
platinum brother
說的對 |
platinum 回復于:2005-08-26 12:32:46 |
[quote:93775f46a3="ccn"]你能破解DES算法就能還原了[/quote:93775f46a3]
能否再詳細解釋一下? 我對密鑰認證這里不了解,我不知道不用證書的方式來訪問還會不會安全 |
platinum 回復于:2005-08-26 12:33:17 |
[quote:0bc34d6ab2="haoyufu"]platinum brother
說的對[/quote:0bc34d6ab2] 前面兄臺的意思是我說的不對,我也不知道該如何理解 |
platinum 回復于:2005-08-28 09:21:08 |
老喬進來看看 :mrgreen: |
mocou 回復于:2005-08-28 12:04:10 |
[quote:31d34c681a="platinum"]謝謝你,這個做法我知道
但我想知道,像這種方式(沒有證書的)的 https,除了在網絡中不是以明文傳輸以外,并不能保證數據的安全吧? 我是這樣理解的,別人截取以后一樣可以還原,不知道說的對嗎?[/quote:31d34c681a] 你可以看看RSA的原理,還有關于公鑰私鑰的,多理解,我想答案應該在那里 |
HonestQiao 回復于:2005-08-28 14:59:05 |
[quote:6fd2587190="platinum"]老喬進來看看 :mrgreen:[/quote:6fd2587190]
http://w.yi.org/ftp/FAPM/apache/Apache2/zh/ssl/ssl_faq.html [quote:6fd2587190] How can I get rid of the pass-phrase dialog at Apache startup time? The reason why this dialog pops up at startup and every re-start is that the RSA private key inside your server.key file is stored in encrypted format for security reasons. The pass-phrase is needed to be able to read and parse this file. When you can be sure that your server is secure enough you perform two steps: Remove the encryption from the RSA private key (while preserving the original file): $ cp server.key server.key.org $ openssl rsa -in server.key.org -out server.key Make sure the server.key file is now only readable by root: $ chmod 400 server.key Now server.key will contain an unencrypted copy of the key. If you point your server at this file it will not prompt you for a pass-phrase. HOWEVER, if anyone gets this key they will be able to impersonate you on the .net. PLEASE make sure that the permissions on that file are really such that only root or the web server user can read it (preferably get your web server to start as root but run as another server, and have the key readable only by root). As an alternative approach you can use the ``SSLPassPhraseDialog exec:/path/to/program'' facility. But keep in mind that this is neither more nor less secure, of course. [/quote:6fd2587190] |