を話す人形にAugeasを翻訳:人形がなけれ私は、configファイル変更したい人形のaugeas機能を使用してAugeas
/etc/ssh/sshd_config
を私はAugeasの「augtool」を使用して実験して動作するようには思え行のカップルを見つけました:
augtool> set /files/etc/ssh/sshd_config/Match[1]/Condition/User "bill","ben"
augtool> set /files/etc/ssh/sshd_config/Match/Settings/PasswordAuthentication "no"
augtool> save
実際にはうまくいくように見えますが、ここで[1]がどのような目的で使用されているかわかりません。
は私が人形にそれらのラインを入れて、成功せずにしようとしました: エラー:/ステージ[メイン]/Samipermissions/Augeas [sshd_configファイル]:評価しませんでした:保存
augeas { "sshd_config":
context => "/files/etc/ssh/sshd_config",
changes => [
'set Match[1]/Condition/User "bill","ben"',
'set Settings/PasswordAuthentication "no"',
],
}
それはエラーになります失敗しました。デバッグを参照してください。
パズルをデバッグモードで実行すると、同じことが分かります。
これはどのように動作するようになっているのですか?
ありがとうございます。 あなたの答えは私が私がまだマッチの配列で少し失われていると思いますが、私はエラーを過ぎて移動しました。 "augtoolは" 私は次の操作を行うことができます使用:
set /files/etc/ssh/sshd_config/Match[1]/Condition/User "neil","nigel"
set /files/etc/ssh/sshd_config/Match[1]/Settings/PasswordAuthentication "no"
set /files/etc/ssh/sshd_config/Match[2]/Condition/User "yvonne","yvette"
set /files/etc/ssh/sshd_config/Match[2]/Settings/PasswordAuthentication "yes"
を設定ファイルでは、これは次のように表示されます完璧です
Match User neil,nigel
PasswordAuthentication no
Match User yvonne,yvette
PasswordAuthentication yes
を。私はと人形にこれを翻訳:
augeas { "sshd_config":
context => "/files/etc/ssh/sshd_config",
changes => [
'set Match[1]/Condition/User "neil","nigel"',
'set Match[1]/Settings/PasswordAuthentication "no"',
'set Match[2]/Condition/User "yvonne","yvette"',
'set Match[2]/Settings/PasswordAuthentication "yes"',
],
}
しかし、設定ファイルの結果はかなり異なっている:
Match User neil
PasswordAuthentication no
Match User yvonne
PasswordAuthentication yes
また、[augeasproviders_ssh](https://forge.puppet.com/herculesteam/augeasproviders_ssh)には、条件をかなりうまく管理する 'sshd_config'プロバイダがあります:https://forge.puppet.com/herculesteam/augeasproviders_ssh#manage -entry-in-a-match-block –
Raphinkありがとうございましたが、私はAugeasに取り入れようとしていますが、インポートされたモジュールを使用するよりもむしろ – user835745
m0dlxありがとうございました。悲しいことに、私はする必要があります。あなたの助けを借りて質問に追加しました – user835745