diff options
author | Tim Smith <tsmith@chef.io> | 2019-10-14 12:08:15 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-14 12:08:15 -0700 |
commit | 77e9a1e57eb415d717ed613c59dc68fe97c5fd5e (patch) | |
tree | fb9894948fd2ed9de7608fda6883c5c98eb9f831 /lib | |
parent | e04d5d2ec907aefa989502d86d259f9ecf01e786 (diff) | |
parent | aacdcfc3165f4498e9541fd32f766343db630f3e (diff) | |
download | chef-77e9a1e57eb415d717ed613c59dc68fe97c5fd5e.tar.gz |
Merge pull request #8895 from MsysTechnologiesllc/Nimesh/MSYS-1098_handle_race_condition
Using umask to avoid race conditions in bootstrap
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/knife/bootstrap/templates/chef-full.erb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/chef/knife/bootstrap/templates/chef-full.erb b/lib/chef/knife/bootstrap/templates/chef-full.erb index cfcdf11a28..b0476c8d57 100644 --- a/lib/chef/knife/bootstrap/templates/chef-full.erb +++ b/lib/chef/knife/bootstrap/templates/chef-full.erb @@ -188,24 +188,24 @@ fi mkdir -p <%= Chef::Dist::CONF_DIR %> <% if client_pem -%> -cat > <%= Chef::Dist::CONF_DIR %>/client.pem <<'EOP' +(umask 077 && (cat > <%= Chef::Dist::CONF_DIR %>/client.pem <<'EOP' <%= ::File.read(::File.expand_path(client_pem)) %> EOP -chmod 0600 <%= Chef::Dist::CONF_DIR %>/client.pem +)) || exit 1 <% end -%> <% if validation_key -%> -cat > <%= Chef::Dist::CONF_DIR %>/validation.pem <<'EOP' +(umask 077 && (cat > <%= Chef::Dist::CONF_DIR %>/validation.pem <<'EOP' <%= validation_key %> EOP -chmod 0600 <%= Chef::Dist::CONF_DIR %>/validation.pem +)) || exit 1 <% end -%> <% if encrypted_data_bag_secret -%> -cat > <%= Chef::Dist::CONF_DIR %>/encrypted_data_bag_secret <<'EOP' +(umask 077 && (cat > <%= Chef::Dist::CONF_DIR %>/encrypted_data_bag_secret <<'EOP' <%= encrypted_data_bag_secret %> EOP -chmod 0600 <%= Chef::Dist::CONF_DIR %>/encrypted_data_bag_secret +)) || exit 1 <% end -%> <% unless trusted_certs.empty? -%> |