Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CHEF
cookbooks
sys
Commits
ae4746a4
Commit
ae4746a4
authored
May 31, 2022
by
m.pausch
Browse files
By popular demand
parent
00f9c742
Changes
2
Hide whitespace changes
Inline
Side-by-side
libraries/sys_helpers_x509.rb
deleted
100644 → 0
View file @
00f9c742
#
# Cookbook:: sys
# Library:: Helpers::X509
#
# Copyright:: 2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
#
# Authors:
# Matthias Pausch (m.pausch@gsi.de)
#
# 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.
#
# This code is an adjustment of https://github.com/sous-chefs/firewall
#
module
Sys
module
Helpers
module
X509
def
certificate_file_content
(
new_resource
)
cert_item
=
data_bag_item
(
new_resource
.
data_bag
,
new_resource
.
bag_item
)
cert_item
[
'file-content'
]
end
def
key_vault_item
(
new_resource
)
new_resource
.
vault_item
||
new_resource
.
bag_item
end
def
key_file_content
(
new_resource
)
key_item
=
chef_vault_item
(
new_resource
.
chef_vault
,
key_vault_item
(
new_resource
))
key_item
[
'file-content'
]
end
end
end
end
resources/x509_certificate.rb
View file @
ae4746a4
...
...
@@ -25,7 +25,19 @@
if
Gem
::
Requirement
.
new
(
'>= 12.15'
).
satisfied_by?
(
Gem
::
Version
.
new
(
Chef
::
VERSION
))
action_class
do
include
Sys
::
Helpers
::
X509
def
certificate_file_content
cert_item
=
data_bag_item
(
new_resource
.
data_bag
,
new_resource
.
bag_item
)
cert_item
[
'file-content'
]
end
def
key_vault_item
new_resource
.
vault_item
||
new_resource
.
bag_item
end
def
key_file_content
key_item
=
chef_vault_item
(
new_resource
.
chef_vault
,
key_vault_item
)
key_item
[
'file-content'
]
end
end
provides
:x509_certificate
,
os:
'linux'
...
...
@@ -55,7 +67,7 @@ if Gem::Requirement.new('>= 12.15').satisfied_by?(Gem::Version.new(Chef::VERSION
begin
file
new_resource
.
certificate_path
do
content
certificate_file_content
(
new_resource
)
content
certificate_file_content
owner
'root'
group
'root'
mode
'0644'
...
...
@@ -66,7 +78,7 @@ if Gem::Requirement.new('>= 12.15').satisfied_by?(Gem::Version.new(Chef::VERSION
begin
file
new_resource
.
key_path
do
content
key_file_content
(
new_resource
)
content
key_file_content
owner
'root'
group
'ssl-cert'
mode
'0640'
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment