puppet學習之puppet證書驗證

1、關於證書在master的認識node

咱們知道puppet爲了安全,採用ssl隧道通訊,所以須要申請證書來驗證的,當puppet master第一次啓動的時候,能夠查看/var/log/message有相似以下的信息:安全

Jul 25 03:14:01 localhost puppet-master[25011]: Signed certificaterequest for casession

Jul 25 03:14:01 localhost puppet-master[25011]: Rebuilding inventoryfileide

Jul 25 03:14:01 localhost puppet-master[25011]: puppet.zhang.com hasa waiting certificate requestui

Jul 25 03:14:01 localhost puppet-master[25011]: Signed certificaterequest for puppet.zhang.comthis

Jul 25 03:14:01 localhost puppet-master[25011]: Removing filePuppet::SSL::CertificateRequest puppet.zhang.com at'/etc/puppet/ssl/ca/requests/puppet.zhang.com.pem'spa

Jul 25 03:14:01 localhost puppet-master[25011]: Removing filePuppet::SSL::CertificateRequest puppet.zhang.com at'/etc/puppet/ssl/certificate_requests/puppet.zhang.com.pem'日誌

從日誌中咱們能夠看出第一次啓動的時候,puppet master建立本地認證中心,給本身簽發證書和key,你能夠在/etc/puppet/ssl看到那些證書和key。這個目錄和/etc/puppet/puppet.conf文件中配置的ssldir路徑有關係。server

ll /etc/puppet/ssl/ssl目錄的內容以下:md5

drwxrwx--- 5 puppet puppet 4096 Jul 25 03:01 ca

drwxr-xr-x 2 puppet root4096 Jul 25 03:01 certificate_requests

drwxr-xr-x 2 puppet root4096 Jul 25 03:01 certs

-rw-r--r-- 1 puppet puppet398 Jul 25 03:01 crl.pem

drwxr-x--- 2 puppet root4096 Jul 25 03:01 private

drwxr-x--- 2 puppet root4096 Jul 25 03:01 private_keys

drwxr-xr-x 2 puppet root4096 Jul 25 03:01 public_keys


2、關於證書在agent的認識

puppet agent在第一次鏈接master的時候會向master申請證書,若是沒有master沒有簽發證書,那麼puppetagentmaster的鏈接是否創建成功的,agent會持續等待master簽發證書,並會每隔2分鐘去檢查master是否簽發證書。

經過puppet agent --server= puppet.zhang.com --no-daemonize –verbose啓動的時候能很清楚的查看到agent申請證書的過程

puppet agent --server=puppet.zhang.com --no-daemonize --verbose

info: Creating a new SSL key for node1.zhang.com

info: Caching certificate for ca

#申請證書

info: Creating a new SSL certificate request for node1.zhang.com

info: Certificate Request fingerprint (md5):54:11:FB:75:87:94:AF:6B:D1:6B:AD:6B:44:3E:74:A0

#等待證書籤發

warning: peer certificate won't be verified in this SSL session

#2分鐘檢查一次,若是沒有簽發就顯示以下信息

notice: Did not receive certificate

#證書籤發成功後,順利創建鏈接

info: Caching certificate for node1.zhang.com

notice: Starting Puppet client version 2.6.16

info: Caching certificate_revocation_list for ca

info: Caching catalog for node1.zhang.com

info: Applying configuration version '1344943902'

notice: Finished catalog run in 0.11 seconds

相似於上面的就是去申請證書了。當master簽發證書之後就能夠順利創建鏈接了。


3、Master端證書的管理

1.master上查看申請證書請求

puppet cert --list

2.簽發證書

puppet cert --sign node1.zhang.com

若是一次性簽發全部的證書,採用以下命令:

puppet cert --sign –all

也能夠設置自動簽發證書。

3.讓證書過時

puppet cert -revoke puppet-test

刪除證書

puppet cert --clean puppet-test

證書籤名的過時或刪除須要重啓puppetmaster服務。

4.能夠經過/etc/puppet/auth.conf文件配置簽名的ACL列表。


4、Agent端證書的管理

1.刪除已有的證書

清空/etc/puppet/ssl(這個目錄和你的/etc/puppet/puppet.conf文件中配置的ssldir路徑有關係)下的文件和目錄

2.重啓申請證書

puppet agent --server puppet.zhang.com--test

在客戶端與服務端簽名不能正常進行的時候,請刪除後從新簽名

相關文章
相關標籤/搜索