Creating secure web server on OSX

2008/08/22
~ 阿亮 ~

Creating secure web server on OSX

MacOSX 10.5.4 Leopard with MacPorts

原本參考 Using mod_ssl on MacOSX  來設 https server,用

openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
openssl genrsa -des3 -out ca.key 1024
openssl req -new -x509 -days 365 -key ca.key -out ca.crt

四個步驟,但不能用,會有下述的訊息

sec_error_bad_signature

所以,改用 Creating Secure Transactions on Mac OS X server Using SSL 這篇的方法,依序執行

/opt/local/etc/openssl/misc/CA.pl -newreq
/opt/local/etc/openssl/misc/CA.pl -newca
/opt/local/etc/openssl/misc/CA.pl -signreq

依序將下述的檔案拷貝到 /opt/local/apache2/conf

cp newkey.pem /opt/local/apache2/conf/server.key
cp newcert.pem /opt/local/apache2/conf/server.crt
cp demoCA/cacert.pem /opt/local/apache2/conf/ca.crt

設定 httpd.conf 將下面這行 comment 去掉

#Include conf/extra/httpd-ssl.conf

然後,修改 httpd-ssl.conf 要有包含下述三行:

SSLCertificateFile "/opt/local/apache2/conf/server.crt"
SSLCertificateFile "/opt/local/apache2/conf/server.crt"
SSLCertificateChainFile "/opt/local/apache2/conf/ca.crt"

但此時 apache 重開時,會問 server.key 的 passphrase,用下述方法避免再詢問

cd /opt/local/apache2/conf
cp server.key server.key.orignal
openssl rsa -in server.key.orignal -out server.key

這時,因為 ca self-signature 的問題,仍會出現錯誤碼: sec_error_unknown_issuer,但至少可以「新增例外網址」來使用。



站內搜尋



本站其他服務

本站其他軟體



  • 國道一路通(FreeWay)

    打開定位即實際地圖上繪製所在地中心附近的車況圖,可縮放地圖,不再是小小的縮小圖,快速了解高速公路的路況。


  • 下一班公車(nextBus)

    這個 app 只要開啟後,就根據定位幫你過濾出附近站牌的時刻表,以及提供相關公車預計到站的時間,方便您在很快時間內確定要坐的哪一班公車


  • 臉書粉絲專頁搜尋 (FPSearch)

    不用登入臉書即可搜尋臉書粉絲專頁(臉書粉絲團)所公開的文章。您可以指定特定日期範圍之前的文章,也可設定搜尋粉絲專頁內包含特定關鍵詞的文章。


  • 下一班高鐵 (nextTHSR)

    這個 app 只要開啟後,就根據定位幫你過濾出最近高鐵站的時刻表,不用再按任何按鈕了,方便您在很快時間內確定要坐的哪一班高鐵


  • 台灣匯率快算

    提供全球 150 種以上貨幣即時換算,以及各種匯率歷史變化圖。


  • 標案快訊

    讓你可以輕鬆追蹤含有您想要關注關鍵詞的任何採購標案,只要有最新的資訊,「標案快訊」即會推播通知給你.