• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • Apache 2.0上 HTTPS 實現CA認證, 不是HTPASSWD的那種.

    發表于:2007-05-25來源:作者:點擊數: 標簽:
    每次總來CU找資料,想想也應該做點貢獻.呵呵.這篇文章似乎沒人做過.我就把它補上吧.轉載時注明來源是CU's小黃就可以了.:D 系統 LINUX 8 用rpm-aq查一下是否這些裝上 openssl095a-0.9.5a-16 openssl-devel-0.9.6b-29 mod_ssl-2.0.40-8 openssl-0.9.6b-29 opens

    每次總來CU找資料,想想也應該做點貢獻. 呵呵. 這篇文章似乎沒人做過.我就把它補上吧. 轉載時注明來源是CU's 小黃就可以了. :D 


    系統 LINUX 8
    用rpm -aq查一下是否這些裝上

    openssl095a-0.9.5a-16
    openssl-devel-0.9.6b-29
    mod_ssl-2.0.40-8
    openssl-0.9.6b-29
    openssl096-0.9.6-11

    當然還有apache 2.0
    openssl095a-0.9.5a-16
    openssl-devel-0.9.6b-29
    mod_ssl-2.0.40-8
    openssl-0.9.6b-29
    openssl096-0.9.6-11


    第一步實現傳統的http, 如果不知道,在精華貼里找.

    第二步要實現https, 精華貼里也有,不過我重復一些這里:
    主要是這個文件
    /etc/httpd/conf.d/ssl.conf:

    SSLCertficateFile  /path/to/this/server.crt
    SSLCertificateKeyFile /path/to/this/server.key
    這兩行要打開.

    怎么產生server.crt 和 server.key, 用法如下:

    cd /etc/httpd/conf/ssl.key
    openssl genrsa -des3 -out server.key 1024

    cd /etc/httpd/conf/ssl.crt
    openssl x509 -req -days 3650 -in server.csr -signkey ../ssl.key/server.key –out server.crt
    (這個是自己給自己認證,你也可以先產生這個server.csr, 然后去verisign 用它30天免費的server.crt

    到此,你的HTTPS應該可以起來.如果看見一些錯誤.error 98 mod_socket之類的. 多數是httpd.conf 文件中, 要有Include conf.d/*.conf
    Include conf.d/*.conf
    而同時使用port 443, 與 /etc/httpd/conf.d/ssl.conf文件中port 443重復使用了. 基本上httpd.conf不用改,而只改ssl.conf就可以了. (折騰了我好一會這里,:-( )

    現在你的https可以起來, 但人人可以去,我們最終的目的是只有你簽發的certificate的用戶才可以,所以接著走...

    第三步https的CA認證:
    ssl.conf 文件中要:
    SSLCACertificateFile /etc/httpd/conf/ssl.crt/myca.crt
    SSLVerifyClient require
    SSLVerifyDepth  1

    在 cd /etc/httpd/conf/ssl.crt/
    openssl genrsa -des3 -out myca.key 1024
    openssl req -new -x509 -days 3650 -key myca.key -out myca.crt
    現在我們有了這個myca.crt, 這個CERT相當與一個圖章,用這個圖章蓋過的請求才可以訪問你的HTTPS, 這才是目的.

    在你的機器上重新用普通用戶登陸,假設用戶名為client1, home為/home/client1.

    cd /home/client1
    openssl req –new > client.csr
    用戶產生了一個請求CSR文件. 用圖章蓋過印的CSR請求, 產生一個cert才有效,這就是這個目的.


    重新用ROOT登陸,

    cd /etc/httpd/conf/ssl.crt/
    這下面應該有你剛才產生的myca.key & myca.crt

    openssl x509 -req -in /home/client1/client.csr -out /home/client1/client.crt -signkey myca.key -CA myca.crt -CAkey myca.key -CAcreateserial -days 3650

    在這個/home/client1下面,應該產生了client.crt 這個文件. 也就是一個蓋過章的certificate.

    這個certificate是BASE64形式的,要轉成PKCS12才能裝到IE,/NETSCAPE上.所以你要:

    cd /etc/httpd/conf/ssl.crt/
    openssl pkcs12 -export –in /home/client.crt -inkey myca.key -out client.pfx

    到此為止,基本上大功告成. 把這個client.pfx 裝到你的IE下,證書下.用default 安裝,不用變革路經.

    重起HTTPS, 在用有certificate的IE去訪問. -------- 如果一切順利,是不是心情很爽?


    ----寫在后面的話.希望大家多寫些心得, 把CU辦的更好.

     yhuang95411 回復于:2004-12-19 10:53:02
    libghttp-devel-1.0.9-5
    httpd-devel-2.0.40-8
    httpd-manual-2.0.40-8
    httpd-2.0.40-8
    libghttp-1.0.9-5

     yhuang95411 回復于:2004-12-19 11:12:15
    澄清一下:

    所用系統為Red Hat Linux 8.0.  若使用其它Linux, rpm 版本會有些差別, 但步驟都是一樣的.

     FunBSD 回復于:2005-01-05 09:35:36
    我幫你頂一下

     wingger 回復于:2005-01-05 13:21:18
    Make sure OpenSSL is really installed and in your PATH. But some commands even work ok when you just run the ``openssl'' program from within the OpenSSL source tree as ``./apps/openssl''.


    Create a RSA private key for your Apache server (will be Triple-DES encrypted and PEM formatted):

    [code:1:ba56aab0e6]$ openssl genrsa -des3 -out server.key 1024[/code:1:ba56aab0e6]

    Please backup this server.key file and remember the pass-phrase you had to enter at a secure location. You can see the details of this RSA private key via the command:

    [code:1:ba56aab0e6]$ openssl rsa -noout -text -in server.key[/code:1:ba56aab0e6]

    And you could create a decrypted PEM version (not recommended) of this RSA private key via:

    [code:1:ba56aab0e6]$ openssl rsa -in server.key -out server.key.unsecure[/code:1:ba56aab0e6]


    Create a Certificate Signing Request (CSR) with the server RSA private key (output will be PEM formatted):

    [code:1:ba56aab0e6]$ openssl req -new -key server.key -out server.csr[/code:1:ba56aab0e6]

    Make sure you enter the FQDN ("Fully Qualified Domain Name") of the server when OpenSSL prompts you for the "CommonName", i.e. when you generate a CSR for a website which will be later aclearcase/" target="_blank" >ccessed via https://www.foo.dom/, enter "www.foo.dom" here. You can see the details of this CSR via the command

    [code:1:ba56aab0e6]$ openssl req -noout -text -in server.csr[/code:1:ba56aab0e6]

    其它一樣,在REDHAT linux 9下通過,呵呵,
    這些都是用系統默認的apache,openssl,mod_ssl裝的

     wingger 回復于:2005-01-05 13:25:33
    停止 httpd:[失敗]
    啟動 httpd:Apache/2.0.40 mod_ssl/2.0.40 (Pass Phrase Dialog)
    Some of your private key files are encrypted for security reasons.
    In order to read them you have to provide us with the pass phrases.

    Server new.host.name:443 (RSA)
    Enter pass phrase:

    Ok: Pass Phrase Dialog successful.
    [失敗]

    為什么會這樣?

     wingger 回復于:2005-01-05 13:38:19
    剛才沒修改ssl.conf文件,修改后啟動如下錯誤

    啟動 httpd:Apache/2.0.40 mod_ssl/2.0.40 (Pass Phrase Dialog)
    Some of your private key files are encrypted for security reasons.
    In order to read them you have to provide us with the pass phrases.

    Server new.host.name:443 (RSA)#錯誤的輸入密碼
    Enter pass phrase:
    Apache:mod_ssl:Error: Pass phrase incorrect (5 more retries permitted).

    Enter pass phrase:#密碼錯誤
    1077372096:error:0D094068:asn1 encoding routines:d2i_ASN1_SET:bad tag:a_set.c:179:
    1077372096:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:939:
    1077372096:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:304:Type=RSA
    1077372096:error:0D09A00D:asn1 encoding routines:d2i_PrivateKey:ASN1 lib:d2i_pr.c:96:
    Apache:mod_ssl:Error: Pass phrase incorrect (4 more retries permitted).

    Enter pass phrase:#正解的密碼
    [失敗]

     Yarco 回復于:2005-01-07 13:22:50
    這個我試過.就是有些問題不明白.

    1.CA證書如何制作.
    似乎單純用openssl無法制作自簽名的CA證書.我看了很多網上的資料,說是apache附帶有一個sign.sh的腳本.但我找來找去找不到.
    2.如何讓服務器重新啟動的時候,不輸入密碼Pass Phrase

    因為默認的https似乎不需要輸入密碼的.
    想來重啟apache應該有什么方法不需要輸入密碼才對...

     wingger 回復于:2005-01-07 13:28:04
    sign.sh是mod_ssl自帶的,但www.modssl.org上的mod_ssl只支持apache1的,我這里有一個sign.sh文件,如何你要的話,我可以貼出來,我用過sign.sh,不過簽不了證書,至少我沒簽成功過

     Yarco 回復于:2005-01-07 14:05:02
    暈...害我啊
    [quote:3414839e85]不過簽不了證書,至少我沒簽成功過[/quote:3414839e85]
    簽不了也給我.:)

     ghostwx 回復于:2005-01-07 14:06:18
    用openssl可以的
    openssl genrsa -des3 -rand file1:file2:file3 -out yourca.key
    file1-3 是隨意任何文件
    openssl req -new -key yourca.key -out yourca.csr
    產生證書請求
    openssl x509 -req -days 30 -in yourca.csr -signkey yourca.key -out yourca.cert
    產生證書
    note:你需要有一個openssl.cnf文件,如果沒有創建一個,用-config 指明,具體格式可以自己到www.openssl.org看看

     wingger 回復于:2005-01-07 14:19:58
    openssl的參數-signkey就可簽證,不需sign.sh呵呵

     ataman 回復于:2005-03-23 23:36:06
    我的https成功了,能上;ca認證什么的也成功了。但最不爽最關鍵的是:
    客戶端登陸網站時證書驗證不通過!我基本上都是按照樓主和其他資料作的。
    我是在自己的機器上做試驗的,服務器客戶都在一臺機器上。作了好幾個pfs的證書,登錄網站時沒一個能登上的。
    winxp pro sp2, apache 2.0.53 ,openssl 0.97e(mod_ssl,openssl.cnf都有)
    國家我都是cn,所有的域名都是www.xxx.com 郵箱xxx@xxx.com,部門都是ga,小部門都是rs.....所有文件所要填的信息都相同。我都是按照樓主的步驟來的,可能是什么問題呢?
    我自始至終都是用1個用戶登陸的windows。

     ioly 回復于:2005-04-28 08:52:12
    我也出現了
    停止 httpd:[失敗] 
    啟動 httpd:Apache/2.0.40 mod_ssl/2.0.40 (Pass Phrase Dialog) 
    Some of your private key files are encrypted for security reasons. 
    In order to read them you have to provide us with the pass phrases. 

    Server new.host.name:443 (RSA) 
    Enter pass phrase: 

    Ok: Pass Phrase Dialog successful. 
    [失敗] 
    的錯誤,求助!

     squall1 回復于:2005-04-30 23:37:13
    ???還是不要用系統自帶的那些包好。我的一切正常。






     ttvast 回復于:2005-05-03 14:41:57
    squall啊,我們懂的再多也比不上redhat里的專家,系統自帶的東西總是有點好處的哦

     platinum 回復于:2005-08-24 18:09:27
    如何能不用輸入密碼就啟動 HTTPS 呢?(如果不用簽證書的那種)

     ataman 回復于:2005-08-25 23:57:45
    在ssl.conf里注釋掉開頭的兩句話就行了吧。

     haoyufu 回復于:2005-08-26 10:20:59
    對注釋掉就可以了

     zuojian77 回復于:2005-08-28 22:55:00
    生成公、私鑰時使用
    /usr/bin/openssl genrsa 1024 > /etc/httpd/conf/ssl.key/server.key
    命令,也就是不用口令加密公、私鑰,啟動服務器的時候就不用輸入口令了。

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>