2012-06-13

AWS IAMユーザにSigning Certificate(X.509証明書)を追加する

IAM(AWS Identity and Access Management)ユーザにAWS Consoleを利用してSigning Certificateを追加する方法はオフィシャルのドキュメントに書かれている訳ですが、IAM Foxといツールを利用して追加作業をやってみたのでメモφ(・ω・ )

まずは、肝心の鍵ファイルの作成
Linux上のopensslコマンドを利用しました。
1.Private Keyの作成
2048bitでhoge.keyというファイルを作成しました
  1. $ openssl genrsa -des3 -out hoge.key 2048  
  2.   
  3. openssl genrsa -out ozawa.key 2048  
  4. Generating RSA private key, 2048 bit long modulus  
  5. ......................................................+++  
  6. .........................................................................+++  
  7. e is 65537 (0x10001)  
  8. Enter pass phrase for ozawa.key:  
  9. Verifying - Enter pass phrase for ozawa.key:  
パスフレーズなしにしたい場合は-des3を抜けばOK 2.Certificate Signing Request (CSR)の作成
  1. openssl req -new -key hoge.key -out hoge.csr  
  2. You are about to be asked to enter information that will be incorporated  
  3. into your certificate request.  
  4. What you are about to enter is what is called a Distinguished Name or a DN.  
  5. There are quite a few fields but you can leave some blank  
  6. For some fields there will be a default value,  
  7. If you enter '.', the field will be left blank.  
  8. -----  
  9. Country Name (2 letter code) [GB]:JP  
  10. State or Province Name (full name) [Berkshire]:Tokyo  
  11. Locality Name (eg, city) [Newbury]:Tokyo  
  12. Organization Name (eg, company) [My Company Ltd]:company  
  13. Organizational Unit Name (eg, section) []:  
  14. Common Name (eg, your name or your server's hostname) []:hoge  
  15. Email Address []:  
  16.   
  17. Please enter the following 'extra' attributes  
  18. to be sent with your certificate request  
  19. A challenge password []:  
  20. An optional company name []:  
住所やら所属やら聞かれるけれど適当に入力 3.Self-Signed SSL Certificatの作成 アップロードするのはこのファイルです。
  1. openssl x509 -req -days 3650 -in hoge.csr -signkey hoge.key -out hoge.crt  
  2. Signature ok  
  3. subject=/C=JP/ST=Tokyo/L=Tokyo/O=company/CN=hoge  
  4. Getting Private key  

予め、AWSのアカウントはIAM Foxに登録されていて、IAMユーザが作成されていることを前提にします
4.IAM FoxでSigning Certificateを追加したいユーザを右クリックしてCertificateを選択

5. Addボタンを押してNew Certificateにhoge.crtの中身を入力してOKボタン

6.追加されると、自動的に名前が付与され、StatusがActiveになります

Private Key Fileにあたるのがhoge.key
X.509証明書(X.509 Certificate)にあたるのがhoge.crt
になります。

0 件のコメント:

コメントを投稿