0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Puppet boltを使用して複数サーバに接続したら、Authentication failed for~のようなエラーが出たため、解消メモ

Last updated at Posted at 2021-05-05

こんにちは、tanzoです。

本日もPuppetBoltについてのお話です。
と言っても備忘録程度の内容なので、同じエラーで詰まっている人がいたら、
少しでも役に立てば、、、、と思います。

複数サーバにアクセスする際の鍵作成の注意点

  • 例えば、以下のコマンドでは、2つのサーバからkernelのバージョンを取得しようとしています。

コマンド

[yuta@localhost bin]$ ./bolt command run "uname -r" --targets ユーザ名1@IP,ユーザ名2@IP

ここで、もしサーバごとに認証する鍵を分けていた場合、上記コマンド実行した際に、以下のようなエラーが出力されます。
※この場合の認証する鍵を分けるというのは、ssh-keygenコマンドで作成したid_rsa.pubファイルの名前をid_rsa_centos.pubのように改名して、接続サーバごとに鍵を一つずつ作っておくことを言います。

コマンド

Started on ユーザ名1@IP...
Started on ユーザ名2@IP...
all authorization methods failed (tried none, publickey, password, keyboard-interactive)
Failed on ユーザ名1@IP:
  Authentication failed for user ユーザ名1@IP → なんか権限エラーって怒られている。。。
Finished on ユーザ名2@IP:
  xxxxxxxxxxxxxxxxx  →  これは上手く取れている(実際のバージョンは省略)
Successful on 1 target: ユーザ名2@IP
Failed on 1 target: ユーザ名1@IP
Ran on 2 targets in 1.41 sec

上記では、1つのサーバからはうまくkernelのバージョンが取れていますが、もう一つはAuthentication failed forのようなエラーが出て、取れていないですよね。。。

なので、___id_rsa.pubの名前は変えてはいけない___というのが、分かりました笑

結論として、クライアント側で作成した公開鍵で複数のサーバに接続する場合にも、使用する公開鍵は1つにすると覚えておきましょう。(自分に対する言い聞かせ笑)

→ とは言っても、鍵を使いまわせるようにするのは、セキュリティ上あまりよくなかったりする気もするので、この辺の知見がある方、コメントを下さると幸いです、、、

参考文献

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?