|
http://www.iyunv.com/fuyingke/archive/2005/03/17/clear.gif
ActionFire http://my.so-net.net.tw/pra_xware/i/more.gif
ID : 32390
新人
http://my.so-net.net.tw/pra_xware/i/user_offline.gif
註冊日期: 2002-07-27
文章: 44
|
【懶人教學】建構您的 Apache + SSL on Win32
在 Apache + SSL 在 Win32 的部分, 說真的實在不好找
你們可以參考一下 The Apache + SSL on Win32 HOWTO 的做法
當然照著上邊做也沒關係, 每個人有每個人的做法看個人吧試試看就知道了
雖然我是自己 Compile 來裝的, 但我打字比較懶了點, Compile 教學的部分
請自行參考 OpenSSL 跟 mod_ssl 的內附文件 For Win32
基本上只要架好 Apache + SSL 其他如 ActivePerl, MySQL ,PHP 都可以慢慢加進來
在 Hunter 這裡可以找到已經編譯好的,視個人需要自行取用, 記得寄封Email謝謝人家喔!!
以下列出最快的安裝方式供參考, 原理....自己看各套件的內文說明
安裝所需檔案
Apache_2.0.49-Openssl_0.9.7d-Win32.zip
openssl.cnf (在那個 here 連結)
01. 建議最好先裝 Apache 2.0.49 再來解壓縮 Apache_2.0.49-Openssl_0.9.7d-Win32.zip,
記得解壓縮後修改路徑直接覆蓋原來安裝的檔案上
02. 基本上您已經完成 Apache + mod_ssl + OpenSSL 的安裝了
接下來得先開始設定您的 httpd.conf
找到 Listen 80 (不能註解掉喔, 至少知道你的網站是活的)
找到 LoadModule ssl_module modules/mod_ssl.so (不能註解掉喔, 要開 SSL 要靠這支 Modules 了)
03. 這裡預設您除了正常網站外同一個 IP 或 DomainName 上同時有 SSL 所以,
您除了設定您一般的網站路徑外 VirtualHost 也要一併設定
04. 以 Name-Based 為例, 其他請依實際安裝為準
記得這裡的設定一定要跟上邊的一樣, 不然你的主網頁會找不到喔
NameVirtualHost *:80
ServerAdmin 您的email
DocumentRoot "/您網頁的實際路徑"
ServerName DomainName:80
ErrorLog logs/DomainName_error_log
CustomLog logs/DomainName_access_log common
05. 再這邊您可以稍微注意一下上邊有 Include conf/ssl.conf 沒錯!!
接下來就是設定 SSL 要開的網頁設定, 暫時先不教產生憑證 Key 的方法
既然再同一個目錄先做設定的部分
找到 SSLMutex file:logs/ssl_mutex 並註解掉, Win32 上不支援此方式,
所以您可以改用 SSLMutex none 或是 SSLMutex default
接下來仍是 VirtualHost 的設定
找到 改用
DocumentRoot "/您網頁的實際路徑"
ServerAdmin 您的email
ServerName DomainName:443
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
找到 #SSLCertificateChainFile conf/ssl.crt/ca.crt 把註解拿掉(要自己發給自己的話)
找到 #SSLCACertificatePath conf/ssl.crt 把註解拿掉(要自己發給自己的話)
增加 SSLCACertificateFile conf/ssl.crt/ca.crt
06. 到此已完成設定的基本工作了, 這裡我稍微保留一下, 您可以暫時不用理會
找到 跟 我是註解掉的(懶得改啟動設定), 如果您在
啟動 Apache 時, 仍無法讓您的 SSL 動作的話才跟著做這項
07. 接下來要開始製作認證的憑證準備階段
請切換至 Apache 的 bin 目錄下, 把您下載的 openssl.cnf 置於此
並修改一下 [ CA_default ] 內的內容如下(既然是懶人法請跟著做喔!!其他倒是無關緊要)
dir = ssl
certs = $dir\\certs
crl_dir = $dir\\crl
database = $dir\\index.txt
new_certs_dir = $dir
certificate = $dir\\cacert.pem
serial = $dir\\serial
crl = $dir\\crl.pem
private_key = $dir\\privkey.pem
RANDFILE = $dir\\privkey.rnd
08. 依上述於 bin 目錄下新增一個 ssl 目錄
在 ssl 目錄內新增 index.txt 檔, 內容空白就好
在 ssl 目錄內新增 serial 檔, 內容請填 01 就好
09. 切換回 Apache 的 bin 目錄下吧!!
這裡我們要用命令提示字元 或 Win-DOS 視窗來設定, 所以為方便起見, 請設為 Apache 的 bin 目錄下
當然您要寫成 *.BAT 省在視窗下打那些重複執行的指令也行, 假設我們自己要發給自己 CA 認證
當然 CAroot 一定是自己並加簽給自己
10. 產生 CA Private Key -- 執行 openSSL genrsa -des3 -out ssl/ca.key 1024
1024 為使用 128-bit 加密, 並輸入您的安全密碼
11. 產生 CA Require 憑證需求 執行 openssl req -config openssl.cnf -new -key ssl/ca.key -out ssl/ca.csr
輸入您的申請書資料, 這裡的可以用 "." 來當無資料輸入使用, Domain 或 Websit 在這並無特殊指定輸入, 請依顯示輸入既可
12. 產生 CA Public Crt 憑證 -- 執行 openssl x509 -days 3650 -req -signkey ssl/ca.key -in ssl/ca.csr -out ssl/ca.crt
預設是 30 天過期, 3650 是約 10 年
13. 接下來, 我們要為自己的 Server 或是個人加簽憑證, 這裡以 Server 為例
產生 Server Private Key -- 執行 openSSL genrsa -out ssl/server.key 1024
這裡預設 Server Private Key 不設定安全密碼以免無人值守時電腦關機重開無法啟動 Apache (因為要密碼才能啟動)
這我倒沒在 Win32 試過, Unix-Like 鐵定會要求密碼
14. 產生 Server Require 憑證需求 -- 執行 openssl req -config openssl.cnf -new -key ssl/server.key -out ssl/server.csr
輸入您的申請書資料, 跟上邊的一樣, 不過這裡的 Domain 或 Websit 在這最好填入您的 DomainName 或 主機全名(Host.DomainName)
15. 產生 Server Public Crt 憑證 -- 執行 openssl ca -config openssl.cnf -days 3650 -cert ssl/ca.crt -keyfile ssl/ca.key -in ssl/server.csr -out ssl/server.crt
輸入您的 CA Private Key 安全密碼完成製作手續
16. 現在您的 ssl 目錄下已經有了必要的檔案, 接下來開始複製到所需的路徑下
請在 Apache 下之 conf 目錄下建 ssl.crt 與 ssl.key 這 2 個目錄
將 ca.crt 與 server.crt 複製至 conf/ssl.crt 下
將 server.key 複製至 conf/ssl.key 下
17. OK!!萬事具備了, 啟動您的 Apache 吧!! 不放心的話用 apache -t 看一下語法有無錯誤
啟動後先用一般網頁(http://DomainName 或 http://Host.DomainName)開看看應該沒問題
18. 再來試試 Port 443 (http://DomainName:443 或 http://Host.DomainName:443) 應該會告訴你是一個錯誤的請求如下
Bad request! Your browser (or proxy) sent a request that this server could not understand.
If you think this is a server error, please contact the webmaster.
Error 400
這時您可以直接使用 https://DomainName 或 https://Host.DomainName 來進入 SSL 的網頁了(後面呢...自己認證吧!!)
19. 注意喔!!右下角的金鑰喔!!
因為您的電腦尚未取得 Server 的認證, 所以檢驗憑證時, 記得要安裝 Server 憑證(server.crt)喔!!
又因為 Server 的認證未經授權單位認可, 所以檢驗憑證時, 記得要安裝 CA 憑證(ca.crt)喔!!
您可以將 ca.crt 與 server.crt 公開給人下載安裝以取得擁有屬於您自己的實驗性網站的認證
20. 認證實際運作可按此參考看看
手打的好痠......噗!!
這篇於 05-30-2004 07:39 AM 被 ActionFire 編輯. |
http://my.so-net.net.tw/pra_xware/i/post_old.gif 05-30-2004 07:30 AM |
http://my.so-net.net.tw/pra_xware/i/quote.gif No.1 |
ActionFire | 查看公開訊息 | 發悄悄話給 ActionFire | 訪問 ActionFire 的個人網站 | 搜尋 ActionFire 發表的更多文章 | 增加 ActionFire 到好友列表 | http://www.iyunv.com/fuyingke/archive/2005/03/17/clear.gif http://www.iyunv.com/fuyingke/archive/2005/03/17/clear.gif
pat6626 | 查看公開訊息 | 發悄悄話給 pat6626 | 發送郵件給 pat6626 | 搜尋 pat6626 發表的更多文章 | 增加 pat6626 到好友列表 | http://www.iyunv.com/fuyingke/archive/2005/03/17/clear.gif http://www.iyunv.com/fuyingke/archive/2005/03/17/clear.gif
ActionFire http://my.so-net.net.tw/pra_xware/i/more.gif
ID : 32390
新人
http://my.so-net.net.tw/pra_xware/i/user_offline.gif
註冊日期: 2002-07-27
文章: 44
|
引用:最初由 pat6626 發表
這位大哥你好
我依照你的教學
首先
1.將APACHE 1.3.28 升級到1.3.31
再將從網路下載的
Apache_1.3.31-Mod_SSL_2.8.18-Openssl_0.9.7d-Win32內容
複製到apache中
2.進入httpd.conf中
請問Listen 80 (我有找到一個3000,是將3000改為80嗎?)
另外 在您文章中的05中
請問在哪有include con/ssl.conf
也沒找到SSLMutex file:logs/ssl_mutex
???
所以執行到這 就不知該如何進行下去
可否請大哥撥空指點一下 謝謝 |
1. 覆蓋原來的 APACHE 之前最好備份您的設定檔
比對並修改回原來設定於新設定檔上
List 預設值就算不填的話也會只監聽 80 ,如果用 Port Map 架 VirtualHost 的話這是必填的
2.關於 Hunter 裡的 Apache_1.3.31-Mod_SSL_2.8.18-Openssl_0.9.7d-Win32
我下載回來看了一下, 它僅是把 mod_ssl 加進來而已需手動新增設定 ssl.conf 及修改 httpd.conf
要製作認證憑證還得下載 Openssl-0.9.7d-Win32.zip
因為 Apache_1.3.X 或早期版本並未包含判斷外加模組(Apache 自訂以外)所以需自行手動加入 SSL 判斷的指令
建議您換 Apache 2.0.49 來用比較快(都言明懶人教學了), 不死心的話就只好手動增加檔案改指令, 或等改天我或者有人有空裝好 Apache 1.3.31 再來PO |
http://my.so-net.net.tw/pra_xware/i/post_old.gif 06-02-2004 02:17 AM |
http://my.so-net.net.tw/pra_xware/i/quote.gif No.3 |
ActionFire | 查看公開訊息 | 發悄悄話給 ActionFire | 訪問 ActionFire 的個人網站 | 搜尋 ActionFire 發表的更多文章 | 增加 ActionFire 到好友列表 | http://www.iyunv.com/fuyingke/archive/2005/03/17/clear.gif http://www.iyunv.com/fuyingke/archive/2005/03/17/clear.gif
pat6626 | 查看公開訊息 | 發悄悄話給 pat6626 | 發送郵件給 pat6626 | 搜尋 pat6626 發表的更多文章 | 增加 pat6626 到好友列表 | http://www.iyunv.com/fuyingke/archive/2005/03/17/clear.gif http://www.iyunv.com/fuyingke/archive/2005/03/17/clear.gif
ActionFire | 查看公開訊息 | 發悄悄話給 ActionFire | 訪問 ActionFire 的個人網站 | 搜尋 ActionFire 發表的更多文章 | 增加 ActionFire 到好友列表 | http://www.iyunv.com/fuyingke/archive/2005/03/17/clear.gif http://www.iyunv.com/fuyingke/archive/2005/03/17/clear.gif
pat6626 | 查看公開訊息 | 發悄悄話給 pat6626 | 發送郵件給 pat6626 | 搜尋 pat6626 發表的更多文章 | 增加 pat6626 到好友列表 | http://www.iyunv.com/fuyingke/archive/2005/03/17/clear.gif http://www.iyunv.com/fuyingke/archive/2005/03/17/clear.gif
ActionFire http://my.so-net.net.tw/pra_xware/i/more.gif
ID : 32390
新人
http://my.so-net.net.tw/pra_xware/i/user_offline.gif
註冊日期: 2002-07-27
文章: 44
|
嗯!!真的沒檔可 Link 了, 以下提供 openssl.cnf 內容(已修改僅適合本教學)
請自行新增一般文字檔 openssl.cnf 檔案
---------開始----------
#
# SSLeay example configuration file.
# This is mostly being used for generation of certificate requests.
#
RANDFILE = .rnd
####################################################################
[ ca ]
default_ca = CA_default # The default ca section
####################################################################
[ CA_default ]
dir = ssl # Where everything is kept
certs = $dir\\certs # Where the issued certs are kept
crl_dir = $dir\\crl # Where the issued crl are kept
database = $dir\\index.txt # database index file.
new_certs_dir = $dir # default place for new certs.
certificate = $dir\\cacert.pem # The CA certificate
serial = $dir\\serial # The current serial number
crl = $dir\\crl.pem # The current CRL
private_key = $dir\\privkey.pem # The private key
RANDFILE = $dir\\privkey.rnd
#x509_extensions= x509v3_extensions # The extentions to add to the cert
default_days = 365 # how long to certify for
default_crl_days= 30 # how long before next CRL
default_md = md5 # which md to use.
preserve = no # keep passed DN ordering
# A few difference way of specifying how similar the request should look
# For type CA, the listed attributes must be the same, and the optional
# and supplied fields are just that :-)
policy = policy_match
# For the CA policy
[ policy_match ]
countryName = optional
stateOrProvinceName = optional
organizationName = optional
organizationalUnitName = optional
commonName = supplied
emailAddress = optional
# For the 'anything' policy
# At this point in time, you must list all acceptable 'object'
# types.
[ policy_anything ]
countryName = optional
stateOrProvinceName = optional
localityName = optional
organizationName = optional
organizationalUnitName = optional
commonName = supplied
emailAddress = optional
####################################################################
[ req ]
default_bits = 1024
default_keyfile = privkey.pem
distinguished_name = req_distinguished_name
attributes = req_attributes
[ req_distinguished_name ]
countryName = Country Name (2 letter code)
countryName_default = TW
countryName_min = 2
countryName_max = 2
stateOrProvinceName = State or Province Name (full name)
localityName = Locality Name (eg, city)
0.organizationName = Organization Name (eg, company)
organizationalUnitName = Organizational Unit Name (eg, section)
commonName = Common Name (eg, your website's domain name)
commonName_max = 64
emailAddress = Email Address
emailAddress_max = 40
[ req_attributes ]
challengePassword = A challenge password
challengePassword_min = 4
challengePassword_max = 20
[ x509v3_extensions ]
# under ASN.1, the 0 bit would be encoded as 80
nsCertType = 0x40
#nsBaseUrl
#nsRevocationUrl
#nsRenewalUrl
#nsCaPolicyUrl
#nsSslServerName
#nsCertSequence
#nsCertExt
#nsDataType
---------結束---------- |
http://my.so-net.net.tw/pra_xware/i/post_old.gif 06-03-2004 09:59 PM |
http://my.so-net.net.tw/pra_xware/i/quote.gif No.7 |
ActionFire | 查看公開訊息 | 發悄悄話給 ActionFire | 訪問 ActionFire 的個人網站 | 搜尋 ActionFire 發表的更多文章 | 增加 ActionFire 到好友列表 | http://www.iyunv.com/fuyingke/archive/2005/03/17/clear.gif http://www.iyunv.com/fuyingke/archive/2005/03/17/clear.gif
virbe | 查看公開訊息 | 發悄悄話給 virbe | 搜尋 virbe 發表的更多文章 | 增加 virbe 到好友列表 | http://www.iyunv.com/fuyingke/archive/2005/03/17/clear.gif http://www.iyunv.com/fuyingke/archive/2005/03/17/clear.gif
toryliu http://my.so-net.net.tw/pra_xware/i/more.gif
ID : 41634
新人
http://my.so-net.net.tw/pra_xware/i/user_offline.gif
註冊日期: 2004-12-07
文章: 1
|
想請問ActionFire大大
我在進行到第15點的時候
就會出現以下的錯誤
Error Loading extension section x509v3_extensions
3760:error:02001002:system library:fopen:No such file or directory:.\crypto\bio\
bss_file.c:104:fopen('ssl\index.txt.attr','rb')
3760:error:2006D080:BIO routines:BIO_new_file:no such file:.\crypto\bio\bss_file
.c:107:
3760:error:0E064072:configuration file routines:CONF_load:no such file:.\crypto\
conf\conf_def.c:197:
3760:error:0E06D06C:configuration file routines:NCONF_get_string:no value:.\cryp
to\conf\conf_lib.c:329:group=CA_default name=email_in_dn
3760:error:2206506F:X509 V3 routines:V2I_ASN1_BIT_STRING:unknown bit string argu
ment:.\crypto\x509v3\v3_bitst.c:133:section:,name:0x40,value:
3760:error:2206B080:X509 V3 routines:X509V3_EXT_conf:error in extension:.\crypto
\x509v3\v3_conf.c:92:name=nsCertType, value=0x40
而我製造出來的sever.crt
裡面是空的
沒有任何的東西
而在網頁顯示的時候
http是正常的
當改成有點443及https的時候
就會顯示說無法顯示網頁
想請問要怎麼解決 |
http://my.so-net.net.tw/pra_xware/i/post_old.gif 12-09-2004 01:54 AM |
http://my.so-net.net.tw/pra_xware/i/quote.gif No.9 |
toryliu | 查看公開訊息 | 發悄悄話給 toryliu | 搜尋 toryliu 發表的更多文章 | 增加 toryliu 到好友列表 | http://www.iyunv.com/fuyingke/archive/2005/03/17/clear.gif http://www.iyunv.com/fuyingke/archive/2005/03/17/clear.gif
ActionFire http://my.so-net.net.tw/pra_xware/i/more.gif
ID : 32390
新人
http://my.so-net.net.tw/pra_xware/i/user_offline.gif
註冊日期: 2002-07-27
文章: 44
|
引用:
作者: toryliu想請問ActionFire大大
我在進行到第15點的時候
就會出現以下的錯誤
Error Loading extension section x509v3_extensions
3760:error:02001002:system library:fopen:No such file or directory:.\crypto\bio\
bss_file.c:104:fopen('ssl\index.txt.attr','rb')
3760:error:2006D080:BIO routines:BIO_new_file:no such file:.\crypto\bio\bss_file
.c:107:
3760:error:0E064072:configuration file routines:CONF_load:no such file:.\crypto\
conf\conf_def.c:197:
3760:error:0E06D06C:configuration file routines:NCONF_get_string:no value:.\cryp
to\conf\conf_lib.c:329:group=CA_default name=email_in_dn
3760:error:2206506F:X509 V3 routines:V2I_ASN1_BIT_STRING:unknown bit string argu
ment:.\crypto\x509v3\v3_bitst.c:133:section:,name:0x40,value:
3760:error:2206B080:X509 V3 routines:X509V3_EXT_conf:error in extension:.\crypto
\x509v3\v3_conf.c:92:name=nsCertType, value=0x40
而我製造出來的sever.crt
裡面是空的
沒有任何的東西
而在網頁顯示的時候
http是正常的
當改成有點443及https的時候
就會顯示說無法顯示網頁
想請問要怎麼解決 |
檢查一下你的openssl.cnf
#x509_extensions= x509v3_extensions
這行要註解 |
http://my.so-net.net.tw/pra_xware/i/post_old.gif 12-25-2004 07:33 PM |
http://my.so-net.net.tw/pra_xware/i/quote.gif No.10 |
|
|