Skip to content

Commit 5079f4e

Browse files
committed
Merge pull request mattfinlayson#43 from trumant/cert_perms
Certs and key should not be world readable
2 parents 89e2d2b + a354348 commit 5079f4e

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

tasks/install.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,32 @@
5050

5151
- name: create TLS key
5252
no_log: True
53-
copy: content="{{ consul_tls_key }}" dest="{{ consul_key_file }}" owner={{consul_user}} group={{consul_group}}
53+
copy: >
54+
content="{{ consul_tls_key }}"
55+
dest="{{ consul_key_file }}"
56+
owner={{consul_user}}
57+
group={{consul_group}}
58+
mode=0600
5459
when: consul_tls_key is defined
5560

5661
- name: create TLS cert
5762
no_log: True
58-
copy: content="{{ consul_tls_cert }}" dest="{{ consul_cert_file }}" owner={{consul_user}} group={{consul_group}}
63+
copy: >
64+
content="{{ consul_tls_cert }}"
65+
dest="{{ consul_cert_file }}"
66+
owner={{consul_user}}
67+
group={{consul_group}}
68+
mode=0600
5969
when: consul_tls_cert is defined
6070

6171
- name: create TLS root CA cert
6272
no_log: True
63-
copy: content="{{ consul_tls_ca_cert }}" dest="{{ consul_ca_file }}" owner={{consul_user}} group={{consul_group}}
73+
copy: >
74+
content="{{ consul_tls_ca_cert }}"
75+
dest="{{ consul_ca_file }}"
76+
owner={{consul_user}}
77+
group={{consul_group}}
78+
mode=0600
6479
when: consul_tls_ca_cert is defined
6580

6681
- name: set ownership

test/integration/tls/serverspec/consul_tls_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
describe file("/opt/consul/cert/#{file}") do
1212
it { should be_file }
1313
it { should be_owned_by('consul') }
14+
it { should be_mode 600 }
1415
end
1516
end
1617

0 commit comments

Comments
 (0)