跳到主要內容

發表文章

目前顯示的是有「Certificate」標籤的文章

Let's Encrypt

Introduction 原先我使用StartSSL的免費Certificate在我的web server上,後來因為此篇 新聞 的原因,導致我需要找新的方法。Let's Encrypt是Linux基金會託管項目,雖然每次證書只有三個月的效用,但可解我燃眉之急。 2024-07-22 後來我改用docker+Let's Encrypt了。 How to? 無法啟動httpd的問題 我參考了 此篇教學 。cerbot這隻程式將一切過程變得相當容易,首先下載cerbot: mkdir / opt / cerbot cd / opt / cerbot wget https: // dl.eff.org / certbot-auto chmod a+x certbot-auto 接著就是使用管理權限執行cerbot,而我遇到的問題是驗證失敗,這是由於驗證伺服器無法連接到我伺服器而造成的。原因是httpd啟動失敗: 這是由於cerbot自動產生一個ssl設定到httpd/conf下,與原本的衝突導致的;於是我註解原本的ssl設定後,就可以正常啟動httpd。最後重新執行certbot,按照指示做重新啟動httpd即可獲得可信任的certificate。 由於它是3個月一簽,透過crontab去幫我們自動更新會比較方便,可以透過以下腳本進行更新: #!/bin/bash / opt / cerbot / cerbot-auto renew --quiet --no-self-upgrade --post-hook "service httpd reload" 在更新後,透過posthook去重新載入httpd設定。crontab設定方法可以參考此link。 多個domain的問題 在完成上面步驟後,我發現www.tonylin.idv.tw可以正常使用,而tonylin.idv.tw不行。後來得知可以透過以下指令擴展domain名稱: . / certbot-auto -d www.tonylin.idv.tw -d tonylin.idv.tw 在執行時,它會問你要擴展還是取代原本的,選擇擴展即可: 最後重新載入httpd即完成。 Reference NGINX 使用 Let’s Encrypt 免費 SSL 憑證設定 ...

How to setup free SSL with StartSSL on apache and tomcat?

Introduction 本篇文章在我重新整理時,可能已經過時了,但我主要想記錄申請憑證過程。 Domain Validation 在拿到Web Server SSL/TLS Certificate前,必須先做Domain Valiation。可以點擊Validations Wizard並選擇Domain Validation開始驗證之路。然而我遇到的問題是: StartSSL根據我domain所解析出來的信箱,沒半個是我的!! 所以我的處置是: 根據 whois 服務所抓到的信箱,抓一張圖一下。 點擊StartSSL驗證畫面右上的report bug,直接告訴它: 沒出現正確的信箱! 請幫忙! 不到兩天就收到了處理結果: 再次進行驗證,我的信箱出現了: 選擇自己信箱,送出驗證碼並做完驗證後,這項目就算完成了。 Web Server SSL/TLS Certificate 點擊Certificates Wizard,接著選擇Web Server SSL/TLS Certificate並送出(2017年時改為DV SSL Certificate)。接著上方就是填入你的hostname,下方就是放csr。csr的部分,我是沒試驗成功,所以我直接用Generated by PKI system。Generated by PKI system在你submit之後,就會產生key讓你下載(ssl.key),下載並送出後就算是申請成功了。接著到Tool Box > Certificate List中,可以看到Certificate列表,點擊Retrieve後會載下一包zip: 解開後,我用到的是apache的2_domainname.crt: Root and Intermediate CA Certificate 接著我們會需要Root與Intermediate CA Certificate。這是用來告訴瀏覽器憑證的驗證機構。如果沒做這個步驟,firefox會跳出警告訊息。 連至https://startssl.com/root。 下載Root CA Certificates: 點擊Root 1 - StartCom Certification Authority中的ca.crt(pem)。(檔名為ca.crt) 下載Intermediate CA Certificat...

Issue personal certificate with keytool

Create a keystore 產生名為test_keystore,10年有效期限的keystore: @ echo off set KEYTOOL =C:\Program Files\Java\jdk1.8.0_91\bin\keytool.exe set KEYSTORE =C:\Program Files\Java\jdk1.8.0_91\bin\test_keystore set ALIAS =test_keystore   "%KEYTOOL%" -keystore "%KEYSTORE%" -alias % ALIAS % -genkey -keyalg RSA -validity 3650 執行畫面如下: Check a keystore 用來確認keystore的內容,我主要確認演算法與有效期間: @ echo off   set KEYTOOL =C:\Program Files\Java\jdk1.8.0_91\bin\keytool.exe set KEYSTORE =C:\Program Files\Java\jdk1.8.0_91\bin\test_keystore   "%KEYTOOL%" -list -v -keystore "%KEYSTORE%"   pause 執行結果如下: Reference Jetty/Howto/Configure SSL keytool常用參數 Java Keytool的使用及申請憑證 i-can-see-sha1-fingerprintthumbprint-on-my-certificate-is-my-certificate-actually-sha2? 憑證指紋是要拿來確認檔案是否正確 openssl-create-certificate-chain-linux

Issue Personal Certificate with openssl

主要參考這篇內容,調整一下讓自己好重複使用: #! /bin/bash ROOT_KEY=rootca.key ROOT_CSR=rooca.csr ROOT_CRT=rootca.crt P_KEY=tonylin.key P_CSR=tonylin.csr P_CRT=tonylin.crt   openssl genrsa -des3 -out $ROOT_KEY 2048 openssl req -new -key rootca.key -out $ROOT_CSR openssl x509 -req -days 7305 -sha1 -extfile /etc/ssl/openssl.cnf -extensions v3_ca \ -signkey $ROOT_KEY -in $ROOT_CSR -out $ROOT_CRT openssl genrsa -out $P_KEY 2048 openssl req -new -key $P_KEY -out $P_CSR openssl x509 -req -days 3650 -sha1 -extfile /etc/ssl/openssl.cnf -extensions v3_req -CA $ROOT_CRT -CAkey $ROOT_KEY \ -CAserial rootca.srl -CAcreateserial -in $P_CSR -out $P_CRT 該填的內容可以自行看那篇教學,我不贅述。 其它 AD預設建出來的certificate是使用Subject Alternative Name去替代Subject。 How to Request a Certificate With a Custom Subject Alternative Name?