2016-10-14 16 views
1

を使用してsetuidをするので、私は書いた本:は、どのように私は、ファイル<a href="https://github.com/itamae-kitchen/itamae" rel="nofollow">Itamae</a>を使用して属性を変更したい板前

file '/usr/local/bin/jobber' do 
    action :edit 
    owner 'jobber_client' 
    group 'root' 
    mode '04755' 
end 

ownersetuidを実行せずにgroup属性が期待通りに変更されたが、modeだけ755に変更ファイルに追加します。

setuidItamaeとするにはどうすればよいですか?

+0

** file **リソースで 'user'パラメータを使用してみることができますか:https://github.com/itamae-kitchen/itamae/wiki/file-resource – Nikhil

+0

' user'にはどのような値を設定すればよいですか?パラーム? – ironsand

+1

ここに私がコミットしたパッチがあります: https://github.com/itamae-kitchen/itamae/commit/bdcba8e19bcd1f36a2f5af6ab51733c5682013d3 –

答えて

1

Itamaeは '4xxx'を無視しませんが、まずchmodを呼び出してからchownを呼び出します。問題はchownはchmodによって設定されたsuidを削除します。あなたは

itamae local recipe.rb --log-level=debug 

は2つのIFSの位置を交換してそれを見ることができ

https://github.com/itamae-kitchen/itamae/blob/master/lib/itamae/resource/file.rbでデフaction_create(オプション)とデフaction_edit(オプション)で

 if attributes.mode 
      run_specinfra(:change_file_mode, change_target, attributes.mode) 
     end 

     if attributes.owner || attributes.group 
      run_specinfra(:change_file_owner, change_target, attributes.owner, attributes.group) 
     end 

はトリック

を行います

私はパッチを提出します。一方

、これは動作しているようです:

jobber = '/usr/local/bin/jobber' 

file jobber do 
    action :edit 
    owner 'jobber_client' 
    group 'root' 
    mode '0755' 
end 

execute "setuid #{jobber}" do 
    command "chmod u+s \"#{jobber}\"" 
end 
2

bug filed against Chefhereを固定されているようだ同様の問題のためにありました。

Itamaeも同じ問題の影響を受けている場合、ファイルを最初に作成してから後で修正するのが最善の回避策のようです。

関連する問題

 関連する問題