RHEL5.5に、knife solo prepare
したらSSLサーバ証明書のエラーが出ました。
対処法: 「RHELのサーバ証明書(CRTファイル)を上書きする」です。
今回の環境
- WORKSTATION: MacOSX 10.8.4
- NODES: RedHat Enterprise Linux 5.5(以下、RHELと書きます)
- Ruby: 1.9.3p448
- chef: 11.6.0
- knife-solo: 0.3.0
- IaaS: AWS EC2
事象まとめ
MacからRHEL5.5 にknife solo prepare
を実行すると、curl
コマンドでエラーが発生した。
SSL サーバ証明書を以下の通り上書きした後に、再度knife solo prepare
を実行すると上手くいった。
ちなみに、Amazon Linux の場合は、こんなことをしなくてもすんなり上手くいった。
knife solo prepare コマンドって何でしたっけ?
knife solo prepare
コマンドは、NODES(料理されるサーバ)にChef をインストール&レシピ走らせるを一度にするコマンドです。要は、Chef Solo使うための準備用のコマンドなので、一度だけ実行すればそれでOKです。
やり方
- Mac(Chefで言うWORKSTATION)からRHEL側(Chefで言うNODES)にログインします。
- RHELのSSLサーバ証明書を上書きします。
- RHELを抜けます。
- Macで
knife solo prepare
打つと正常に処理が走って、RHELにChefがインスコされます。
$ vagrant ssh
[root@ip-xxx-xxx-xxx-xxx ~]# sudo curl http://curl.haxx.se/ca/cacert.pem -o /etc/pki/tls/certs/ca-bundle.crt
[root@ip-xxx-xxx-xxx-xxx ~]# exit
$ knife solo prepare root@ec2-xxx-xxx-xxx-xxx.ap-northeast-1.compute.amazonaws.com -i ~/aws-key.pam
※ 上記は、vagrant ssh
コマンドでRHELにログインしてますが、この記事はRHEL5.5の証明書の話なのでvagrantは関係ないです。ログイン出来れば何でもOKです。
ちなみに、VagrantでEC2上にRHEL5.5を作る話はコチラです→ Vagrantで AWS EC2インスタンス(RHEL5.5)を作成する
この記事通り環境を作って、今度はChef Solo動かそうとなった時にこの記事が関係してきます。
【参考】エラー内容
証明書上書き前にknife solo prepare
を打つとこんなん出ます。
$ knife solo prepare root@ec2-xxx-xxx-xxx-xxx.ap-northeast-1.compute.amazonaws.com -i ~/aws-key.pem
Bootstrapping Chef...
curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html
curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). The default
bundle is named curl-ca-bundle.crt; you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.
bash: install.sh: No such file or directory
Generating node config 'nodes/ec2-xxx-xxx-xxx-xxx.ap-northeast-1.compute.amazonaws.com.json'...