Commit e65ff853 authored by Tim Smith's avatar Tim Smith
Browse files

Simplify how we handle user/group properties



Don't try to set a default. We have all this logic already in the file/template resources. Let chef handle the defaults unless someone specifies the default
Signed-off-by: default avatarTim Smith <tsmith@chef.io>
parent 3ac17a99
......@@ -21,9 +21,9 @@ property :path, String, name_property: true
property :key_curve, equal_to: %w(secp384r1 secp521r1 prime256v1 secp224r1 secp256k1), default: 'prime256v1'
property :key_pass, String
property :key_cipher, String, default: 'des3', equal_to: OpenSSL::Cipher.ciphers
property :owner, String, default: node['platform'] == 'windows' ? 'Administrator' : 'root'
property :group, String, default: node['root_group']
property :mode, [Integer, String], default: '0640'
property :owner, String
property :group, String
property :force, [true, false], default: false
action :create do
......@@ -41,8 +41,8 @@ action :create do
file new_resource.path do
action :create
owner new_resource.owner
group new_resource.group
owner new_resource.owner unless new_resource.owner.nil?
group new_resource.group unless new_resource.group.nil?
mode new_resource.mode
sensitive true
content ec_key_content
......
......@@ -20,8 +20,8 @@ property :path, String, name_property: true
property :private_key_path, String
property :private_key_content, String
property :private_key_pass, String
property :owner, String, default: node['platform'] == 'windows' ? 'Administrator' : 'root'
property :group, String, default: node['root_group']
property :owner, String
property :group, String
property :mode, [Integer, String], default: '0640'
default_action :create
......@@ -35,8 +35,8 @@ action :create do
file new_resource.path do
action :create
owner new_resource.owner
group new_resource.group
owner new_resource.owner unless new_resource.owner.nil?
group new_resource.group unless new_resource.group.nil?
mode new_resource.mode
content ec_key_content
end
......
......@@ -7,8 +7,8 @@ property :path, String, name_property: true
property :key_length, equal_to: [1024, 2048, 4096, 8192], default: 2048
property :key_pass, String
property :key_cipher, String, default: 'des3', equal_to: OpenSSL::Cipher.ciphers
property :owner, [String, nil]
property :group, [String, nil]
property :owner, String
property :group, String
property :mode, [Integer, String], default: '0640'
property :force, [true, false], default: false
......
#
# Copyright:: Copyright 2018, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
include OpenSSLCookbook::Helpers
property :path, String, name_property: true
property :private_key_path, String
property :private_key_content, String
property :private_key_pass, String
property :owner, [String, nil]
property :group, [String, nil]
property :owner, String
property :group, String
property :mode, [Integer, String], default: '0640'
action :create do
......
......@@ -4,8 +4,8 @@ provides :openssl_x509_certificate
include OpenSSLCookbook::Helpers
property :path, String, name_property: true
property :owner, String, default: node['platform'] == 'windows' ? 'Administrator' : 'root'
property :group, String, default: node['root_group']
property :owner, String
property :group, String
property :expire, Integer, default: 365
property :mode, [Integer, String], default: '0644'
property :country, String
......@@ -33,8 +33,8 @@ action :create do
file new_resource.path do
action :create_if_missing
mode new_resource.mode
owner new_resource.owner
group new_resource.group
owner new_resource.owner unless new_resource.owner.nil?
group new_resource.group unless new_resource.group.nil?
sensitive true
content cert.to_pem
end
......@@ -43,8 +43,8 @@ action :create do
file new_resource.key_file do
action :create_if_missing
mode new_resource.mode
owner new_resource.owner
group new_resource.group
owner new_resource.owner unless new_resource.owner.nil?
group new_resource.group unless new_resource.group.nil?
sensitive true
content key.to_pem
end
......
......@@ -16,8 +16,8 @@
include OpenSSLCookbook::Helpers
property :path, String, name_property: true
property :owner, String, default: node['platform'] == 'windows' ? 'Administrator' : 'root'
property :group, String, default: node['root_group']
property :owner, String
property :group, String
property :mode, [Integer, String], default: '0644'
property :country, String
property :state, String
......@@ -38,8 +38,8 @@ action :create do
unless ::File.exist? new_resource.path
converge_by("Create CSR #{@new_resource}") do
file new_resource.name do
owner new_resource.owner
group new_resource.group
owner new_resource.owner unless new_resource.owner.nil?
group new_resource.group unless new_resource.group.nil?
mode new_resource.mode
content csr.to_pem
action :create
......@@ -47,8 +47,8 @@ action :create do
file new_resource.key_file do
mode new_resource.mode
owner new_resource.owner
group new_resource.group
owner new_resource.owner unless new_resource.owner.nil?
group new_resource.group unless new_resource.group.nil?
content key.to_pem
sensitive true
action :create_if_missing
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment