close
實驗環境
 
CentOS 5.4(Postfix) : Postfix 已啟動,繼上一章操作已完成SMTP SASL , 正常 POP3與

IMAP 收信(mail.shengyao.idv.tw)
 
Fedora12(CA_Server)(已初化安裝OK): 憑證CA Server , 讓Postfix Mail Server 申請憑證

產生newcert.pem 之用
(操作後半段更名為cert.pem)並將其金鑰copy 成cert.crt

供client匯入用(點兩下即可匯入)
 
操作LAB流程介紹
 
(1.): Postfix(192.168.0.196)上我們在/etc/pki/tls/misc下 產生private.key 與

        public.key 
: mail server 主機名定為
mail.shengyao.idv.tw
 
(2.): 接者我們將Postfix原生public.key 傳送至CA_Server(192.168.0.194)

          錄: /etc/pki/tls/misc底下
進行CA解密->解密動作產生newcert.pem 檔案
 
       收到newcert.pem  , 與上層目錄下CA的根憑證 cacert.pem  2 個檔案 利用SCP 將此檔案

       傳送回
Postfix Server 下的  /etc/pki/tls/misc 目錄下
 
(3.)由於用戶端 outlook 不認得 private.key (原newkey後面會更名)加密後檔案格式,我們利用

     openssl  此指令將該key解密,並授與安全權限600
 
(4.)將CA解密->加密完成後的cert.pem(public): Copy 最底下一長傳加密過KEY...更名儲存為

     cert.crt
發怖給client端匯入用
 
(5.)接者我們後續將修改SMTP SSL , POP3s ,IMAPs ,OPEN WEBMAIL SSL 相關檔案參數

     Do正確驗證並
最後Test
 
 
  (1.) Postfix 產生金鑰 :  下圖我們切換到 /etc/pki/tls/misc 下 利用

         ./CA  -newreq  產生 mail.shengyao.idv.tw (公開與私人金鑰)
 
         newreq.pem   #  公開金鑰: 將此金鑰產生後我們將SCP 傳輸至CA
 
         newkey.pem #  私密金鑰: 後面陸續操作會將此金鑰做解密並更名為private.key 

         授與600權限
 
     
   
  (2.) CA Server ./CA -sign  :  我們將 Postfix   /etc/pki/tls/misc 下的 newreq.pem 利用

         scp將該檔傳送到 CA Server  /etc/pki/tls/misc 
 
       底下執行 ./CA -sign  將CA 資訊將其key做解密再加密動作

     
(產生newcert.pem過程中會用到上述產生KEY設定密碼)
                                                                                           
   
 
(3.) CA Server   :  底下動作是預先將newcert.pem 中產生KEY  COPY成 cert.crt

    
(供客戶端匯入該憑證用_您可以散怖該key結合AD)

 
 
  (4.) CA Server  SCP  :  底下動作是將剛CA Server 產生的newcert.pem 傳送給

          Postfix  /etc/pki/tls/misc 目錄下
 
 
 
  (5.) Postfix Server   :  

     回到Mail Server 我們可以看到 newcert.pem
已經被 copy 過來
 
    利用 cat  newkey.pem (私密key) 查看DES加密訊息: 預設Outlook 是無法讀出(會有錯誤)
 
 
 
   (6.) Postfix Server   :  接下來我們將newkey.pem  先更名為 private.key.des3 

         
然後利用以下comand 解密
                                       
                                        "當解密完成後即輸出成private.key"
 
             openssl  rsa  -in   private.key.des3  -out   private.key
 
           
            chmod 600 private.key           # 更改private.key 安全權限
 
            mv newcert.pem   cert.pem   

           #更改newcert.pem 為 cert.pem ,並把多於的檔案刪除

          
EX: newreq.pem
 
    
 
      (7.) Postfix Server _SMTP_SSL   :  接下來我們將設定 /etc/postfix/mai.cf   

            以達到
SMTP支
援SSL目的
 
       #SMTP_SSl請至空白處加入底下幾行; 底下LAB在 /etc/pki/tls/misc/
       smtpd_use_tls = yes 
       smtpd_tls_key_file = /etc/pki/tls/misc/private.key         #private.key 目錄指定
      smtpd_tls_cert_file = /etc/pki/tls/misc/cert.pem             #public key 目錄指定
      smtpd_tls_received_header = yes        
      smtpd_tls_CAfile = /etc/pki/tls/misc/cacert.pem           #CA的cacert.pem 指定
      smtpd_tls_session_cache_timeout = 3600s
 
      *設定完成存檔,請重新再啟動Postfix*
 
   
 
      (8.) Postfix Server _SMTP_SSL   :  接下來我們將Outlook Express  中 25 port 下
 
             SSL勾選
發信測試OK即表示SSL測試成功
 
   
 
      (9.) Postfix Server _OPENWEBMAIL_SSL   : 

            接
下來我們將OPENWEB MAIL 動作進行https加密動作
                           
                         vi     /etc/http/conf.d/ssl.conf
 
             請找到 SSLCertificateFile         #依上述設置對應指定目錄(公開金鑰)
 
             請找到 SSLCertificateKeyFile   #依上述設置對應指定目錄(私密金鑰)
 
 
              *設置完成後請記得重啟httpd生效*
 
     
 
       (10.) Postfix Server _OPENWEBMAIL_SSL  : 接者我們打開
 
               https://mail.shengyao.idv.tw/webmail  利用https 登入測試OK
 
       #正常運行下是不會出現憑證錯誤訊息#   下圖點選網址右測"鎖頭",檢查憑證內容無誤即OK
                         
 
        (11.) Postfix Server _IMAP TLS  :
 
               接者我們修改
/etc/dovecot.conf 讓用戶端支援 IMAPs &POP3s
 
                 vi   /etc/dovecot.conf
 
               找到   ssl_cert_file =   #依上述設置對應指定目錄(公開金鑰)   
 
                         ssl_key_file =    #依上述設置對應指定目錄(私密金鑰)
           
 
              
 
         (12.) Postfix Server _IMAP TLS  :
 
                 接者我們修改
/etc/dovecot.conf 讓用戶端支援 IMAPs &Pop3s
 
                 protocols = pop3s  imaps       #修改支援pop3s 與 imaps 收信方式
 
                       *修改完成請重新啟動dovecot* 
       
 
         接者我們要將用戶端  keynes@shenguao.idv.tw 用戶端Dreammail 收信軟體 
 
         如圖下方的 ssl 打勾Port號會變成995(可點選收發測試,Test 結果應當無錯誤訊息)
 
     
 
       最後我們用 wuda2@shengyao.idv.tw 測試發信 keynes@shengyao.idv.tw  

       查覺信
件內容已加密成功)
 
      cd /var/spool/mail
 
             cat  keynes             
  
     
 
    接者我們利用 telnet localhost 25  測試(TLS是否已啟動)若發現以下值表示本LAB測試

    已告一段落
 
    250-SMARTLS                           #TLS 啟用成功
 
 
             
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 終極.凱因斯 的頭像
    終極.凱因斯

    NEIL`s_IT技術學習分享發表Blog

    終極.凱因斯 發表在 痞客邦 留言(0) 人氣()